Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. I think this could be a good topic for a future tutorial. How to setup and build a pw search in a reasonable way. I do also just search all the textual fields.
  2. If you use a deligated templating approach you could provide $test to all templates by including it into the _init.php. If not, what's preventing you pasting the variable and the pagefind in the templates which need to know the pagearray, to use it? If you really need to pass it dynamically around, save it to a session variable and read it from there.
  3. I just figured it out. I read in another thread (can't remember which), that roles do have subfields like roles.name. Using these did not work, but I found that ProcessLister used the id's in it's selectors instead of the names. So just look for the id of your role and use "roles=ID" in the dependency field.
  4. , if it has chars in it! An empty string equals false.
  5. @bwakad Essentially, if you work with pages, there are two options. Either you expect one page or a failure or secondly one or more pages or failure. $single_page = $pages->get("something"); if($single_page->id) echo "Page found"; $multiple = $pages->find("something"); if(count($multiple)) echo "at least one page found"; The first check works, because get() returns a NullPage on failure, which has an id of 0. The second one counts the found PageArray elements. If there are none it's also 0. The difficulty is not to confuse those (as I did), as NullPage is something completely different as a PageArray / WireArray.
  6. Damned confused myself. "get()" was the one which either returns a NullPage or null, depending on where you call it, not "find()".
  7. var_dump($pages->find("template=notAvailable")->id); // output: NULL So yeah, it's not 0 but NULL.
  8. PageFields can accept more than one page. Maybe just create one and have a look at the settings.
  9. Just for the record, if you've looked into the cheatsheet. NullPage != null
  10. Have a look here: https://processwire.com/talk/topic/7588-admin-custom-files/
  11. I'm used to build the forms of my pages to fit well in the default theme. This way it should also fit well on my clients screens. Actually the max-width issue is easily fixable with Martijn's new AdminCustomFiles module. Adding the jquery to get the sidebar fixed is little bit more difficult as mediocre jquery user and with the custom file being loaded before the themes main.js.
  12. Have a look at these modules. http://modules.processwire.com/modules/link-shortener/ http://modules.processwire.com/modules/process-field-generator/ http://modules.processwire.com/modules/process-custom-upload-names/
  13. The first thing I remove for all my CKEditor fields are the "PasteFrom…" fields, so no client can be tempted. The best is still plain text.
  14. http:// and https:// does matter, so you should use the canonical link. Also google does reward you for switching to https:// as default. source:
  15. I can't remember exactly but my search wasn't that much different, but after 5 results it wasn't even processwire related anymore. But yeah, next time I try harder
  16. Yeah need to search with forum search and google, not only one of these. This time google failed.
  17. I can't really help you with your error, but maybe use this to exclude all the admin stuff. has_parent!=2 Also you could use just a template to get all fields, without an extra page. $search_here = $templates->get("name"); foreach($search_here->fields as $field){ … }
  18. Hi, I've just noticed some pages missing on my current project, if I switched to the second language. The issue was, that pages, which where created by the api wheren't actived (pagename) for this second language. How do I automatically set this activation?
  19. It's a nice and clean theme, but I would like it to have a max-width on the content area. It's just to big on an 27" monitor. Something around 1400px should be wide enough. Edit: Maybe crop the userimage, before fitting it into an circle. It's getting distorted for me. Edit 2: @Reno If my width issue gets changed, it would also be nice, to lock one of the "lightning" sidebars, if there's enough space.
  20. Thanks. I ended up using another nl2p function, which does also retain linebreaks, but it's nealy the same. function nl2p($text){ $text = htmlentities(strip_tags($text), ENT_QUOTES, 'UTF-8'); $text = '<p>' . $text . '</p>'; $text = str_replace("\r\n\r\n", "</p><p>", $text); $text = str_replace("\n\n", "</p><p>", $text); $text = str_replace("\r\n", "<br />", $text); $text = str_replace("\n", "<br />", $text); return $text; }
  21. Ok, should've looks earlier in the modules directory. There's already a textformatter for nl to br / p replacement. But I think I'll go with the solution to store the markup.
  22. Textile is quite interesting, but the inputs are just texts without further formatting, so I think that overkill.
  23. Welcome to the forums. I really like the design of the site and especially the image loading effect is gorgeous.
  24. Hi, I'm building a small and simple social area in my current project. By now I think I let users only input raw text and then use nl2br and maybe some nl2p function to add simple markup, which gets saved. If this texts gets editied the markup has to be converted back to \n's. Now I wonder how much work it woul be to store only the raw text and use a textformatter to add the markup. Also does somebody have a reliable nl2p function lying around? The ones I found didn't really consider the "\n", "\r\n" differences.
  25. <ul class='left'> <?php $menu_page = $pages->get(1001); if( $page->parent == $menu_page ) echo "<li class='highlight has-dropdown'>"; else echo "<li class='has-dropdown'>"; echo "<a href='$menu_page->url'>$menu_page->title</a>"; ?> <ul class='dropdown'> <?php foreach($menu_page->children as $child ){ echo "<li><a href='$child->url'>$child->title</a></li>"; } ?> <ul> </li> </ul>
×
×
  • Create New...