Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. I'm addicted to Jacco Gardner while designing (yep, not programming that much in the past weeks, and I miss it already) http://grooveshark.com/#!/album/Cabinet+Of+Curiosities+2013/8901053 Just paste the URL
  2. diogo

    Vagrant

    Thanks! I followed the tutorial from their site during the weekend and am very impressed! Very easy to start and to work with
  3. Your head must be a puzzle right now. I have the feeling that you just skipped the basics, and are looking at random things, some even too complicated for starting. I don't want to tell you how you should learn, everyone has it's own way, but I feel that you're taking the longer and less exciting path. Just sayin'
  4. Soma, that's what I'm saying. You never said it
  5. You managed to confuse me with this. 400 in a list is not too much because you can always paginate it, so I had to look for the place where Soma had said that, and what he really says is that 400 in a dropdown is too much. Maybe I'm just being picky, but someone might read this and start avoiding having long list on their sites.
  6. Actually, this works: $pages->find("parent={$pages->get('/location/')->children()}");
  7. Yellowled's answer should go in the homepage of PW's site
  8. I'm the kind that like to do all on my own and the hard way , but I have to say that this is unbeatable! I installed Softaculous' ampps http://www.ampps.com/ on a clean laptop (still coming out of the package, completely not configured for web development), and 10 minutes later was playing with a fresh install of PW.
  9. So, Joss is the latter one . Will you be the former?
  10. i identified the problem with the function. Obviously you can't call a recursive function inside a loop like I was doing there, calling a recursive function is already a loop (duh!), so I replaced the for() by a if() and all is good and much simpler. I also replaced the $template and $limit arguments by a $selector argument (why loose all the flexibility of selectors? duh again!). // function accepts 3 parameters. $parents is mandatory function myFindPages($parents, $depth = 1, $selector = '') { $allParents = $parents; if($depth > 1) { $allParents = $parents . '|' . wire('pages')->find("parent={$parents}"); // add new parents to existing $parents = myFindPages($allParents, $depth - 1); // call the function recursively with all parents } $selector = $selector ? ',' . $selector : ''; return wire('pages')->find("parent={$allParents}{$selector}"); } // parent is home, 2 levels of depth $myParent = wire('pages')->get('/'); echo myFindPages($myParent, 2); // and with selectors echo myFindPages($myParent, 2, 'template=basic-page, limit=20');
  11. I think the best would be to copy the markdown module replace "markdown.php" by the new file
  12. This time I was the one who couldn't refrain from commenting http://qr.ae/vX10p edit: but I see I'm not the only one
  13. Thanks Adrian. Corrected.
  14. I was curious of how to achieve this, so I created this function. Should do what you want: Edit: just realized that this doesn't work. There's is some problem with the loop that I have to solve Edit2: solved this, I posted a new function some posts bellow https://processwire.com/talk/topic/5876-processwire-selector-limit-levels/?p=58391 no need to remove the likes folks I will leave this one here for public shame // function has 4 parameters // the only required is the starting parents, all others are optional and default to the displayed values function myFindPages($parents, $depth = 1, $templates = false, $limit = false) { for($i=$depth; $i > 0; $i--) { // for the number of times specied in $depth $templates = $templates ? ', template=' . $templates : ''; $limit = $limit ? ', limit=' . $limit : ''; $newParents = ($i < $depth) ? $parents . "|" : ''; // don't include the original parent/s in the final array $allParents = $newParents . wire("pages")->find("parent={$parents}{$templates}{$limit}"); $parents = myFindPages($allParents, $depth, $templates, $limit); // call the function recursively with the new parents } return $parents; } // call the function // "parent is home, 2 levels of depths, any template no limit" $myParent = wire('pages')->get('/'); echo myFindPages($myParent, 2); // "parents are all children of about, 4 levels of depths, template 'basic' and limit 100 pages" $myParent = wire('pages')->get('/about/')->children(); echo myFindPages($myParent, 4, 'basic', 100);
  15. is Travel_escapes the checkbox field? If that is the case, your code doesn't work because you are treating it as an array. This should work: if ($child->Travel_escapes < 1) { or even: if (!$child->Travel_escapes) {
  16. Ok, there is $field->textformatters that retrieves an array of all textformatters, you can use it for instance like this: if (in_array('TextformatterTextile', $field->textformatters)) //do something
  17. You can create a new text formater that does only that instead of modifying textile. Than you only have to apply it after textile on the fields where you need it.
  18. You can, but you will be missing a lot...
  19. // Add Antti as **the only** author for all the books written by Stephen King foreach($books as $b) { $b->author->removeAll() $b->author->add($ap); $b->save(); }
  20. See also these posts by Soma https://processwire.com/talk/topic/352-creating-pages-via-api/ https://processwire.com/talk/topic/2089-create-simple-forms-using-api/
  21. Oh... the bot was not well informed sorry bwakad!
  22. http://ngo-hung.com/blog/2014/03/21/so-many-php-frameworks Hm, not the best that can be told about ProcessWire on this post. But being cute is nice, i guess...
  23. This post https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ pretty much sums up how you can relate things in PW. Just change "categories" to any other word you want. It doesn't make sense to think in terms of tables when working in PW because PW gives a much more powerful way of organizing content, the tree. Think JSON and XML instead of tables.
×
×
  • Create New...