a real life project with ci. THE BEST STRUCTURE= header-footer-sidebar, where to include .... |
[eluser]artlover[/eluser]
Hi friends, days and days I researched at internet for a ci project directory tutorial, but could not find any I wonder how to build the best structure. = Where to keep header.php, footer.php, sidebar.php ... ? = where to include them into page? = how to include them into page? = ... to sum up, how to start the first project with real example? all tutorials on internet shows how to write "hello world!" etc... but when I want to build a real life project, I dont know where to start, how to do things... any help? I appreciate, thanks a lot.
[eluser]Maglok[/eluser]
Well header/footer/sidebar should just be more views in CI. Basically you can call a view from a view like this: Code: <?php $this->load->view('menu');?> Making it rather easy to include them. As for a example implementation with open sourcecode, I dunno.
[eluser]Thorpe Obazee[/eluser]
[quote author="Maglok" date="1245768465"]Well header/footer/sidebar should just be more views in CI. Basically you can call a view from a view like this: Code: <?php $this->load->view('menu');?> Making it rather easy to include them. As for a example implementation with open sourcecode, I dunno.[/quote] bambooinvoice
[eluser]Brain Coder[/eluser]
Quote:= Where to keep header.php, footer.php, sidebar.php ... ? 1- keep it in the viewer directory 2- include what you want like this $this->load->view('footer'); and i suggest to use something like this in your controller $data['main'] = 'admin_pages_create'; $this->load->view('template',$data); the admin_pages_create is a page in your viewer directory and you can loading it by using <?php $this->load->view($main);?> in your template view
[eluser]artlover[/eluser]
bambooinvoice[/quote] thanks for the link. yes it is good way to see how things had been structured the only thing is, which it would be a smaller project example. it is a bit too much complicated. but i see good point in that
[eluser]artlover[/eluser]
[quote author="Brain Coder" date="1245768808"] Quote:= Where to keep header.php, footer.php, sidebar.php ... ? the admin_pages_create is a page in your viewer directory and you can loading it by using <?php $this->load->view($main);?> in your template view[/quote] this admin_pages_create thing confused me :-S
[eluser]Maglok[/eluser]
It is an example, basically 'admin_pages_create' can be replaced by your view. Footer or header for example.
[eluser]artlover[/eluser]
I have a static website work, I have already completed. but I want to change structure to CI... I hope I can manage with your helps...
[eluser]Brain Coder[/eluser]
[quote author="Maglok" date="1245769524"]It is an example, basically 'admin_pages_create' can be replaced by your view. Footer or header for example.[/quote] thats right this page is just for example I will let you see something //Controller index function Code: function index(){ //viewer . admin_home.php page Code: <table border="0" width="100%" dir="rtl" cellspacing="0" cellpadding="0" align="center" > //view template dashboard.php Code: <div id="main" > Just like this
[eluser]artlover[/eluser]
thanks @BrainCoder for great example! I appreciate you to give time for that. so in the example you created an another folder, under system/application, named viewer/ and dashboard is the actually main view file. Do I need model file for static pages as well at ci? my current project is static website, I only have dynamic contact email form. thats it. so I guess i don't have to create model files for each pages like home_model.php, aboutus_model.php ...? |
Welcome Guest, Not a member yet? Register Sign In |