Welcome Guest, Not a member yet? Register   Sign In
So I'm trying 100% to use MVC...
#4

[eluser]xwero[/eluser]
I have to agree with jtkendall, you are using functions just because they are there. A view should contain more markup than php. The urls and their links can be prepared in the controller and then you only have to loop over them in the view. To make it easier for a designer to change the links you can put them in a language file.
Code:
// controller
$this->lang->load('nav');
$this->load->helper('language'); // the lang function isn't loaded by default
$data['nav'] = array(site_url('home')=>lang('home'),site_url('services')=>lang('services'));

// view
<?php foreach($nav as $url=>$link): ?>
<li><a href="&lt;?php echo $url ?&gt;">&lt;?php echo $link ?&gt;</a></li>
&lt;?php endforeach ?&gt;


Messages In This Thread
So I'm trying 100% to use MVC... - by El Forum - 02-10-2009, 09:13 PM
So I'm trying 100% to use MVC... - by El Forum - 02-10-2009, 11:30 PM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 02:19 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 02:25 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 03:30 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 07:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB