include views and have more controllers to be used? |
[eluser]Schumacher[/eluser]
I know that the title might be a little misunderstanding but i didn't know what els to go for. Just to say: I'm new at code igniter, but i find it very interesting but there are some things and can't see my way out of. Lets start. I have thing ideer of building this site, and i would like to use code igniter to it, but, there are some problematics with it, and some problems i can't see my way out of without any help. On the site i have a header, left content, mid content, right content and footer. And these 5 'places' are in a view for them selves. I got a template.php view that includes them all so i got it all in one file. But my question is, if i have a login in the left content, and is should be posable to login in that place, and when the person is logged in there is a profil menu. How do i get a controller du handle this? when i also have to have a controller to control the other stuff going on , on the site. How can i do this and still have a useable url ? Do i need to have a master controller or what? Hope this makes sense, and think that im not the first to have this problem. Fell free to post a better way to set up my views, thats just what ive seen ppl do. // Schumacher
[eluser]n0xie[/eluser]
This question is so common, that an entire part of the wiki has been devoted to it: Header and Footer on every page
[eluser]karthik86[/eluser]
[quote author="Schumacher" date="1264433775"]I know that the title might be a little misunderstanding but i didn't know what els to go for. Just to say: I'm new at code igniter, but i find it very interesting but there are some things and can't see my way out of. Lets start. I have thing ideer of building this site, and i would like to use code igniter to it, but, there are some problematics with it, and some problems i can't see my way out of without any help. On the site i have a header, left content, mid content, right content and footer. And these 5 'places' are in a view for them selves. I got a template.php view that includes them all so i got it all in one file. But my question is, if i have a login in the left content, and is should be posable to login in that place, and when the person is logged in there is a profil menu. How do i get a controller du handle this? when i also have to have a controller to control the other stuff going on , on the site. How can i do this and still have a useable url ? Do i need to have a master controller or what? Hope this makes sense, and think that im not the first to have this problem. Fell free to post a better way to set up my views, thats just what ive seen ppl do. // Schumacher[/quote] While not wanting to make things complicated you can just use a session variable which most obviouslly u ll use to check if the user logged in, and depending on that display what ever you need...
[eluser]Schumacher[/eluser]
Arn't there a guide / tutorial to this ? And which would be most appropriate for bigger sites.
[eluser]veritascs[/eluser]
Not sure if you have checked out the approaches at Header and Footer and Menu on every page but my approach was to make a helper file that my controllers can use to load page data. Example from my code: controllers/home.php Code: function index() helpers/template_helper.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I'm really new to CI and the MVC pattern so feedback would be greatly appreciated if this is an illogical approach. |
Welcome Guest, Not a member yet? Register Sign In |