Welcome Guest, Not a member yet? Register   Sign In
Static Content & Site Performance
#1

[eluser]lenwood[/eluser]
Hi All,
I'm building a project in CI, which will have several pages of static content. Was originally planning to code this content into the views, which breaks MVC of course, but my thought was that these pages would load faster because I'm skipping the model.

Recently it occurred to me that the CI framework is loading in the background anyway, and that CI's caching is excellent, thus eliminating the need for hard coded pages.

So my question is, will there be any appreciable performance gain by eliminating the controller? I'm likely the only one that will ever work with the site's back end, and this content is truly static, so there's no particular benefit to accessing it via admin pages. I just want these pages to load as quickly as possible.

I do plan to use MVC for other sections of the site, blog, app, etc.
#2

[eluser]mddd[/eluser]
If it is something you are showing in the view, then why is that breaking MVC? I don't see why it would be a problem to put a page of static content in a view and then just have a controller that does nothing but load the view. The overhead in that will be very low. Especially if the controller does not load any unneeded models and libraries. I often make a controller called 'static' that takes 1 argument, namely the view to load. So if you call /static/disclaimer that will display views/disclaimer .php. The 'static' part can even be 'removed' by using routes so the user only sees the page as /disclaimer. I think it is still good to show the page via CI and build your headers, menus etc. in the same way as you do on your other pages. To avoid duplicate content en update troubles.
#3

[eluser]stommert[/eluser]
Hi,

As you stated, the caching options in CI are great. The overhead on execution in minimal, so why bother to bypass the controller, it makes no sense to me. If you realy, realy, realy, want no overhead at al, then make static html pages and don't use CI.

gr.
#4

[eluser]lenwood[/eluser]
Thanks guys, this confirms my thought process. For these pages I'm going use a controller to call the view, and have all of the content contained there.




Theme © iAndrew 2016 - Forum software by © MyBB