encho
Members-
Posts
81 -
Joined
-
Last visited
-
Days Won
1
Everything posted by encho
-
Thank you so much, the code above works perfectly, the only part to change was <img src='{$thumb->url}' alt='{$image->description}' /> as I wanted to see thumbs. I just assumed if there's only one image it wouldn't consider the field as an array, your explanation makes much more sense. Thanks again.
-
I am trying to use repeater containing 3 fields, but not really sure how to handle extended information, like image resizing, description, etc. I have repeater field called 'repeater' with 3 fields: info, file, images. This is my code: foreach($page->repeater as $field) { //$image = $field->images; //$thumb = $image->size(286, 217); echo "<ul>"; echo "<li><img src='{$field->images->url}' alt='{$field->images->description}' /></li>"; echo "<li>{$field->file}</li>"; echo "<li>{$field->info}</li>"; echo "<li>{$field->images->description}</li>"; echo "</ul>"; } In above example $field->info, $field->images, $field->file, all produce results, but not sure how to: 1. handle image size (you can see code commented out, tried playing with different variants), 2. get image/file url ($field->images->url doesn't work), 3. same as (2) but file/image description. I really like the repeater concept, but need to figure out how it actually displays the output. Thanks for all suggestions.
-
I found this site by accident, and now I'm so happy that I did. Simplicity of PW really makes my life easier. Some other more popular CMS solutions have big forums with loads of members, but quantity != quality. I just started using this and already have two pages of helpful posts! Kudos to the 'fanatical support'
-
And that does it. When I look at it now it seems obvious. I have more things to learn, but definitely worth it. The speed of this CMS is simply amazing, well done everyone!
-
It is my code from above wrapped into your code you suggested few posts above $results = $page->children("limit=25"); if($page->path != '/' && $page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li>"; if (count($child->images)) { echo "<div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(100, 100)->url}' alt='' /></div>"; } echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>"; if ($child->summary){ echo preg_replace('/\s+?(\S+)?$/', '', substr($child->summary, 0, 251))."…"; } else echo strip_tags(preg_replace('/\s+?(\S+)?$/', '', substr($child->body, 0, 251)))."…"; echo "</span></div></li>"; } echo "</ul>"; } echo $results->renderPager();
-
Tested this and in 'normal' form it works, ie <?php $results = $pages->find("id>1, limit=10, sort=title"); echo $results->render(); But in my example above doesn't. Although it displays the pager, when I set the limit to 25 it displays 4 pages, with limit 10 displays 10 pages. Meaning it picks up the total number of items, but does not separate them in pages, displaying all of the 100 items regardles of the page you click. What is wrong with the code?
-
So my final code looks like this: if($page->path != '/' && $page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { echo "<li>"; if (count($child->images)) { echo "<div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(100, 100)->url}' alt='' /></div>"; } echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>"; if ($child->summary){ echo preg_replace('/\s+?(\S+)?$/', '', substr($child->summary, 0, 251))."…"; } else echo strip_tags(preg_replace('/\s+?(\S+)?$/', '', substr($child->body, 0, 251)))."…"; echo "</span></div></li>"; } echo "</ul>"; } Very nice list limited to 250 characters per item (but not relevant to my question ). How to paginate the output, as I have more than 100 items per list? Pagination module takes variable and splits it into pages, but how to define one here as I was using 'foreach'? Thanks!
-
So simple! I am used to overcomplicate things thanks to my experiences with other CMS's. Thanks.
-
That was great tutorial. I am using modified version of the comments as a guestbook page. Now as I have 300+ entries I would love to see pagination. Or does anyone know nice jQuery plugin which loads paragraphs on demand (infinite scrolling), like JAIL does for images (although not sure it is only for images)? I would appreciate if someone with more insight might give me a pointer.
-
Sorry I was not clear enough. From the above suggestions, my final code placed below bodycopy looks like this: foreach($page->children as $child) { echo "<li><div style='float:right;'><img style='margin:5px 0 5px 5px;' src='{$child->images->first()->size(232, 176)->url}' alt='' /></div>"; echo "<div><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></div></li>"; } So in case child has an image as part of the page, there is no problem. But if it doesn't exist, the above code will produce an error. I would like to set the condition which will ignore the first 'echo' line if the image is not present.
-
Thanks! One more question (now I am being too pushy), in the example above how to formulate the code so it won't run if the image in the subpage doesn't exist, as it is producing an error for subpages without an image attached. echo "<img src='{$child->images->first()->size(232, 176)->url}' alt='' />";
-
Thanks, it is obvious now Decision has been made, I will do my new magazine website with ProcessWire, great response from the community made my decision easier. Two things left to try: how to handle tags/categories (is autocomplete available as an option anywhere), and how to handle PDF downloads (just as file attachments to posts, with possible access control). Anyone had any experience in transferring large Drupal site?
-
Thanks, feel really overwhelmed now. In default template there is a nice list of children pages underneath the body text. foreach($page->children as $child) { echo "<li><p><a href='{$child->url}'>{$child->title}</a><br /><span class='summary'>{$child->summary}</span></p>"</li>; ... } I want to include resized children images as well, but no luck. Including: echo "<img src='{$child->images->url}{$child->images}' alt='' />"; Upper code works, but displays full resolution images. Any attempt to do resized images fails, where am I wrong? echo "<img src='{$child->images->url}{$child->images->size(232, 176)}' alt='' />";
-
Wow, thanks a lot guys. Getting to know this cms/fw and it is far more advanced than I thought it would be. Going to spend some time getting to know it, it really seems it is worth the efforts. But I would need help/pointer where to start exactly, there doesn't seem to be any user manual or quick start guide, does it?
-
Thanks for your reply. By custom programming, would you mean using the existing stuff, or building a new module?
-
Completely new to this cms, would like to know would you recommend PW for online magazine style website? Main features would be that texts (articles) would have short and long version where long version would be available for subscribers only. So basically if you are subscribed, you would see full version of the article. Also needs to feature PDF downloads (subscribers only), etc. Articles should be sorted by issue no, but also categorised and tagged. Would this CMS be sufficient or should I look elsewhere? Thanks for all the comments.