Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

754 profile views

Flashmaster82's Achievements

Sr. Member

Sr. Member (5/6)



  1. Thanks for the explanation, i will try to work something out.
  2. Yes i saw that but as a said before i´m a beginner at PHP.. Can you give me some hint/example.. i´m struggling here 🙂 /Thanks
  3. But how do i get specific log? Lets say you are on a page that outputting the form message (front end). I only want that specific message attached to the page. Same date for example. $myLogs = $log->getLines("simplecontactform-log"); foreach ($myLogs as $logs) { echo $logs . "<br><br><br>"; }
  4. Well its hard to understand that page for a beginner when there is no real examples. This is the closest i got. $scf = $modules->get('SimpleContactForm'); $wire = $log->getLogs($scf); foreach($wire as $hejda){ echo $hejda . "<br>"; } And it outputs Array Array Array Array Array Array
  5. I have the "simple contact form" module. And it creates a log in Setup->logs (simplecontactform-log) for every sent email from the form. I want to output the logs in the front end? I also displaying the every email in the front end so i also want the specific log be attached to it. Is that possible? Please help..
  6. Thanks for the explanation. I wanted to use the eq thing but i don´t know how? Im not that good at PHP but im learning. Did 2 different approaches. $status3 = $pages->get('/bokningsstatus/steg3/'); if ($bookingstatus->booking_status === $status3) { require ('assets/bookingstatus/bookingstatus_step3.inc.php'); } if ($bookingstatus->booking_status->id == 1738) { require ('assets/bookingstatus/bookingstatus_step1.inc.php'); } But i wanted to do an if statement if the status in the dropdown is at the first, second, third etc.. with the eq. Then include the inc file. Because if you change the references i wont work.
  7. I have another page that im using a page reference on (booking_status), i tried with the same logic "eq(1)" but it didnt worked? Is eq only for hooks? if ($bookingstatus->booking_status->eq(1)) { require ('assets/bookingstatus/bookingstatus_step2.inc.php'); } I get "Exception: Method Page::eq does not exist or is not callable in this context"
  8. It worked like a charm. Thank you so much!!! I tried to specify the parent but i didnt worked? $wire->addHookAfter('Pages::added', function(HookEvent $event) { $page = $event->arguments(0); if($page->template != 'booking, parent=/nya-bokningar/') return; $selectable_pages = $page->getInputfield('booking_searchactivator_option')->getSelectablePages($page); $first_selectable_page = $selectable_pages->eq(0); $page->setAndSave('booking_searchactivator_option', $first_selectable_page); });
  9. Thanks so much for the reply 🙂 I will look at this and test it out.
  10. I want to select the first option in a page reference fieldtype when adding a new page (admin). Dont want to target the option id because the value may change. Field = booking_searchactivator_option Template = booking Page reference template = searchactivator My current code is only targeting the page id and not the value. So now it becomes id=1. Also i want to be able to change the value to the second value, third value / position in the dropdown. $wire->addHookAfter('Pages::added', function(HookEvent $event) { $page = $event->arguments(0); if (!$page->matches('template=booking')) return; $aktivator = 1; $page->setAndSave('booking_searchactivator_option', $aktivator); }); i also have another hook that removes already selected page references. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { $page = $event->arguments(0); if($event->object->hasField == 'booking_searchactivator_option') { $pages = $event->wire()->pages; $already_selected_on_another_page = $pages->find("template=searchactivator, booking_searchactivator_option.owner.template=booking, booking_searchactivator_option.owner.id!=$page->id"); $event->return = $event->pages->find("template=searchactivator, sort=sort, id!=$already_selected_on_another_page"); } }); Please help!!
  11. Thank you so much for the solution it worked! This is my current code. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { $page = $event->arguments(0); if($event->object->hasField == 'booking_searchactivator_option') { $pages = $event->wire()->pages; $already_selected_on_another_page = $pages->find("template=searchactivator, booking_searchactivator_option.owner.template=booking, booking_searchactivator_option.owner.id!=$page->id"); $event->return = $event->pages->find("template=searchactivator, id!=$already_selected_on_another_page"); } }); Page reference field: booking_searchactivator_option Template that is referred to in the reference field: searchactivator Template that "booking_searchactivator_option" is used on: booking Selector string in the settings: parent=/sokaktivatorer/, template=searchactivator, sort=name I don´t know what the "owner" does though? If i remove it then it will break? /Thanks
  12. I have a couple of pages that has a specific template. In the template i have a page reference field (Activator). What im trying to achive is when i select an option in the dropdown (Activator) in admin and save, then the specific option is disabled (greyed out) in all of the other pages that has the page reference field (Activator). So basically you can only select one specific option once. But when i unselect the same one i want it to be reset and can be selected again in other pages. Please help!
  13. You can only have Jpg images so try and change and see if it works.
  • Create New...