Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. You can do this: $page->contact = preg_replace('/(\S+@\S+\.\S+)/i', "<a href='mailto:$1'>$1</a>", $page->contact);
  2. Much more clever, both of you I didn't think of getting the parent name and started exploding everything... That's the problem of doing only small sites... pf Who is who?
  3. I think it's a good idea, but somehow it's a bit confusing... try this: /** * When an item is open, this style ensures that the PageListActions become visible * */ .PageListItem:hover > ul.PageListActions{ display: inline !important; opacity: 0.4; } .PageList .PageListItemOpen > ul.PageListActions, .PageListSelectHeader .PageListActions { display: inline !important; opacity: 1; }
  4. Not that clean, but here is your page $seg = explode("/",$repeater->url); $myPage = $pages->get(substr($seg[count($seg)-3],-4));
  5. Antii, you have the page id on the URL of the repeater /pw/processwire/repeaters/for-field-98/for-page-1001/1352371370-8354-1/
  6. I can add to your list portfolio site (something like http://www.secretarycms.com/)
  7. I'm also scratching my head to understand the purpose of this. If all you want is to create an empty array of the same type, you can do this: $new = $page->image->makeNew();
  8. Replace the content of your classTextile.php by the code from this link https://raw.github.c...lassTextile.php In PW that class is inside /site/modules/TextformatterTextile/
  9. I didn't have any link, but I tried one and it's working as expected. Also email links.
  10. I tested it in a local copy of this website http://www.max-cafe-bar.de/essen/, and everything seems to be working fine. All the menu tables in http://www.max-cafe-bar.de/essen/ and http://www.max-cafe-bar.de/trinken/ are built in textile.
  11. Ryan is right, you build the html list with the name but that information will be exposed to the user before the post submission. Therefore it can be changed, and should be considered user input.
  12. Hi and welcome! First thing would be checking if you have mod_rewrite enabled, but if you didn't get that error during the install, it must be. Second thing would be changing the Apache directive AllowOverride from None to All http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride. The file where you have to do this depends on the operative system.
  13. good morning You can confirm that only the checked students will be deleted by printing the array. print_r($input->post->delete); you have to adapt the code to your situation, I may have misinterpreted something. Looking at the code now, I notice that we are using $pages->get("template=students")->children(); to build the list, but $users->get($s)->delete(); to delete the page. This inconsistency came already from your code. If you want to delete users, you have to build the list by iterating through them, as I interpreted, you can do this foreach($users as $student); but it will include all users, including the superuser and guest. You will have to find some way of leaving out all users that are not students. By having a checkbox on the users template, for instance, and then calling foreach($users->find("is_student=1") as $student);
  14. have a good night sleep and look at my code again tomorrow
  15. First, there is something confusing me on your code. If the variable $students is defined only after submission, how can you use it for building the form? Is it working?? You are also using the variable $student above the place where you defined it. Still, I will try to help from what I understood... For multiple check boxes you can use this form: <input type="checkbox" name="group[]" value="um"> <input type="checkbox" name="group[]" value="dois"> where group will be an array holding the values "um" and "dois" So, using your code: <li> <?php echo $student->name; ?> <input type="checkbox" name="delete[]" value="<?php echo $student->name; ?>"> </li> and after submission: if($input->post->submit) { foreach ($input->post->delete as $s) { $users->get($s)->delete(); echo $s->name . " has been deleted!"; } } Putting it all together and making some improvements: if($input->post->submit) { foreach ($input->post->delete as $s) { if($users->get($s)){ $users->get($s)->delete(); echo $s->name . " has been deleted!"; }else{ echo "Ididn't find" . $s->name; } } } ?> <form action="" method="post"> <ul> <?php foreach ($pages->get("template=students")->children() as $student) { ?> <li> <?php echo $student->name; ?> <input type="checkbox" name="delete[]" value="<?php echo $student->name; ?>"> </li> <?php } ?> <input type="submit" value="Delete selected users" name="submit"> </ul> </form> written on the browser and not tested!
  16. It's certainly possible, you just have to create a page in the root for each of those, and the article as children of them home -articles (template articles) --article 1 (template article) --article 2 (template article) --article 3 (template article) --... -music (template music) --song 1 (template song) --song 2 (template song) --song 3 (template song) --... -video (template videos) --video 1 (template video) --video 2 (template video) --video 3 (template video) --... -... Then, in each template do this, adapting with the relevant info for each one foreach($page->children as $c){ echo $c->title; } for the feeds you can use the RSS Feed Generator module http://modules.proce...les/markup-rss/ and use it like this: create a page for each feed with it's own template, then do for each one $rss = $modules->get("MarkupRSS"); $rss->title = "Articles"; $rss->description = "All the articles"; $items = $pages->find("/articles/")->children; $rss->render($items); Do the same for the others. Read the module instructions for some configuration options.
  17. It's also good to make sure that the input is a number $student_page->subject = $pages->get((int)$subject_id);
  18. That's the way to do it. And in pw you can: foreach($input->post->subject as $subject_id){ $student_page->subject = $pages->get($subject_id); }
  19. You do it as with the other fields, but pass it a page object instead of a string $p->page_field = $pages->get("/new/"); will replace the page tat is already there in a single page field, and add a new page to a multi pages field. In a multi pages field you can also pass a page array: $p->page_field = $pages->find("template=any"); Edit: to remove pages use remove(): $p->page_field->remove($pages->get("/new/")); Ryan, would be nice if this page would be updated with API info
  20. diogo

    Windows 8 (or 7+)

    A little bit of topic, but I wanted to say that I installed the daily build of the newcoming http://elementaryos.org/journal/tags/luna and I'm very impressed
  21. I love the claim in the footer
  22. I thought of updating my bookmark to github but I will keep it like this so I can tell if it happens again
  23. There is something funky happening with the cheatsheet. It's working fine on Soma's Github. Edit: for those that need it, here is the link http://somatonic.github.com/ProcessWireCheatsheet/
  24. 12 days to go, it's time for those that didn't vote to do it. There is a link on the top of this page, but I will make it even easier for you http://www.cmscritic.com/critics-choice-cms-awards/
×
×
  • Create New...