-
Content Count
5 -
Joined
-
Last visited
Community Reputation
1 NeutralAbout Seb
-
Rank
Newbie
Profile Information
-
Gender
Male
-
Location
Dresden, Germany
-
Hello Soma, thank you for this useful module. I like it very much and use it in a few projects. I think I found a little bug. Line 65 in FieldtypeColorPicker.module says if($value == "0") $value = "00000"; One 0 is missing, so it outputs #00000 in case of black. Most Browsers ignore that, I think, instead of interpreting it as black. Greetings
-
Hello, I tried to install nico's module Page Delete ( http://modules.processwire.com/modules/process-page-delete/ ) and get the following error: I've no idea what this means. I use the useful module with some other ProcessWire installations on the same server and never had this problem. Can you help me? Thanks in advance
-
Thanks again for your answers. I tried diogo's idea and used if($pages->get("parent=$tour, name=$concert->name, fotos.count>0")->id) as condition. It's really much faster. Time for rendering reduced from average 4.89sec to 1.49sec. Good idea. Thank you. I will also try Soma's approach of caching the number of images via an extra field. Sounds promising, too. Thank you. In this project, I don't want to change the hierarchy because the customer is used to it now and works well with it. But in the near future I have a project, a website for a theater, with more complex dependencies where I will learn to work with page selectors. Currently I am totally satisfied with the solution of simply turning on ProcessWire's caching function. Nevertheless I want to write efficient code, so I drew up this topic. Thank you all for your time.
-
Thanks a lot for your answers. Meanwhile I found out, that the most expensive line is if(count($concert->fotos) > 0)... Without it, the page renders in exeptable time. Is there a more efficient way to find out, if an image field contains at least one image? I tried if($concert->fotos->first()), but there was no noticeable difference. Not using two nested foreach-loops leads to another problem. The list should be interrupted by a headline when a new tour begins. (My fault, I deleted most of the markup for better legibility.) <?php foreach($tours->children as $tour) { ?> <h1><?=$tour->title?></h1> <ul> <?php foreach($tour->children as $concert) { ?> <li><?=$concert->date?>, <?=$concert->title?>, <?=$concert->city?> <?php // Check for content, then show the icon if($concert->text) { echo '<img src="'.$config->urls->templates.'styles/images/icon_text.png" alt="Konzertbericht" />'; } if(count($concert->fotos) > 0) { echo '<img src="'.$config->urls->templates.'styles/images/icon_photos.png" alt="Fotos" />'; } if($concert->podcast) { echo '<img src="'.$config->urls->templates.'styles/images/icon_video.png" alt="Podcast" />'; } ?> </li> <?php } // END foreach($tour->children as $concert) ?> </ul> <?php } // END foreach($tours->children as $tour) ?> Without nested loops I would have to do something like this: $concerts = $pages->find('template=concert, sort=-date'); echo "<h1>$concerts->first()->parent->title</h1><ul>"; $prev = $concerts->first(); foreach($concerts as $concert) { if($concert->parent->title != $prev->parent->title) { echo "</ul><h1>$concert->parent->title</h1><ul>"; } // print concert $prev = $concert; } echo "</ul>"; I think that would make it even worse.
-
Hello ProcessWire community, as this is my first posting, I want to thank Ryan Cramer and the ProcessWire community for developing such a great software. ProcessWire is the first CMS that fits my needs perfectly and it's a pleasure to work with it. (Also thanks to isellsoap for recommending it to me.) So here's my first question: The website of a band has a kind of a diary. The children of "diary" have the template "tour" and the children of "tour" have the template "concert". "concert" has (beside others) a textarea field for the report, an image field for photos and a text field to embed a youtube video. None is required. An overview page should show a list of all concerts. If a field of the concert (report, photos, video) has content, a specific icon shall be shown. Everything works fine so far, but it takes about 5 seconds to render the page with about 250 concerts in the list. Currently I solve this by simply turn on the caching, but I think 5 seconds to list 250 pages is a bit too long. (What if I had to deal with 10000 pages or more?) It runs on a virtual server with at least 1 GHz CPU and 2 Gbyte RAM. Below is my code (a little shortened). Has somebody an idea, which could be the inefficient part? Thank you in advance. <ul> <?php foreach($tours->children as $tour) { foreach($tour->children as $concert) { ?> <li><?=$concert->date?>, <?=$concert->title?>, <?=$concert->city?> <?php // Check for content, then show the icon if($concert->text) { echo '<img src="'.$config->urls->templates.'styles/images/icon_text.png" alt="Konzertbericht" />'; } if(count($concert->fotos) > 0) { echo '<img src="'.$config->urls->templates.'styles/images/icon_photos.png" alt="Fotos" />'; } if($concert->podcast) { echo '<img src="'.$config->urls->templates.'styles/images/icon_video.png" alt="Podcast" />'; } ?> </li> <?php } // END foreach($tour->children as $concert) ?> <?php } // END foreach($tours->children as $tour) ?> </ul>