Jump to content

VeiJari

Members
  • Content Count

    30
  • Joined

  • Last visited

Community Reputation

12 Good

2 Followers

About VeiJari

  • Rank
    Jr. Member

Recent Profile Visitors

191 profile views
  1. require './vendor/autoload.php'; this did the trick, when I desperately changed the folder name. Thanks for you help!
  2. @MoritzLost Thanks for the tutorial! I just have a major problem and I don't have a clue why this happens. in site/config.php when i try to require the path to my autoload.php: require '../../libraries/vendor/autoload.php'; autoload is located at: websitex/libraries/vendor/autoload.php Everything is white, every single page. I assume I'm getting some error on this instance, but I can't check it anywhere. When I comment it out, everything works (except the library I'm trying to use in the first place) What should I do?
  3. @David Karich Very useful module, works like a charm! I was just wondering if there could be a way to call the resetPageViews from a template file? I would find it more valuable if there's an option to reset templates' page hit counter from the template itself. That way, we don't have to give access to the module settings for the average user to reset page hits. I've tried to use it, but it seems that the module itself doesn't have a clue about the modules' methods. If this is something that Processwire doesn't process, someone could point out that for me :D Thank you!
  4. Hello forum. I'm trying to figure out how to detect if current form has errors after saving it in pw admin page. This is so that our event location isn't added in database if we detect errors. But I can't seem to find a correct way to detect errors? I only found the wire()->errors() and it always triggers even if I don't have any errors. How can I detect errors in a form? By error I mean $page->error('this is the red error');
  5. Ah thank you for this. It was a bit weird for having to reinit it 😄
  6. Hello forum! Our customer wants to choose only 15 minute intervals in the inputfield Datetime. So the dropdown values would be: 0, 15, 30 and 45. Is there an easy way to achieve this? Any help is appreciated 🙂
  7. Ah, silly me 😄 Of course I didn't think the obvious. It now works and I'm using this module: https://modules.processwire.com/modules/page-rename-options/ for all the pages at the moment! Thanks anyway! Ah I see! Good to know, might be handy someday for preventing those pesty infinite loops 😄 Thanks horst
  8. Hello forum! I've yet again stumbled on a head-scratching situation. We have enabled the option on our articles template and events template that it skips the title adding part and goes straight to the form. This is what our customer wants. So when you add a new article or event it automatically names it temporary to "article-0000000" and same with event. Now the problem is that obviously after saving the form we want to change to page url or "name" to the title, like it's normally. Now here's the code for the hook: wire()->addHookBefore("Pages::saved(template=tapahtuma|artikkeli)", function($hook) { $page = $hook->arguments(0); $newUrl = wire()->sanitizer->pageName($page->title); // give it a name used in the url for the page wire()->log->message($page->name); $page->setAndSave('name', $newUrl); }); I get the correct page and the name and path changes when I log them, but when I try to save it. It just loads and then I get: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) This happens in sanitizer.php and then another error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 What is happening? Am I not suppose to use sanitizer in this way? When we made a temporary page object in out other hook, the sanitizer worked perfectly. Thanks for the help!
  9. Ah, that explains it. Thank you for clarifying it! Now it works 🙂 This was also the problem, didn't know there was such a file! Thank you.
  10. @Zeka In template settings advanced "Tila" means status so I'm referring to this "temp unpublished" status.
  11. Hello, our customer doesn't like the fact that they have to first add a title and then add the other info in the form. Therefore, we've enabled the way to skip this by making a temporary file before saving. But the problem is that by using module schedulepages in this piece of code in the module: if (!$page->isNew() && $page->publishable() && $page->isChanged('status') && $page->is(Page::statusUnpublished) && $page->publish_from) { $this->session->error($this->_("“Publish From Date” field was cleared to prevent the page from being unintentionally re-published on the next Lazy Cron run.")); $page->publish_from = null; $page->save('publish_from'); } it fires even with the temporary file and therefore after first save it resets the publish_from field. Is there a way to check if template is temporary, or something along those lines? One solution is just to ask the customer to first save the form after adding a title, but I don't see that as a good solution.
  12. Yes I've enabled debug mode and my other hooks are starting with $wire->addHookAfter...
  13. And for a site note I'm using schedulepages module, which uses lazyCron at it works perfectly.
  14. Hello forum! I'm trying to learn how to time up my functions by using lazycron but I can't get it fired up. Here's my code in site/init.php: function setEventToRepeat(HookEvent $e) { $wire->log->message("kutsutaan cron"); $events = $wire->pages->find('template=tapahtuma'); die(var_dump($events)); $wire->log->message('Kaikki tapahtumat haettu:' .$events); } $wire->addHook('LazyCron::every30Seconds', null, 'setEventToRepeat'); I get nothing in the logs and can't echo or dump anything Thanks for the help!
×
×
  • Create New...