Welcome Guest, Not a member yet? Register   Sign In
Question about the template logic (Phil's template library)
#4

[eluser]victorche[/eluser]
@clip, it works ... And thanks, but this is not what i am asking for ...

simply because this menu will be everywhere... No matter if you are in /blog/ or /news/ or /contacts/

It will change only depending on the user (logged or not, admin or not)

So I don't want to call this in every single controller. I want to escape the code duplication. That's why I was reading about MY_Controller.php, just for using some general and repeating code in it. And it works (sort of).

The problem is that I want to manage the menu links now. And I am taking them from a db table with a simple funcion. And here the problems begun Sad

This funcion takes info from the database, so (i think) it should be in a model. But as I don't want to repeat parts of code in the controllers, i also don't want to repeat this small function in every model i have (like blog_model, news_model, links_model ...). That's why i've made a MY_Model.php and put this little function in there.

Anyway, if i call it from a controller, everything is Ok ... But how can i call it from MY_Controller.php ?

I want to call it only once, to generate my menu links only once and to do it it MY_Controller.php

I don't want to call this in every controller and I don't want to copy and paste this small function in every model too.

Please, this makes me crazy already Smile


Messages In This Thread
Question about the template logic (Phil's template library) - by El Forum - 07-30-2010, 08:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB