[eluser]Andrew Vit[/eluser]
Hi all,
Last year I created a lightweight MVC framework for my projects that need to be hosted on PHP4 servers, following a philosophy similar to CodeIgniter (or Rails actually, as closely as could be emulated in PHP4). CodeIgniter is more feature-rich than what I've developed for myself, so rather than maintaining my own, I'd like to know if it makes sense to throw my hat in with the CI crowd...
First, I need to investigate if it's feasible for me to migrate my stuff to CI. It seems like my sites could convert quite easily (hey, it's MVC after all... well structured and separated!), but I'd like to know if there's a built-in or straightforward way to do a few things that I depend on heavily.
My core functionality automatically displays files from the views folder, if they exist in a subfolder named according to the controller:
1.
GET /articles/howdy (which calls up "articles_controller") would automatically display the file
views/articles/howdy.html, unless I define a function named "howdy" to override this.
2.
If a file under
views/layouts/application.html exists (or one more specifically named after the controller like "articles.html"), the view file gets wrapped in a layout template automatically.
3.
My layout templates have placeholders for different parts (stylesheets, scripts, etc.) and these are automatically inserted as well, based on the existence of specific filenames:
stylesheets/articles.css (For any view in the articles controller.)
stylesheets/articles_howdy.css (Loads for the articles/howdy view only.)
The above allows for a loose sort of "CMS" where the content can be updated easily by editing the (mostly) plain HTML "partial" view files. Anything can be overridden, but the key for me is the default behaviour so that nothing needs to be defined in PHP functions unless needed for specific behaviour.
I'd appreciate if you could describe how something like this could be done in CodeIgniter.