Welcome Guest, Not a member yet? Register   Sign In
How can user common layout for all project
#1

[eluser]Unknown[/eluser]
How can user common layout for all project.
#2

[eluser]RedIgniter[/eluser]
You mean template?

This is how I do,

1. Create folder in views folder (usually called contents)
2. Create file header.php and footer.php in contents folder
3. Put everything that will not change before and after the page content in those files, for example navigation links and other contents in header.php, copyright notices and footer links in footer.php
4. In your controller, do the following...

$this->load->view('contents/header');
$this->load->view('whateverpage'); // this page can be anything you want, if you have signup page or login page etc.
$this->load->view('contents/footer');

5. Use the above method in all controllers that are going to be pages such as main/signup (in main.php controller create a function called signup and put the above code in it, create a file called whateverpage in views folder and put contents you want in it)

This the method I use, it might not be the best one but I use that method.




Theme © iAndrew 2016 - Forum software by © MyBB