[eluser]Otemu[/eluser]
Hi,
Another simple question that I be grateful if anyone can respond. I have a left join query for my news index page, which basically lists various news stories(image, title and intro text), clicking on either the image or title takes you to the corresponding page with the full story.
Not all the time however a image is return, as its not a mandatory requirement, so I plan to have a default picture displayed. Currently I have a switch statement on the actual view checking this as shown below:
Code:
<?php
foreach($newsListAll as $row){
// if no image available issue...............
switch ($row['imageurl']){
case "":
echo "<li>No Image Available</li>";
break;
default:
echo "<li><a href='".base_url()."index.php/home/news/".$row['><img src='".base_url().$row[' alt='".$row[' /><a></li>";
break;
}
echo "<li>".anchor('home/news'."/".$row['newsid']."/".$row['page_url'],$row['page_title'])."</li>";
}
?>
Wasn't sure if this was correct MVC practice to be checking this in the view, or if this should be handled on the actual controller or even the model itself.
Cheers