Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Body template with including parts
  • I have searched forum but i think it has not been yet properly answered.
    I was use to when using custom coding create index.php which was indeed entry point e.g. controller. There I have used rooter class to determine which file to include and used one body template and include files included in this template their parts and in the end of the file I added header and footer and output the page. Could you tell me how to do this simple in fuelphp?
    I know approach where in each controller you could copy everything connected to header footer etc. but that is very ugly solution violating DRY.
  • See http://docs.fuelphp.com/general/views.html, under "Nesting Views". Normally you would use a base controller, which would extend Controller_Template. In the before() method of that base controller you'll set everything up, and in the after method() you assemble everything and send it to the page template. Your controllers would then extend this base controller, and only have to deal with the 'content' part of the template. You can also look at your Depot project on github, which uses this mechanism.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion