Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by totoff

  1. You may want to check out if Foundation 5 Profile gives you what you need. It's very comprehensive: https://processwire.com/talk/topic/5293-zurb-foundation-5-profiles/
  2. Hi Kongondo, many thanks for your replies! This code in blog-list.php does the trick: $posts = $pages->find('template=blog-post, limit=10');//or whatever the template of a 'post' is $start = $posts->getStart()+1; $end = $start + count($posts)-1; $total = $posts->getTotal(); if($total) $sidebar = "<h3>" . sprintf(__('Posts %1$d to %2$d of %3$d'), $start, $end, $total) . "</h3>"; However, I'm not yet sure if it will play nice with the pagination this way, but I will test with more dummy content. Do you think it is safe to remove the limit=10 considering site performance? Not sure if this is a misunderstanding. /markup/posts.php is required to render the markup for both, the post list and the single posts itself. You can't remove it from the function. Did you mean /posts.php/. From there it's safe to remove the code and I've already done it in order not to have the counts headline twice Again, many thanks for your support. Much appreciated.
  3. Hi Kongondo, many thanks. However, I am not sure I fully understand your question as renderPosts() with $small=true should already return the counts headline? It does, but I would like to have the counts headline in my sidebar ($sidebar) while the rest (the posts) should remain in the main content area ($content). I tried nearly what you suggest before but got an error - maybe because I didn't set the $posts variable with pages->find. Will give your solution a try.
  4. Hi all, I'm trying to adapt the blog profile to my needs. In my template blog-list.php I have the following: $content = renderPosts("limit=10", true); which populates $content in main.php. renderPosts() I have taken as it is from blog.inc in the blog profile: /** * Given a PageArray of blog entries generate and return the output. * * @param PageArray|Page $posts The entries to generate output for * @param bool $small Set to true if you want summarized versions (default = false) * @return string The generated output * */ function renderPosts($posts, $small = false) { if(!$posts instanceof PageArray) { if($posts instanceof Page) { // single page $post = $posts; $posts = new PageArray(); $posts->add($post); } else if(is_string($posts)) { // selector string $selector = $posts; $posts = wire('pages')->find("template=blog-post, sort=-date, $selector"); } else { throw new WireException('renderPosts requires a PageArray, Page or selector string'); } } foreach($posts as $page) { if(empty($page->summary)) { // summary is blank so we auto-generate a summary from the body $summary = strip_tags(substr($page->body, 0, 450)); $page->summary = substr($summary, 0, strrpos($summary, ' ')); } // set a couple new fields that our output will use $page->set('authorName', $page->createdUser->get('title|name')); $page->set('authorURL', wire('config')->urls->root . 'authors/' . $page->createdUser->name . '/'); } $t = new TemplateFile(wire('config')->paths->templates . '/markup/posts.php'); $t->set('posts', $posts); $t->set('small', $small); $out = $t->render(); // if there are more posts than the specified limit, then output pagination if($posts->getLimit() < $posts->getTotal()) $out .= $posts->renderPager(); return $out; } As you can see, the function makes use of /markup/posts.php. Within posts.php I have the following: // display a headline indicating quantities $start = $posts->getStart()+1; $end = $start + count($posts)-1; $total = $posts->getTotal(); if($total) echo "<h3>" . sprintf(__('Posts %1$d to %2$d of %3$d'), $start, $end, $total) . "</h3>"; This echoes the quantities headline as expected to $content but I would like to have it echoed to my $sidebar variable instead which currently doesn't work as it is part of renderPosts(). My question: What would be the best strategy/solution to assign $total to my $sidebar variable instead to $content? Thanks
  5. totoff

    Joomla! is the best!

    Not every personal thinking must go public.
  6. totoff

    Joomla! is the best!

    Started to move my PW site to Joomla ...
  7. Yes, but nobody would listen anymore. Sorry for going off topic. EDIT: Had a look a the document. From my impression it's to ambitious to serve as a guideline. It requires much attention to figure out what I (the graphics person) should do/not do. I would suggest to bring it down to some simple rules and point to tutorial websites in case further explanation is required.
  8. What is the reason behind having three different domain names? I thought it might have to do with SEO? That's why I opted for this. This one Wouldn't make much sense if SEO matters. Agree. Not sure. How about Multisite Module? https://processwire.com/talk/topic/1025-multisite/
  9. french-name.ch/fr/french-page --> language change --> german-name.ch/de/german-page or italian-name.ch/it/italian-page is what I would suggest.
  10. +1 Or - alternatively - it could open on mouse-over. +1
  11. I recommend a hosting company or I just go with what they have (if it is sufficient of course) and then I help them to set it up (better: set it up for them). But - and that's the difference that matters - I'm not the hosting company. I'm just a person offering a service to them, but I'm not responsible for say a secure server or whatever. That's the hosting company's responsibility.
  12. Hi Nico, my workflow looks very much the same with two major differences: whenever possible I work according to the principle "content first". That is, I'm trying to have the - written - content ready before I start making the site. Thus I have a better idea of what design is needed and how the site needs to be organised. I never ever offer hosting. The legal situation in Germany means so much risks for a hosting service that I decided not offer it. Just inform yourself how many "Datenschutz" rules you have to consider if - for example - you have access to your clients emails (which you definitely have if you host their site). I would say: It's not worth doing it. Hope that helps
  13. Hi Horst, the content of contact.inc is (was) plain HTML. I see what you mean. Will give this a try.
  14. Hi all, sorry, I know, this is really a beginner question, but I'm trying to wrap my head a bit more around the "Delayed output" concept as explained here. So I have a placeholder variable $sidebar in my main template file and would like to assign an include file I already have to it (contact.inc) and render it. I managed to do so with ob_start(); require_once('./contact.inc'); $sidebar = ob_get_clean(); which works fine. But I'm sure there must be an easier way via the API but can't find out. Thanks for pointing me in the right direction. Still learning (after all this years ...)
  15. @netcarver: thank you so much for this comprehensive tutorial. Really appreciate. @Martijn: I did already.
  16. Wow, works! Thank you so much! As I'm not a PHP pro but would like to learn more: The if() still relates to $page->sidebar (true/not true) while the strlen counts the string and trim removes whitespace. Is that right? Thanks for your help again.
  17. Len: 0 :-( Edit: I tried this without(!) the trim function. Wasn't that right?
  18. <div class="sidebarItem"><pre>Len: 1</pre></div> EDIT: So, that means, there is a string in it, does it? Weird.
  19. That doesn't work for me unfortunately. There ain't no whitespace in my code. :-(
  20. Tested on 2.5. Same as before. @adrian Case 1: if($page->sidebar != '') Same as before. Case 2: echo '"'.$page->sidebar.'"'; outputs the double quotes and nothing else if field is empty. Should I file a bug? What do you think?
  21. Hi and thank you SiNNut, I have tracked this down: It is definitely caused by the markdown text formatter. Made a textarea field "debug" and tried it once with and once without markdown enabled. Worked as it should without but not with markdown enabled. The installation in question is 2.4. I'm going to double-check with a 2.5 and if it is the same will file a bug.
  22. Hi all, I have a field "sidebar" which is a simple textarea with Markdown Extra and Image Tags applied. If I perform the usual check for an empty field <?php if($page->sidebar): ?> <div class="sidebarItem"><?php echo "$page->sidebar"; ?></div> <?php endif; ?> It echoes div.sidebarItem even if the sidebar field has no content. Any thoughts? Thanks.
  23. Apologies, Joss, I'm sure the posts were meant as questions not complaints.
  24. @Phillipp the WIFI/Bluetooth thing is scaring. Will wait with the update. Thanks for reporting.
  • Create New...