Jump to content

melissa_boyle

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by melissa_boyle

  1. Thank you so much for your help Diogo, this makes sense but doesn't seem to work consistently I have included the full code below perhaps its the way I have formatted it? <?php foreach ($results as $child) { //$image = $child->images->first->size(150, 100); foreach($child->blog_image as $image) { $large = $image; } if ($child->seasonal==1) { //why does this not work? $pagination = $results->renderPager(); echo "<div class='post-content span12'>"; echo "<div class='image span6'><a title='Read full story' href='post.php'>"; echo "<img title='Image' alt='Image' src='$large->url' /></a></div>"; echo "<div class='span6'><h2>$child->post_title</h2>"; echo "<div class='post-details'><span>Published $child->post_date ·<a title='seasonal' href='$child->url'>Seasonal"; echo "</a></span>"; echo "<p>$child->blog_excerpt</p>"; echo "<a href='{$child->url}' title='Read Full Story' class='blue-btn'>Read Full Story</a> </div> </div> </div>"; } } if (!$child->seasonal) { echo "<div class='post-content span12'> <h2 class='error'>There are no posts in this section</h2> </div> "; } ?> Thank you again for your help, Melissa
  2. Hi guys, I have a page which lists excerpts of content based on their category, this is chosen within the template by checkbox. I have all the content filtering through no problem but need to know how to display a simple "there are no posts available" if the checkbox has not been selected. I have tried the following but it doesn't seem to work . if (count($child->Travel_escapes)<1) { echo "<div class='post-content span12'> <h2 class='error'>There are no posts in this section</h2> </div> "; } Any help would be greatly appreciated, Melissa
  3. Hi Adrian, I have seen this however when the blog posts archive into the folders the archive code I have used above can't seem to find them obviously because they are within folders within /blog. I am unsure of how to implement this to allow it to work. I have tried finding the blogposts by template but this doesn't seem to work. Thanks, Melissa
  4. Hi Guys, I have used the below code to create an archive on blog stories. This works fine with all stories in the child directory to blog, however when I put them in the relevant folders eg 2014 > 01 > blogstory it doesn't seem to pull them through. Does anyone have any ideas, any help would be greatly appreciated. Thanks, Melissa <?php $channel = $pages->get("/blog/"); $startYear = date("Y"); // this year $endYear = 2009; // or whenever you want it to end $now = time(); for($year = $startYear; $year >= $endYear; $year--) { for($month = 12; $month > 0; $month--) { $startTime = strtotime("$year-$month-01"); // 2011-12-01 example if($startTime > $now) continue; // don't bother with future dates if($month == 12) $endTime = strtotime(($year+1) . "-01-01"); else $endTime = strtotime("$year-" . ($month+1) . "-01"); $entries = $channel->children("blog_date>=$startTime, blog_date<$endTime"); // or substitute your own date field $date = date("F, Y",$startTime); $url = "/blog/" . date("Y",$startTime) . "/" . date("m",$startTime); $count = count($entries); if($count > 0) echo "<a href='$url'>$date (" . $count . ")</a><br>"; // output the month and count } } ?>
  5. Hey Craig, Thank you so much for your time and help- this code totally makes sense although it doesn't seem to work for me. I have installed the date archiver which groups the posts accordingly, on viewing the 2014 page it shows the month_year template, this is where I have used the code you suggested. I have shown the structure of the posts below and have also pasted the month_year template code. I am sure I am doing something silly Blog2 20132 111 Aliquam tristique lobortis sem 081 20141 <?php include("./impact_head.inc"); include("./impact_inside_head.inc"); ?> <div class="feature-box"> <div class="feature-box__item grid__item one-whole palm-one-whole flush"> <hr class="feature-box__divider"> <h4 class="feature-box__title">Blog</h4> <div class="article-list"> <?php // Get year and month from URL $year = $input->urlSegment(1); $month = $input->urlSegment(2); if ($year && $month) { // Both year and month $startTime = strtotime(date("$year-$month-01")); $endTime = strtotime(date("$year-$month-31")); // Your /blog/ page $channel = wire('pages')->get('/blog/'); $entries = $channel->find("date>=$startTime, date<=$endTime"); // or substitute your own date field $count = count($entries); if($count > 0) { echo "<p><ul>"; foreach ($entries as $entry) { echo "<li>"; echo "<a href='$entry->url'>$entry->title</a>"; echo "<p>lol $entry->summary</p>"; echo "</li>"; } echo "</ul></p>"; } else { echo "<h4>No posts found.</h4>"; } } ?> </div> <div class='right_archive'> <h4 class="article-list__title--blog">Archive</h4> </div> </div> </div> <?php include("./impact_foot.inc"); include("./impact_inside_foot.inc"); ?> Again thank you so much for your help! Mel
  6. Hi Guys, I have made use of this code and it works fab, however im unsure of how to list the entries for each month/year. I am still pretty new to PW, any help would be greatly appreciated. Thanks, Melissa
  7. Hi guys, I have created a basic blog archive using some code from this article which works fine on showing the amount of posts for each month and year: http://processwire.c...blogs-sections/ On clicking on the urls they bring me to a page blog/year/month however shows all blog items as opposed to just those in that year. Does anyone have any ideas? My code can be seen below which posts the month and amount of articles, I need to call the excerpts for each page. The code can be seen below: <?php $channel = $pages->get("/blog/"); $startYear = date("Y"); // this year $endYear = 2009; // or whenever you want it to end $now = time(); for($year = $startYear; $year >= $endYear; $year--) { for($month = 12; $month > 0; $month--) { $startTime = strtotime("$year-$month-01"); // 2011-12-01 example if($startTime > $now) continue; // don't bother with future dates if($month == 12) $endTime = strtotime(($year+1) . "-01-01"); else $endTime = strtotime("$year-" . ($month+1) . "-01"); $entries = $channel->children("created>=$startTime, created<$endTime"); // or substitute your own date field $date = date("F, Y",$startTime); $url = "/blog/" . date("Y",$startTime) . "/" . date("m",$startTime); $count = count($entries); if($count > 0) echo "<p><a class='article-list__link' href='$url'>$date <b>(" . $count . ")</b></a></p>"; // output the month and count } } ?> Any help would be greatly appreciated, Mel
  8. Hi guys, I have created a basic blog archive using some code from this article which works fine on showing the amount of posts for each month and year: http://processwire.com/talk/topic/263-creating-archives-for-newsblogs-sections/ On clicking on the urls they bring me to a page blog/year/month however shows all blog items as opposed to just those in that year. Does anyone have any ideas? My code can be seen below which posts the month and amount of articles, I need to call the excerpts for each page. The code can be seen below: <?php $channel = $pages->get("/blog/"); $startYear = date("Y"); // this year $endYear = 2009; // or whenever you want it to end $now = time(); for($year = $startYear; $year >= $endYear; $year--) { for($month = 12; $month > 0; $month--) { $startTime = strtotime("$year-$month-01"); // 2011-12-01 example if($startTime > $now) continue; // don't bother with future dates if($month == 12) $endTime = strtotime(($year+1) . "-01-01"); else $endTime = strtotime("$year-" . ($month+1) . "-01"); $entries = $channel->children("created>=$startTime, created<$endTime"); // or substitute your own date field $date = date("F, Y",$startTime); $url = "/blog/" . date("Y",$startTime) . "/" . date("m",$startTime); $count = count($entries); if($count > 0) echo "<p><a class='article-list__link' href='$url'>$date <b>(" . $count . ")</b></a></p>"; // output the month and count } } ?> Any help would be greatly appreciated, Mel
  9. Guys just a quickie, Now that I have got the content across from another template I want it to only show the repeater field if an image is uploaded into a field with the repeater field named basket_icon. For example: it is a brand that stocks 2 products. I want to pull the stores that sell the products from the stockist page to the individual product pages. e.g. if product icon is uploaded into the basket_icon field then pull the store info to the basket page. This is what I have so far but it doesn't work: <?php foreach ($pages->find("template=stockist") as $stockist) { foreach ($stockist->store_left as $store) { if ($store->basket_icon) { echo "<h5>$store->store_name</h5>"; echo "<p class='less_padd'>$store->store_address</p>"; } } } ?> Thanks, Melissa
  10. I guess I didn't explain that very well, I do have more than one page using the stockist template and the second option worked a dream Pete! Thanks a bunch! Mel
  11. Awww right, silly me. Basically I need to find the template which is stockist with the stores_left repeater field but this doesn't seem to work for me. Do you have any idea? Thanks, Mel <?php $results = $pages->find("template=stockist"); foreach($result->store_middle as $storesmiddle) { echo "<h5>{$storesmiddle->store_name}</h5>"; echo "<p class='less_padd'{$storesmiddle->store_address}</p>"; }
  12. Hi Guys, Basically I want to find a repeater field from the template "stockist" however I am finding this difficult to do so, I read this article on calling reapter fields as a template, can anyone help me on this, my code is as follows; http://processwire.com/talk/topic/5029-search-specific-repeater-item-and-edit/ <?php $results = $pages->find("template=repeater_store_left"); echo "<h5>{$results->store_name}</h5>"; echo "<p class='less_padd'{$results->store_address}</p>"; ?> </div> Thanks Melissa
  13. Hi Guys, I am pretty new to process wire so apologises if this is a silly question. Basically I have created a blog where it shows the excerpts of each blog post so to speak, my issue is that I cannot arrange these by date (most recent being at the top) using the blog_date field. I have read through similar questions however cannot implement my code to work. Any help would be greatly appreciated, Melissa <?php foreach ($results as $child) { echo "<div class='article'><div class='row'><div class='col'><h3>"; echo "$child->blog_title </h3> </div></div>"; echo "<div class='row'><div class='col twocol blog_meta'>$child->blog_date</div>"; echo "<div class='col eightcol post'><p>$child->blog_excerpt</p>"; echo "<a href='$child->url' class='read_more'>>> Continue Reading</a>"; echo "</div></div></div>"; } ?>
  14. Hi Adrian, This works a treat! Thanks a bunch for your help! Melissa
  15. Hi Guys, I am pretty new to process wire and am experimenting with repeater fields. The issue is that the image cannot be found via the URL but im not sure why? Im sure this is something silly however I cannot see the problem. The image is uploading fine via the content management system however when viewing on screen it comes as though the image cannot be found. All help would be greatly appreciated. Thanks, Melissa <?php foreach($page->about_timeline_left as $about) { $image_left = $about->left_images; echo "<div class='ss-row'> <div class='ss-left'> <img src='{$image_left->url}' alt='{$image_left->description}'><a class='ss-circle ss-circle-1 ss-circle-deco'></a></div> <div class='ss-right'> {$about->right_description} </div> </div>"; } ?>
  16. Hi Guys, Im pretty new to process wire and wondering if anyone can lead me in the right direction. Basically I have an existing website that I want to content manage, the blog seems best suited however I am struggling to implement the system. I can fit my own content into the example blog and it styles and brings back blog posts but it doesn't function how I need it to e.g. show an excerpt then when 'read more' is selected it will bring the user to the full article with a different page style. This may become clearer if you view the site: www.yourmoneymate.co.uk. I have had a brief look at the markup folder and tried to implement the site to contain these tags however it is returning 'No Posts Found' I am sure this is pretty straightforward to do I just can't seem to get it. Any guidance would be greatly appreciated. Many thanks, Melissa
×
×
  • Create New...