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

[eluser]jtkendall[/eluser]
Hi d3,

In my opinion, I think you're trying too hard to do 100% MVC. It's going to be hard to get a dynamic view that doesn't have any PHP code in it (though, you could look into the template parser class http://ellislab.com/codeigniter/user-gui...arser.html).

Now, regarding your code, I'm a little confused as it seems you're over complicating it. Why not simply do:

Code:
<div id="menu">
    <ul id="main">
        <li><a href="&lt;?=URL;?&gt;">Homepage</a></li>
        <li><a href="&lt;?=URL;?&gt;">Services</a></li>
        <li><a href="&lt;?=URL;?&gt;">Hosting</a></li>
        <li><a href="&lt;?=URL;?&gt;">Portfolio</a></li>
        <li><a href="&lt;?=URL;?&gt;">About Me</a></li>
        <li><a href="&lt;?=URL;?&gt;">Contact Me</a></li>
    </ul>
</div>

Obviously replace all of the "URL"'s with the actual urls you want. It's 10 lines of code instead of 25 and requires far less PHP than your example (it won't need any if you use relative urls eg. /services). Even the user guide has examples of views with code in them. Everyone who has used MVC has put code in their views at one point or another.

You mentioned a question about the switch() statement, what is it?


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