semistatic w/php vs pure php

Red Squirrel

No Lifer
May 24, 2003
68,656
12,718
126
www.anyf.ca
I have not designed a web site in a long time, only maintain my existing sites where were made from scratch years ago. Currently they are static html with php embedded in them as required.

I am about to create a new website from scratch and debating, would I be better off using pure php such as making a CMS type site, or is my existing method ok? I'm speaking more or less from a performance perspective. I am guessing the less php a site has the lighter it is on the server, but is this really even an issue to consider now days? I'm thinking of even just having a base template that calls header() has the body coded in, and footer() that way at least if I change stuff in the header/footer of the site I only do it once.

I'm not a big fan of premade CMSes I find they're too bulky to work with and too "cookie cutter", so that's not really an option I'm looking at.
 

Woosta

Platinum Member
Mar 23, 2008
2,978
0
71
CMS's are usually horribly coded, hard to customize, not practical for use unless you're more of a designer than a programmer ( see Joomla, Turdpress ). There are some decent CMS's such as Drupal but they aren't as flexible as frameworks.

Going the pure, minimalistic way might be more practical and feasible considering you already know what to do, but I would instead recommend you familiarize yourself with the Zend Framework - it's going to be a pain learning the first time around but it'll be well worth it.

Zend is a pretty nicely coded library with endless useful classes for pretty much everything, someone has already coded a class, tested it, it's mature and stable. Only caveat as mentioned is you have to refamiliarize yourself and rethink entirely, as it's MVC, OO based and not simple procedural... it'll take awhile to get used to it.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
The performance issue is a valid one, but it will only come into play if you have lots of people viewing your site. However, there are easy ways around it. You can cache the site so it is basically static after the first time it is generated. Again, though, unless you're expecting a lot of users, it isn't even worth concerning yourself over the performance ramifications.
 

jvroig

Platinum Member
Nov 4, 2009
2,394
1
81
I'm speaking more or less from a performance perspective. I am guessing the less php a site has the lighter it is on the server, but is this really even an issue to consider now days?
It's not really PHP itself that would cause a major slowdown in performance. It's how many queries to the database those scripts execute. If you are just using PHP to include files, display the user's name from a SESSION var, or any other similar task that does not require a trip to the database, then you would still be pretty fast.

Blogs like WordPress take a big performance hit exactly because of how many queries per page load they execute, especially when the blog owner goes crazy with widgets that all take their sweet liberties taking a trip to the database for config information or whatever.
 

Red Squirrel

No Lifer
May 24, 2003
68,656
12,718
126
www.anyf.ca
It's not really PHP itself that would cause a major slowdown in performance. It's how many queries to the database those scripts execute. If you are just using PHP to include files, display the user's name from a SESSION var, or any other similar task that does not require a trip to the database, then you would still be pretty fast.

Blogs like WordPress take a big performance hit exactly because of how many queries per page load they execute, especially when the blog owner goes crazy with widgets that all take their sweet liberties taking a trip to the database for config information or whatever.

Yeah there's still lot of factors, and I usually try to limit my DB accesses. If I find myself querying the same query twice then I just keep the data in a global variable or other means so I have access to it for the whole session.

What I'm thinking of doing is a very basic custom CMS and I can just use it for any site I make. It would speed things up a bit. Could even have page caching built in. .