automatically load layout |
[eluser]runrun[/eluser]
I got a layout like this, it's called layout_view.php Code: <html lang="en"> I got a view looks like this, it's called register_view.php Code: <h1>register</h1> when I do this Code: class Register extends controller{ I want the output will be like this Code: <!--my register view will be inside my layout--> So, how would you do that ?
[eluser]Eric Barnes[/eluser]
I always use a simple template library or extend the output for this. Here is a quick example: http://ericlbarnes.com/blog/post/code-ig...e-tutorial
[eluser]ranjudsokomora[/eluser]
Hello runrun, You could do a number of things here... Here are a few: # 1 You could send a view variable and load a secondary view inside layout_view.php Your controller would look like: Code: class Register extends controller{ And your view would look like: Code: <html lang="en"> # 2 You could break up your layout_view.php into two views, and using your controller you could load three total views. So you would have something like this: header_view.php Code: <html lang="en"> register_view.php Code: <h1>register</h1> footer_view.php Code: </body> Your controller would look like this: Code: class Register extends controller{ |
Welcome Guest, Not a member yet? Register Sign In |