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

[eluser]victorche[/eluser]
Phil's template library is working fine for me (http://philsturgeon.co.uk/code/codeigniter-template)
But until now I was only dealing with different controllers and their views. Today decided to work on some general stuff and here is the case...
I have header_tpl.php which I am loading all the time with the help of MY_Controller.php
Code:
function MY_Controller()
    {
        parent::Controller();

        $this->template->set_layout('page_tpl');
        $this->template->set_partial('header', 'header_tpl', FALSE);
        }

So far, so good... But now I want to add a menu in this header. Navigation menu. And here is my problem. The menu will be generated from the info from my database. For example I have a table "categories" and in this table I have 1 => "movies", 2 => "music", 3 => "images"
(this is because different users will have different options in the menu)
and my question is:
I can make a function get_menu_items(), but where should I place it? In MY_Controller.php I think it is not soo good idea Sad
And in this function there will be db stuff (model maybe)?
And second ... how to add the recieved data in the template? set_partial does not have a forth parameter $data

Phil template is good, but the documentation and examples are poor Sad


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



Theme © iAndrew 2016 - Forum software by © MyBB