Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/01/2012 in all areas

  1. Memory isn't an unlimited resource, so there is always a limit as to how many pages you can keep in memory at once. You'd need to code this in a scalable manner, which means find a way to do it that doesn't require loading thousands of pages in memory at once. I'm not sure I understand the code example enough to suggest an alternative. But you can always go directly in with an SQL query ($db->query) if you need to do something that you can't accomplish with the $pages->find(). One other thing I want to mention is that your $selection variable here is open to selector injection. Make sure you run any values you get through $sanitizer->selectorValue(), or a more specific $sanitizer function, before placing them in a selector string. For example: // use selectorVaue when the value will be a freeform string $ip = $sanitizer->selectorValue($input->post->ip); $selection .= ", ip=$ip"; // sanitize with pageName when you expect the value to be [-_.a-z0-9] $action = $sanitizer->pageName($input->post->action); $selection .= ", action=$action"; // typecast to an integer when you expect the value to be a number $us = (int) $input->post->user; $selection .= ", users=$us";
    2 points
  2. @arjen - that was an awesome article. Thanks for the share.
    1 point
  3. I think you could check the "last modified date" of the file itself with php: foreach ($file_pages as $file_page) { int modified = filemtime($file_page->filename); echo "last modified" . date('d-m-Y', modified); } Not testet and assuming that ->filename returns the path + the filename itself
    1 point
  4. I noticed that too... In the meantime you can get it off Soma's page http://somatonic.github.com/ProcessWireCheatsheet/
    1 point
  5. WOW. You guys are awesome. I used net carvers solution of just querying the db directly. It works great.
    1 point
  6. Guys, great work! If you need my help with shopping modules just let me know. I hope to find some time to improve them.
    1 point
  7. When you enable the URL segments option for a given template (Templates > Edit Template > URLs > URL Segments) then PW will accept non-existant URLs, so long as they start with one that does exist. So lets say that you have a page called /products/widget/. If URL segments are enabled, then you could access any URL below that and it would be sent to /products/widget/. So accessing /products/widget/photos/ (a page that doesn't exist) would still get sent to /products/widget/. (If URL segments are not enabled, then of course accessing /products/widget/photos/ would generate a 404 instead.) Using the /products/widget/photos/ URL, the 'photos' portion would be considered URL segment 1. You can check the value of URL segment 1 in your template file with $input->urlSegment1. If there were another segment on there too, like, /products/widget/photos/cats/ then 'cats' would be URL segment 2 ($input->urlSegment2), and so on. The advantage of URL segments is that you can have just 1 page handling many URLs. The portion of those URLs that are translated to URL segments are not pages in PW. In fact, if you actually created a page in PW named /products/widget/photos/, then your 'widget' page would no longer receive the 'photos' URL segment, as the new photos page would then have control over it.
    1 point
  8. I have never removed or slightly suggested that the stuff I use is made by me or the company I work for. Andy Rutledge also has a very interesting point of view regarding white labeling (and branding) and why it isn't really fit for the web.
    1 point
×
×
  • Create New...