Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. Exactly that. But the defaults for the latter one will probably change for the image UI update.
  2. PHP 6 was never released as stable php version (and discontinued years ago) and 5.3.8 is also not the most recent version to run. I'd really doublecheck if that's the hoster to go.
  3. It's not an issue in terms of security, but rather a (probably small) performance consideration. It just prevents an unnecessary mysql query in case a negative int is supplied.
  4. Wondered about the same thing a few weeks ago. It's just not clear enough that an error, which pops up on each request and leaves things mostly functional, does prevent publishing of pages. https://github.com/ryancramerdesign/ProcessWire/issues/1759
  5. intUnsigned() is still better, because you won't hit the db for an possibly invalid id, even though negative values might be a rare edgecase.
  6. Even better is $sanitizer->intUnsigned() as id's cannot be negative.
  7. Ok, so it seems really like the repeater does just not pick up it's pages for whatever reason. For the record, which pw version are you using?
  8. To add to my post above. You'd need to use "sort=parent", but if that's the case it should only render the restaurant name once and all it's dishes below it. If that's not what you want then I don't understand your request.
  9. $dishes = $pages->find("…, sort=parent, sort=XX"); $parentID = null; foreach($dishes as $dish) { if($parentID === null || $dish->parent->id !== $parentID){ $parentID = $dish->parent->id; // render restaurant headline } // render dish list item }
  10. I'm mostly interested in the class (get_class() will make it shorter) and if it's a PageArray in the ->count(). Also $register is sufficient.
  11. Ah, did you really do $page? In your case the page seems to be $register.
  12. I think the mysql variant would certainly be the most performant. Otherwise you'd need to load all pages holding that field into memory, which is probably not your intend.
  13. If you don't need the $page / $field info I'd rather just use the format(&$str) function. Also I don't really see the need for preg_replace_callback(). preg_replace should be enough as it's already replacing all occurrences, as long as you don't tell it to do otherwise.
  14. You'd need to use var_dump() to actually see what's returned.
  15. The last thing to try would be if theres a difference between $page->getFormatted('mt4') and $page->getUnformatted('mt4').
  16. Does $pages->get(1227)->platform work? It seems like the repeater field doesn't correctly load it's content/pages.
  17. It does look like it should work. What does "$register->mt4->count()" return?
  18. Table is for multiple instances of a group of fields, likewise are pagetables and repeaters. There's currently no fieldtype, which groups fields for only a single instance. Maybe a single-page field could be considered that, but I doubt people being pleased with that solution.
  19. That's just not how processwire does work. Templates do each have a dedicated fieldgroup. This fieldgroup can just hold fields and not groups. One could build a system around that, which does automatically update the fieldgroups of selected templates, but Ryan didn't seems to consider – in other topics about the same request – adding the ability to add groups as equal members of a template as fields. It just doesn't work that way in the internals.
  20. And (again) $session->cart_item is not a variable, it just does return or receive one. You need to update the array separately. $cart_item = $session->cart_item; $cart_item[10]['quantity'] = 20; $session->cart_item = $cart_item:
  21. $session->cart_item is not a variable, which you could check for existance. It's an object ($session), which you ask for a specific key (cart_item). This will either return the item or null if the key is not found.
  22. One could create a Fieldtype, which does kinda link to a set of fields, so one could use $page->group->name, while technically $page->name would also work. Is that what you're looking for?
  23. There are already a bunch of topics about exactly that topic. Currently your options are pagetable, pagetable extended or matrix fields, where the last one is a commercial pro module. Depending on the specific need one might be a better fit than the other.
  24. $event->object will always give you the object the hook function is on. In this case it's pages. $pages->addHookAfter("added", function($event) { // $pages = $event->object; $page = $event->arguments(0); if($page->template->id == 46) { $page->setAndSave('text_1', "test"); } });
×
×
  • Create New...