Welcome Guest, Not a member yet? Register   Sign In
How to do proper templating with Codeigniter (and library/plugins?)
#1

[eluser]fdgsuhofdshjdfgh[/eluser]
Hi, I'm brand new to codeigniter and while I'm not stupid I do struggle to grasp concepts (this is my first go at MVC, although I'm "experienced" with Normal PHP -- used it for many years now) and as such I need good examples that are well explained (that's why I chose CI as it has the best documentation) but I'm struggling to find any good examples of how to template properly.

I've taken a look at the <a href="http://philsturgeon.co.uk/code/codeigniter-template">codeigniter-template</a> library created by Phil Sturgeon but I'm still not 100% what I've supposed to be doing.

Would anyone be able to give me a brief explanation of how I would handle having a globally included header file with a footer file too? I know I could just load them as views before and after I do the controller defined output, but this seems mighty impractical and <i>wrong</i>. I looked at the codeigniter-template library (as linked above) but it doesn't explain how I use themes well enough (for me anyway, maybe I'm missing the obvious).

Examples and explanations would be greatly appreciated, thanks!
#2

[eluser]WanWizard[/eluser]
I haven't used Phil's library myself, so I can't comment on that. I have used Colin Williams' library. He has a decent user guide online with a step-by-step guide. I'm sure must of it can be applied to Phil's library as well.
#3

[eluser]fdgsuhofdshjdfgh[/eluser]
This Library is fantastic, the documentation is much better and it seems more versatile. Thanks WanWizard, I've played with it and all works well! :-)
#4

[eluser]pickupman[/eluser]
Another vote for Colin's template library. Phil's got some great code, but I tried his as well and opted to go with the other.
#5

[eluser]Vheissu[/eluser]
[quote author="pickupman" date="1287818769"]Another vote for Colin's template library. Phil's got some great code, but I tried his as well and opted to go with the other.[/quote]

I worked out how to use Phil's template library by looking at the source code of Pyrocms of which he uses his own template library in for themes and layouts. It's easy once you get the hang of it.

Look at the Pyrocms source code. Although, Colin William's template library is pretty good too for getting started.




Theme © iAndrew 2016 - Forum software by © MyBB