Welcome Guest, Not a member yet? Register   Sign In
some ci questions
#1

[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;
                        }
                         ?&gt;<a >title?&gt;/&lt;?=$entry?&gt;" rel="lightbox[&lt;?=$row->title?&gt;]"><img >title?&gt;/thumbs/thumb_&lt;?=$entry?&gt;" alt="photo"></a>
                         &lt;?php
                         $i++;
                    }
                }
                $d->close(); ?&gt;
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


Messages In This Thread
some ci questions - by El Forum - 07-01-2008, 10:20 AM
some ci questions - by El Forum - 07-01-2008, 12:57 PM
some ci questions - by El Forum - 07-01-2008, 01:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB