[eluser]chops[/eluser]
i'm new to ci and I have a few questions.
How would I excecute a bit of code like this in a view
Code:
<? $d = dir("/images/project");
$i = 0;
while (false !== ($entry = $d->read())) {
if(is_file("<?=base_url();?>images/".$row->title."/".$entry) && strcasecmp(substr($entry, -4), ".jpg")==0) {
if($i >= 5) {
$i=0;
}
?><a >title?>/<?=$entry?>" rel="lightbox[<?=$row->title?>]"><img >title?>/thumbs/thumb_<?=$entry?>" alt="photo"></a>
<?php
$i++;
}
}
$d->close(); ?>
i know it shouldn't go in the view, should i set this as a function in models?
Also, what would be the best way to include a global query (eg: latest news sidebar) into most pages? would i have to set the query up in every controller? surely not!
thanks