Jump to content

diogo

Moderators
  • Posts

    4,296
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. Welcome to the forum luzox! What is the markup that the dropdown has to have?
  2. echo $pages->get("myrepeater.field2=bar")->myrepeater->get("field2=bar")->field1; we should make a compilation of soma's one-liners to rival with this https://www.youtube.com/watch?v=GeeyWvo1rNg
  3. Agree with all above, but even with the workflow you referred, I don't think PHP is more dangerous than a template engine sintax because in that case, all the PHP will have to be very simple as you will have to implement a trully MVC system, right? If so, because all the complex logic will be out of the "view" files, you will always have very simple and not dangerous PHP code for the designers to work with: <?= $page->title ?> or at the most: <div> <? foreach($page->children as $child): ?> <h3><?=$child->title?></h3> <p><?=$child->body?></p> <? endforeach; ?> </div>
  4. Must be on the template file because the echos are not inside a function edit: actually they are . But still it must be on the template file
  5. Luis makes it sound easier than it is , but if you have the time it's certainly possible. Here are two examples of how to implement "adding friends" and "articles wall" just to give you an idea (written in the browser from my mind and very very very over simplified): //adding a friend $new_friend = $pages->get("template=user, name=$input->post->new_friend"); //assumes that a friends field of page type with all other users was already added to the users template $user->friends = $new_friend; $user->save; //outputing a wall of articles only from the user and his friends //creating a string with all the friends separated by a pipe character (OR) to put in the selector $friends = ""; foreach($user->friends as $f){ $friends .= "|" . $f; } //find the articles from the user ($user) and his friends ($friends) and render them echo "<div id='wall'>"; foreach($pages->find("template=article, created_users_id=$user$friends") as $a){ $a->render(); } echo "</div>"; edit: modified the second example to use the buit in selector "created_users_id".
  6. And for quick reference http://processwire.com/api/cheatsheet/#selectors
  7. Than you should use soma's solution if(!$users->get($username)){ // go ahead, add the guy } edit: but it's good that you learned the array stuff
  8. diogo

    Paradox

    Soma, maybe this could be added in the cheatsheet?
  9. diogo

    Paradox

    numChildren is returning all pages and children->count is returning only the published pages
  10. This should also output the names foreach ($users as $u) { echo $u->name; } And you can put them in an array like this $names = array(); foreach ($users as $u) { $names[] = $u->name; } print_r($names);
  11. diogo

    Code Dreams

    My girlfriend says that I'm becoming a geek, so I won't answer this question...
  12. Thanks for correcting me soma. That was a basic error, I should be more careful. shouldn't we make it obvious and just implement google search alongside the forum search?
  13. Not difficult at all. The way you are doing it, the two dots are pointing one directory up, wish means that the browser is looking for a page that is at the same level then root. If you would do this for example: <a href="/disclaimer">Disclaimer</a> ...it would work on the root, but not on the other pages. To fix it, you have two options. On a non dynamic site, the option would be having an absolute link instead of a relative link: <a href="http://www.yoursite.com/disclaimer">Disclaimer</a> In PW you can do something that will allow you to change the domain of the website without breaking the link: <a href="<?= $pages->get('/disclaimer/')->url ?>">Disclaimer</a> edit: see soma's correction below for a more correct and accurate answer ↴
  14. I think I missed the point of the discussion... I didn't think you were talking about tinyMCE, but the image field module, and that you were planning to add more fields besides the description field. So, what my "Why not let people add fields on the image field options?" meant was that the image field could be expanded to accept the addition of fields on the image field admin, just like a repeater. Does this make sense?
  15. Alan, Ryan wrote this on the Pro Cache introduction post:
  16. oh, i'm also blind... where did that parent come from?
  17. hm, what about this, does it work? $menues = $pages->get("parent=/empfehlungen/februar")->children("template=empfehlung_list");
  18. Manfred, look at my comment above. On Soma's code you have to change date("F") for date("n") edit: delete edit2: just for debbuging, does this work? $curr_month = $month_names[2]; // <- hardcode a number here
  19. Unff gfddrh i gooug fsaw yuu iy, gdsr gfoiu?
  20. Thanks for your efforts Super-Pete
  21. Soma, you have an error in your code. Change: $month = date("F"); // month integer to: $month = date("n"); // month integer
  22. I'm scratching my head trying to understand your code As I understand, you want to get the only month that is published, right? The intention is that the editors would publish one month and and unpublish the previous? If it's this, than I don't think it's the best way to go... But you should explain exactly what kind of effect you are trying to achieve before I start giving solutions just by guessing. because eventually 2014 will come, and you will have two Januars to deal with. You can change the selector to: $page->get('parent=/empfehlungen/ name=$this_month')
  23. Is it that shelf with lots of books that look all the same in my parents house?
  24. This is exactly what I was looking for now , in linux I use the file manager to open the server, and I work with the files in the server exactly like with local files.
×
×
  • Create New...