Page list Newest items different layout
Permalink
For a news overview page I like to display the latest news different then the rest.
What I'm doing doesn't work for the second part. It just shows the same item over and over depending on how many more pages there are.
What I'm doing doesn't work for the second part. It just shows the same item over and over depending on how many more pages there are.
<ul id="newsoverview"> <?php for ($i = 0; $i < count($cArray); $i++ ) { $cobj = $cArray[$i]; $title = $cobj->getCollectionName(); $ih = Loader::helper('image'); $img = $cobj->getAttribute('newsimg'); $thumb = $ih->getThumbnail($img, 230, 153, false); $thumb2 = $ih->getThumbnail($img, 87, 57, false); $date = $cobj->getCollectionDatePublic('j M Y'); if ($i < 3) { ?> <li class="newsitem"><a title="<?php echo $title ?>" href="<?php echo $nh->getLinkToCollection($cobj) ?>" target="<?php echo $target ?>"> <span class="date"><?php echo $date ?></span> <h2><?php echo $title ?></h2>
Viewing 15 lines of 28 lines. View entire code block.
It helped for sure, thanks! Actually more in a different way to approach the issue.
I was trying to break it up with another ul, but that won't work with if else (or does it?)
So gave the second li a different class instead, sort of like your example and added the else statement.
I was trying to break it up with another ul, but that won't work with if else (or does it?)
So gave the second li a different class instead, sort of like your example and added the else statement.
<?php defined('C5_EXECUTE') or die("Access Denied."); $rssUrl = $showRss ? $controller->getRssUrl($b) : ''; $th = Loader::helper('text'); $ih = Loader::helper('image'); ?> <ul id="newsoverview"> <?php for ($i = 0; $i < count($cArray); $i++ ) { $cobj = $cArray[$i]; $title = $cobj->getCollectionName(); $ih = Loader::helper('image'); $img = $cobj->getAttribute('newsimg'); $desc = $cobj->getCollectionDescription(); $thumb = $ih->getThumbnail($img, 230, 153, false);
Viewing 15 lines of 27 lines. View entire code block.
This is very basic just to illustrate the logic. I've just thrown it together so you'll need to add in all of your other markup etc.
Hope it helps!