Help is needed on editing BLOG-INDEX file

Permalink
Hi to all,

I am working on blog integration with a custom design. Everything is in place, except one thing which I can't solve. I have a page list that picks up the latest blog posts. Each post has an image at the bottom, that I want to hide for the last item as well as if page list blog entry count is set to 1.

The source code is below:

<div id="blog-index">
   <?php 
   $isFirst = true; //So first item in list can have a different css class (e.g. no top border)
   $excerptBlocks = ($controller->truncateSummaries ? 1 : null); //1 is the number of blocks to include in the excerpt
   $truncateChars = ($controller->truncateSummaries ? $controller->truncateChars : 0);
   foreach ($cArray as $cobj):
      $title = $cobj->getCollectionName();
      $date = $cobj->getCollectionDatePublic(DATE_APP_GENERIC_MDY_FULL);
      $author = $cobj->getVersionObject()->getVersionAuthorUserName();
      $link = $nh->getLinkToCollection($cobj);
      $firstClass = $isFirst ? 'first-entry' : '';
      $entryController = Loader::controller($cobj);
      if(method_exists($entryController,'getCommentCountString')) {
         $comments = $entryController->getCommentCountString('%s '.t('Comment'), '%s '.t('Comments'));
      }


The image I'm referring to is:
<img class="shadow-separator-30 shadow-separator-30-1" src="<?=$this->getThemePath()?>/images/shadow-full-1050x104-1.png" data-rimage data-src="<?=$this->getThemePath()?>/images/shadow-full-1050x104-1.png">


Does anyone have any suggestions or recommendations?

Thanks in advance!

 
hutman replied on at Permalink Best Answer Reply
hutman
How about this instead:

<div id="blog-index">
   <?php 
   $pageCount = 0;
   $pageTotal = count($cArray);   
   $excerptBlocks = ($controller->truncateSummaries ? 1 : null); //1 is the number of blocks to include in the excerpt
   $truncateChars = ($controller->truncateSummaries ? $controller->truncateChars : 0);
   foreach ($cArray as $cobj):
      $pageCount++;
      $title = $cobj->getCollectionName();
      $date = $cobj->getCollectionDatePublic(DATE_APP_GENERIC_MDY_FULL);
      $author = $cobj->getVersionObject()->getVersionAuthorUserName();
      $link = $nh->getLinkToCollection($cobj);
      $firstClass = $pageCount == 1 ? 'first-entry' : '';
      $entryController = Loader::controller($cobj);
      if(method_exists($entryController,'getCommentCountString')) {
Mellow replied on at Permalink Reply
Wow, I am impressed! Works like a charm :) Thank you very much.

I am learning back end scripting and I find this like a good tutorial. Will analyse the script, so I can improve my PHP skills too :)