Professional CodeIgniter

(singke) #1

Chapter 4: Creating the Main Web Site


103


< div id=’pleft’ >
< h2 > Search Results < /h2 >

< ?php
if (count($results)){
foreach ($results as $key = > $list){
echo “ < img src=’”.$list[‘thumbnail’].”’ border=’0’ align=’left’/ > \n”;
echo “ < h4 > ”;
echo anchor(‘welcome/product/’.$list[‘id’],$list[‘name’]);
echo “ < /h4 > \n”;
echo “ < p > ”.$list[‘shortdesc’].” < /p > < br style=’clear:both’/ > ”;
}
}else{
echo “ < p > Sorry, no records were found to match your search term. < /p > ”;
}
? >
< /div >

Upload your controller and new view, and then run a search on the site. You should see either search
results or a message stating that no records matched the search term. Figure 4 - 12 illustrates this page.


Figure 4 - 12
Free download pdf