Jump to content

Recommended Posts

A website where individual pages are classes implementing a controller interface. index.php creates the instance of the page controller class depending upon a get variable and calls a common method defined by the controller interface.

vs

Doing the pages the classic way with the logic embedded on them individually.

Any opinions? I can never decide between these, the first has some advantages over the second but can be pretty overkill at times, am I thinking too Java?
Link to comment
https://forums.phpfreaks.com/topic/35149-site-organization/
Share on other sites

I generally use the second form, and have header.php, footer.php and maybe other "output includes" if the project requires them.

There's no [i]real[/i] problem with first form, though as you say it can be a little overkill sometimes.  Unless you're using a database to store the content (and hence bordering on the CMS/blog scale of things), you'll probably have separate files anyway for each page so there's no [i]real[/i] advantage to my mind.

In practice, I've done a number of sites where I use [url=http://www.pivotlog.net]Pivot[/url] as either a blog or news engine (i.e. the second form) and embed that on one page of a more traditional site (i.e. the first form).  So as in most things, combining the two is often a good approach. ;)
Link to comment
https://forums.phpfreaks.com/topic/35149-site-organization/#findComment-167057
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.