Not wanting to use a template library, so is this an alternative that makes sense? |
[eluser]dallen33[/eluser]
I want to load almost all of my content into a single template I built (called user_page.php). Is this a good way of doing it? Code: $this->data['title'] = 'Sign In';
[eluser]skunkbad[/eluser]
I don't want to use template libraries either. I do as you have shown, instead of $this->data, I use $view_data.
[eluser]jellysandwich[/eluser]
What's your reason for not wanting to use any template libraries? If it's complexity/footprint, then I would recommend this: http://maestric.com/doc/php/codeigniter_template It's tiny - 1 variable and 2 functions, that's it.
[eluser]aquary[/eluser]
What i did is to put my own template function into MY_Controller... Code: // Commoon template loader function Then I could use either $this->_backend() or $this->_frontend() to load different template for different sections. In your case you could totally made $data as optional, and pull data from $this->data directly before load the view. Code: function _load_view($template=NULL, $view=NULL, $data=NULL){ Actually it's quite nice to autometically pull data from $this->data.... I think I'll adapt your style to my code :3 |
Welcome Guest, Not a member yet? Register Sign In |