Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. But you know you don't need to do this symlinking? You can just put the wire folder in the root where site folders are?
  2. It's not about winning here Congrats Adrian anyway.
  3. It's also easy to create a hook that creates folder automaticLy and put post there or move it if date changes.
  4. It should work fine in 2.5. Just haven't come to test So haven't marked as 2.5 in directory. If you try and it works let me know. I think some update for various admin pages shortcuts needs to get revised but other than that it should be fine.
  5. RT @processwire: New blog post: ProcessWire 2.5.16– Blank versus zero, Configurable URL segments in template settings and more… https://t.c…

  6. Just wondering what's the use case here? Don't you have a form? Or you can validate while setting the values anyway.
  7. You're right that it requires a form to run processInput(), creating and saving a page via API doesn't validate anything Like this, but won't work with file fields. $p = new Page(); $p->template = "basic-page"; $p->parent = 1; // $p->save(); $in = new WireInputData(); $in->setArray(array("title" => "")); $form = $modules->InputfieldForm; foreach($p->fields as $field){ $inputfield = $field->getInputfield($p); $form->add($inputfield); } $form->protectCSRF = false; $form->processInput($in); foreach( $form->getErrors() as $err ) { $content .= $err; }
  8. Just name the script and style sheet same as your module then add init () with a parent::init(); and they get loaded.
  9. Turning forty this year I right now enjoy a twenty year old red wine from toscana. What a experience really ä.
  10. Games play a bigger role in our lives than most think. They let us escape from reality much like films do too but are interactive in a broader sense. Gadgets like glass or this holo go in the same direction but are far more driven by making money and trying to get something out we actually don't need. Kapitalismus if you wish. Wow effect. Look at what we can do!.. Exploring and getting new territory in our daily live that's yet free from ads and stuff like that. Perfectly trying to create new opportunities to blend in some thing and manipulate us. Google car is also a wonderful example. Driving a car doesn't let you use a phone or Google. Imagine wearing glasses that can be controlled by third parties track you and your behavior even more. I'm not sure we let this happen as easily as hey think. Joss says it well. We want to make our own experience with real object humans and nature. At some point breaking out of this will become a deep necessity.
  11. I have glasses (real) and hate to wear them.. so there comes some random company telling me I need to wear glasses? All this bs will never work and get accepted unless it's directly in our eye or brain. So wait another 100 years I guess. While this is nothing new they marmarmad it differently as 'Hologram' that really isn't. Maybe there uses in sience or games but doubt it. Not ready for a long time.
  12. Maybe you can figure it out from that screen?
  13. I also have a version of this, just saying
  14. No need for the event->return = $p or anything like that, Adrian
  15. Actually saveReady is an after hook and it's especially useful as you know that the page is saved right after that. So no endless recursion and you don't need to save the page. With a before save hook you don't know if an error will occur. Also no need to set the page back to the argument after you done with manipulating the page. So lots of mis-infos here.. Means the best answer isn't the best really Edit: removed the 'Solved' flag for now.
  16. I see. Yes that's somewhat different to what WireArray does, but you're way is fine then. You can add your own method to PageArray using hook then instead of a new class. wire()->addHook("WireArray::addUnique", null, function($event){ $item = $event->arguments(0); if($item instanceof WireArray){ foreach($item as $p){ if(!$event->object->has($p)) $event->object->add($p); } } else { if(!$event->object->has($item)) $event->object->add($p); } }); $pa = new PageArray(); $pa->add($pages->find("template=basic-page")); $pa->addUnique($pages->get("/about/")->children); $content .= $pa;
  17. $pa = new PageArray(); $pa->add($pages->find("template=basic-page")); // 1001 at the first pos $pa->append($pages->get("/about/")); // 1001 at the last position now (unique) echo $pa;
  18. Doesn't matter if you add a page or a page array to a page array it will always contain only unique pages.
  19. Well, PageArray is already unique. Considering this example, you'll end up with 1 entry in PageArray: $pa = new PageArray(); $pa->add($pages->get("/about/")); $pa->add($pages->get("/about/")); echo $pa;
  20. @ESRCH That login code will throw error if you login 3 times with wrong credentials... I already tried to put a note in those various (dozens already and lost track of) threads that use this "exact" frontend login code, which works but has one flaw. Problem is that once the login throttle kicks in you're left with a exception error. It's not obvious and I think posting that code in the forum over and over just creates problems in the long run for everyone copy paste such code. Funny thing is that the code originally is from Ryan himself. Either Ryan should change the behaviour of the throttle code or you need to use this code instead with a try catch to catch the login throttle error: if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try{ $u = $session->login($username, $password); if ($u) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } } catch(Exception $e){ $error = $e->getMessage(); } }
  21. I think you're looking for repeater or pagetable field https://processwire.com/talk/topic/6417-processwire-profields-table/page-2#entry63119 And for PageTable there's a extended version. https://processwire.com/talk/topic/7459-module-pagetableextended/
  22. I have used this to redirect to language the user was in. if(wire("input")->get->logout == 1){ $lang = wire("user")->language; wire("session")->logout(); wire("session")->redirect(wire("page")->localUrl($lang)); }
  23. Read the notes there: Optional: In your URL, you can include the tag '{id}' (perhaps as a GET variable), and it will be replaced by the requested page's ID number, if you want it. Edit: maybe you can use the id somehow. But maybe a better option would be to have some code in those template to check for if the user is logged in an redirect with API if(!$user->isLoggedin()) $session->redirect($pages->get(1230)->url); // 1230 if of login page and the url will be in the language the user is viewing the site.
  24. You would use the beautifier translate option (Sanitizer::translate) to have sanitizer use the special char conversion $name = $this->sanitizer->pageName($pageName_en, Sanitizer::translate); The chars are defined in the PageName module config screen, where you can set conversion for each char like "ö => oe", default is "ö => o"
×
×
  • Create New...