Conditional if thumbnail is selected

Permalink
Hi all,

I am working on a custom pagelist template and have page attributes which sets the size of each pagelist item (3 sizes in all) but I now also need some form of condition if a thmbnail isn't selected at all.

Basically each of the pagelist items shown in the code below need some kind of condition to render a different piece of HTML in the place of the img tags if no thumbnail is selected for that page.

I hope this makes sense... I am cobbling this code together from help within the C5 community so if you are able to help, please respond as if I am an idiot as my PHP skills are weak to say the least.

Thank you in advance for anyone that is able to help out.

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
$rssUrl = $showRss ? $controller->getRssUrl($b) : '';
$th = Loader::helper('text');
$ih = Loader::helper('image');
//Note that $nh (navigation helper) is already loaded for us by the controller (for legacy reasons)
?>
<div class="ccm-page-list">
   <?php  foreach ($pages as $page):
// get the event attribute
      $size = $page->getAttribute('size');
      $postedby = $page->getAttribute('postedby');
      $img = $page->getAttribute('PageThumbnail_One');
      $cclass = $page->getAttribute('bodyclass');
      $thumb = $ih->getThumbnail($img, 64, 50, true);

 
Mnkras replied on at Permalink Reply
Mnkras
you can do a simple if statement on your variables to see if they are set or not,

if(!$img) {
//no image was selected
}
mobius2000 replied on at Permalink Reply
Hi Mnkras,

Thank you for replying so quickly... Using the if statements is what I've seen around here however I'm not sure how this sits in the pagelist... I'm just learning PHP :-)

Any chance you might be able to followup with a little more explanation?

Pretty pretty please? :-)
pvernaglia replied on at Permalink Reply
pvernaglia