Welcome Guest, Not a member yet? Register   Sign In
[Best Practices] Where should my code go ?
#1

[eluser]Unknown[/eluser]
Hello,

I've just started using CI, and I'm building a pretty standard application, that has some static and some dynamic blocks of html. Each page is split in several parts :

- The title bar (mostly static)
- The navigation (dynamic, depending on the user being logged in or not)
- The main content (dynamic)
- The footer (static)

The only thing I'm sure right now, is that the main content is exactly what I build in my various views. But should I build other (site-wide) views for headers and footers and *include* them to my specific views ? Or should I create a specific library/helper to handle this ?

Caching is also an issue (though a smaller one, since headers and footers shouldn't require heavy processing). Is it possible to use the caching features of CI for fragments of content ?

Since it's a pretty common way of building pages, I guess many people faced that issue before me...what's the best way to handle all this ?

Thank you !
#2

[eluser]#1313[/eluser]
I think that http://codeigniter.com/wiki/faq covers all of your questions very well =)
#3

[eluser]Unknown[/eluser]
Sorry, I didn't notice there was a wiki...and now that I read the page, I feel stupid because it exactly answers my question Smile

Thank you for your answer !
#4

[eluser]sophistry[/eluser]
Welcome to CI!

And if you find any resources or threads to add to the FAQ, please do. It's a wiki after all.




Theme © iAndrew 2016 - Forum software by © MyBB