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

[eluser]victorche[/eluser]
Still no success ...

The problem is really hard to explain (and maybe not exactly CI related). I am really learning php and the problem is:

I can understand the model-view-controller idea and if we are talking about a single page (like blog, news), I can manage with the stuff. Creating the controller, then a model to handle with all the functions which are database related.

But I have common parts on my site (e.g. header and footer). And yes, I've read all the Wiki articles, about different approaches. I've read the "Keep it DRY" topic by Phil. Tried and tried ... No result.

As adviced, I created MY_Controller.php and ... Added there some common template stuff. Only a few lines about my partials (header, footer). I was playing with some inner parts of my site, but 2 days ago I decided to work on the header part. I have a nav menu there and I need a small function to take the links and their titles from my db. So I can put this function in a model, but I don't want it to repeat in every single model. That's why I've made MY_Model.php and put the function there. And if I call it from any of my controllers, it works. But the situation is the same. Why I have to repeat this code in every single controller? Just to show the menu links. I want to call this function in MY_Controller.php but seems to be impossible for me Sad

Any ideas, please?


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



Theme © iAndrew 2016 - Forum software by © MyBB