New user and view question |
[eluser]Unknown[/eluser]
Hello everyone! I'm brand new to codeigniter but I'm glad to see such an active community. Thank you for the great framework, this will make my getting back into coding much easier. Started in the mid 90's with PHP and then joined the military in 2003 haven't programmed since and wow have things changed! haha. Anyways. I'm curious what the standard is for loading multiple views withing a controller, say I want to load the header of a page, then data formatted listings, then a footer template. How do people normally go about that. I'd imagine loading a view kinda terminates a controller. Thanks again.
[eluser]Victor Michnowicz[/eluser]
I'm a fan of Phil Sturgeon's template library: http://getsparks.org/packages/template/show
[eluser]wh1tel1te[/eluser]
I personally load the views as variables in my main template. Here's an extremely rough version of what I do: Controller code: Code: <?php View code (template.php): Code: <header><?php echo $header; ?></header>
[eluser]R_Nelson[/eluser]
I ran into this problem myself when i started with CI what i did was built a template and used Code: $this->load->view(name_of_view,$data_array) Code: $this->load->view(includes/template,$data) heres an example of the controller Code: function about () Code: <!DOCTYPE html> |
Welcome Guest, Not a member yet? Register Sign In |