Welcome Guest, Not a member yet? Register   Sign In
[Solved] Where factorize HTML code ?
#2

[eluser]xwero[/eluser]
I'm not sure what you exactly want but the way i would do the thing you want is to create 2 views
Code:
<!-- views/box.php -->
<div class="box">
<h1>&lt;?php echo $box->title; ?&gt;</h1>
&lt;?php echo $box->content; ?&gt;
</div>
&lt;!-- views/boxes.php --&gt;
&lt;?php foreach($boxes as $box){ echo $box; } ?&gt;
And in the controller
Code:
$boxes = array();
foreach($query as $row)
{
    $boxes[] = $this->load->view('box',array('box'=>$row),TRUE);
}
$this->load->view('boxes',array('boxes'=>$boxes));
This way the view files can be used for more than only displaying boxes. I hope this helps.


Messages In This Thread
[Solved] Where factorize HTML code ? - by El Forum - 03-26-2008, 06:23 AM
[Solved] Where factorize HTML code ? - by El Forum - 03-26-2008, 06:54 AM
[Solved] Where factorize HTML code ? - by El Forum - 03-26-2008, 07:02 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-14-2008, 01:00 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-14-2008, 07:36 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-14-2008, 07:38 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-14-2008, 07:44 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-14-2008, 07:46 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-16-2008, 01:11 AM
[Solved] Where factorize HTML code ? - by El Forum - 09-16-2008, 07:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB