Jump to content

Search the Community

Showing results for tags 'ready.php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 4 results

  1. Hi, I want to redirect users that hit 1) pages using a specified template 2) when the url is using a specific syntax. Url syntax is: /PRODUCT/redir/PAGEID Example: /foo/redir/1234 My intention is to redirect the user to the specified PAGEID - but I don't know how to user $input in a hook. How might that be done with hooks in ready.php? $this->addHookBefore('Session::redirect', function(HookEvent $event) { $session = $event->object; // (Product template always lives a root level) if( TEMPLATE == 'product' && INPUT->urlSegment1()=='r' ) { $dest = $pages->get(PAGEID); $session->redirect( $dest->url ); } });
  2. Hi! tell me, pls, how to execute this equality (from ready.php) $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'FIELDNAME') { ..... } } - $hasField The Field object associated with this Inputfield (from definition parent class for InputfieldPage) the left side equation is the object entity, and the right side - the string How it is?
  3. Hello! I apologize in advance if I missed something on the forums. I'm not yet that experienced with hooks and already tried a lot. Maybe someone else has an idea or could give me a hint in the right direction. In my ready.php file I'm creating a random generated URL slug on Pages::setupNew for a specific template. When creating a page and I type in the default language title and leave the other languages blank, the slug gets appended to the page names because the pages have the same url/slug/title but in different trees ( ex. /myarticle-myslug/ and /en/myarticle-myslug/ ) When creating a page and I enter a title for each language, the slug gets only applied to the default language and I get an error that the name for the default language already exists and it was changed to /myarticle-myslug/. The other language gets the page name /en/my-article/ applied. Additionally I noticed that the settings from Module -> Page Name (InputfieldPageName) are not applied when creating the page name using the code below. So non-ascii characters get stripped instead of sanitized Here is a simplified code snippet that I have in the ready.php file: wire()->addHookBefore('Pages::setupNew', function($event) { $page = $event->arguments('page'); if ($page->template->name == 'news-article') { $page->name = $page->title . '-myslug'; } }); I've read this topic and if this still applies, LanguageSupportPageNames isn't used on Pages::setupNew. Especially the post by @Soma looks interesting but I'm not sure how to apply it. Thank you very much in advance.
  4. Hello there! And thanks for Processwire. Got one more interesting question. One of my templates called goods has two repeaters. The first one is variants, each item containing possible sizes, colors and so on. The second one is available_variants, each item should contain a region and a variant which should be selectable from the list of variants. So the task is to get items of one repeater from inside the page reference field which is the part of another repeater, both repeater belonging to the same page. Processwire gives some options for retrieving selectable pages in this case. We can use: Parent. Not an option because we need dynamic parent being in fact the current page which contains both repeaters. Template. Not an option again because we need to select repeater items not only by template but also by page id which is dynamic. Custom find. Could be a solution but have no idea how to substitute the current page id into ID query. Selector string. It's almost what we need, but again i have no idea how to substitute something like "parent={$parent->id}" in this case. Custom PHP code. This needs to be placed inside site/ready.php and should contain a hook which finds pages using all the power of PW API. Think that the last option is the solution, but could not get the result i need. The simplest possible way seems to use $event->arguments('page')->variants. But it returns nothing. Tried different selectors like "template=repeater_variants, parent=".$event->arguments('page')->id , but still no result. Will be grateful for any help. Thanks in advance!
×
×
  • Create New...