in native templating / mvc who should load includes?
Moderator: General Moderators
in native templating / mvc who should load includes?
In a native templating mvc type architecture is it better to have
1. my controller load header.php, mypage.php, and footer.php
OR
2. my controller load mypage.php and that page loads my header and footer include pages?
OR
3. I am just being anal.
1. my controller load header.php, mypage.php, and footer.php
OR
2. my controller load mypage.php and that page loads my header and footer include pages?
OR
3. I am just being anal.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Not using a front controller and do not want to in my particular situation. So, I would say you are more with 1 where the controller loads the include pages. Thanks!d11wtq wrote:I'm thinking number 0.
Front Controller can load in header and footer, as well as the correct page controller. The page controller can then load in mypage.php.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Yes, I sway toward 1alvinphp wrote:So, I would say you are more with 1 where the controller loads the include pages. Thanks!
- AKA Panama Jack
- Forum Regular
- Posts: 878
- Joined: Mon Nov 14, 2005 4:21 pm
This is assuming every page/module uses the same header/footer. Granted, you can have the controller decide what header to use (if at all). Do not get me wrong, I love the front controller pattern and use it quite extensively already.d11wtq wrote:Yes, I sway toward 1alvinphp wrote:So, I would say you are more with 1 where the controller loads the include pages. Thanks!If the header and footer are the same on each page (with maybe the exception of a button highlighted on a per-page basis) I would consider refactoring a little to centralize the loading of the header and footer however
Last edited by alvinphp on Wed Aug 23, 2006 6:50 pm, edited 2 times in total.
That is true, plus some includes might have to be integrated inside a main page where you need to add the include inside mypage.php versus a header/footer which goes on the top/bottom of the page and is easy for a controller to handle. Hmmm, maybe I will stick with 2. I would like includes to all happen in the same place as it makes it easier for me to work with the code.AKA Panama Jack wrote:Actually number 2 would be the better way to go. This will allow you to have DIFFERENT headers and footers. It will allow far more control over what is being displayed.