Templating - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Templating (/showthread.php?tid=13416) |
Templating - El Forum - 11-21-2008 [eluser]CanadianBeef[/eluser] I'm just curious...something I have not been able to determine reading the docs hitherto is how you templatize an applicaiton so each page follows similar navigation. How do you handled situations where a login form might displayed on each page until an individual is logged in at which a "My toolbox" might replace it? Do you use a HTML static template and "inject" the dyanmic body contents into the template using str_replace? This would apply to both the body content and possible navigation in the case of login FORM's? If you could point to an article on best practices in this regard I would appreciate it. Cheers, CB Templating - El Forum - 11-21-2008 [eluser]fesweb[/eluser] Usually, this question gets answered with this Template Library. There are other types of template systems out there too. Conceptually, to do it without a library works something like this. Controller: Code: // - do a bunch of stuff View -> templates/my_site: Code: <html> Templating - El Forum - 11-21-2008 [eluser]CanadianBeef[/eluser] OK Thank you...I figured it would look something like this but incase CI had some unique way of doing things I wasn't sure. Cheers, Alex Templating - El Forum - 11-21-2008 [eluser]fesweb[/eluser] You're welcome. As is the case with much of CI, you can do it many different ways - it's just a matter of what you need it to do for your particular situation. Good luck, Matt Templating - El Forum - 08-22-2009 [eluser]MEM[/eluser] fesweb can you or anyone else, explain, a little bit further, this part: Code: // Then load whichever template you would like to display What is the $my_site function in this context, where does he/she come from? Thanks a lot in advance, Márcio Templating - El Forum - 08-22-2009 [eluser]fesweb[/eluser] The $my_site var is just an example of how you might handle a situation where a logged-in user sees one version of a page and a non-logged-in user might see another. Code: // this would solve the same problem (if it were a problem YOU needed to solve): Templating - El Forum - 08-22-2009 [eluser]MEM[/eluser] Thanks Matt. Indeed, I will need that part to... thanks for clarifying. Normally the homepages have not similar layouts as the secondary pages. Could a solution like this one, be a solution for thoses cases, where we need a homepage slidely different from the other pages? Regards, Márcio |