Page 1 of 2

Disscussion on PHP frameworks

Posted: Tue Dec 13, 2005 9:20 pm
by alex.barylski
I haven't used many PHP frameworks, but I am familiar with the following:

- Smarty
- Prado
- mvc.php, Mojavi, etc...

Anyways, the point of this topic is to disscuss the likes/dislikes advantages/disadvatages of each...

Personally I've always liked Smarty over each of these (and it's the one I've actually used the most) only because it was easy to setup and nothing really changed in my coding style except decent seperation of PHP/HTML...

The only thing I didn't like about Smarty was that it doesn't totally sperate PHP from HTML...it would nice if this was possible....

Not sure how this could be possible, cuz any non-trivial interface is going to need logic to represent itself efficiently...but...

I just read an article on some site (can't remember where) and the guy claims PEAR's php_template (or similar) somehow accomplishes complete PHP/HTML seperation...I'll have to check that out :?

Clearly I don't have enough experience with Prado or any MVC framework in PHP anyways, but I'd like to hear your take on it...

I'm mostly interested in hearing what YOU DON'T like about each of these frameworks (technically - not price or poor docs)

For instance, doesn't Prado only support a single component per page? If so, isn't that a burden?

Prado is template driven...but is it easy to integrate into CMS, other...

As for MVC...

What are you likes and dislikes...what would a framework need to do, inorder to satisfy all your wishes?

Posted: Tue Dec 13, 2005 9:34 pm
by Ambush Commander
Each of these applications have different tasks. Smarty is a templating system. PRADO is an object-relational mapping system. MVC is not an application, it is a design pattern. I could use all three, so the vote is a bit nonsensical. That being said, here's my take on them.

Smarty

Smarty works well, and if you aren't too fanatical about theoretical perfection, it works great. Caching is a great plus especially. However, when it comes down to the nitty gritty, there are a lot of theoretical imperfections. I just spent a lot of time migrating to Smarty, and sense it works for me, no sense in overburderning the system. However, I am continually experimenting with new templating technologies with my other projects. The primary problem, in my opinion, is getting some of the real heavyweights to work on PHP4 and 5 across most PHP installations without a dependency on an external library.

PRADO

EDITED! Doh, somehow I got it mixed up with EZPDO. Piffle.

MVC

IF MVC is the official name, they should rename it.

Seperating PHP from HTML

I don't think it's possible. I'll believe it when I see it.

Posted: Tue Dec 13, 2005 9:38 pm
by neophyte
I've never tried a true Framework. SMARTY is a templating system and I've tried 3 of those (Yapter, PHPBB, SMARTY). The most seperation I've ever seen between html and logic is in the TYPO3 system. Even the markers are/can be inserted for you. But I'm still learning TYPO3.

Posted: Tue Dec 13, 2005 10:52 pm
by alex.barylski
Ambush Commander wrote:Each of these applications have different tasks. Smarty is a templating system. PRADO is an object-relational mapping system. MVC is not an application, it is a design pattern. I could use all three, so the vote is a bit nonsensical. That being said, here's my take on them.

Smarty

Smarty works well, and if you aren't too fanatical about theoretical perfection, it works great. Caching is a great plus especially. However, when it comes down to the nitty gritty, there are a lot of theoretical imperfections. I just spent a lot of time migrating to Smarty, and sense it works for me, no sense in overburderning the system. However, I am continually experimenting with new templating technologies with my other projects. The primary problem, in my opinion, is getting some of the real heavyweights to work on PHP4 and 5 across most PHP installations without a dependency on an external library.

PRADO

EDITED! Doh, somehow I got it mixed up with EZPDO. Piffle.

MVC

IF MVC is the official name, they should rename it.

Seperating PHP from HTML

I don't think it's possible. I'll believe it when I see it.
What kind of software engineering attitude is that??? :D

I have an idea of how it might be accomplished...helluva lot'a work..likely faulty by design, but it's an idea...

So, come on....quite hiding your problem solving skills and lemme' hear it 8)

You must have an idea of how complete seperation could be implemented???

I'm just kidding dude...if you really don't have an idea...your not alone...this post was mostly just to tease...and possibly see if you had an idea...

Cheers :)

Posted: Tue Dec 13, 2005 10:59 pm
by Ambush Commander
Actually, if you take the statement at face value, PHP definitely can be seperated from HTML. Most templating systems do that. Of course, if you replace PHP with another pseudolanguage, you really haven't solved anything.

Logic shouldn't be seperated from templates either, otherwise, we'd get really bland pages.

Posted: Tue Dec 13, 2005 11:18 pm
by alex.barylski
Ambush Commander wrote:Actually, if you take the statement at face value, PHP definitely can be seperated from HTML. Most templating systems do that. Of course, if you replace PHP with another pseudolanguage, you really haven't solved anything.

Logic shouldn't be seperated from templates either, otherwise, we'd get really bland pages.
Hmmmm...no imagination at all huh? ;)

I agree...for the most part...that logic is needed for almost all, but the most trivial interfaces...hell I'm used to it...logic is in your face every minute when you deal MVC frameworks like MFC or OWL...you can't escape it...imagine my delight when I discovered HTML and PHP :)

As for the psuedo language bit...

IMHO...not a bad idea...and heres why...

If the language enforces content-only logic, it's a good thing!!!

Programmers are by nature, lazy mofo's...why else do you think we automate tasks which a computer can do better? :)

Expecting a programmer to remain disicplined NOT to write SQL calls or some fancy HTML formatting function and store it in a template (in my case bTemplate, so it's really easy) is asking for messy code...

When the pressure is on and it doesn't make sense to create yet another file to store some sub-routine which is only a few lines long....I succumb to temptation and sometimes store NOT SO USER INTERFACE code in my templates...I've been programming for more than half my life and atleast experienced every popular language (and some not so popular) on the planet...so I guarantee you I have disicpline...I've never forgot a semi-colon or failed to initialize a variable once (not saying I don't make mistakes - just not trivial)... :wink:

Besides that...many editors I've used in the past and present, don't like <? ?> intermingled with HTML source...to them it's one or the other...and only sometimes both...

And finally...it would be nice to have a designer modify a template in his/her native application (usually DWX or similar) without messing up PHP code...or template code...like Smarty uses those silly {if} type tags

Anyways dude, I'm tired it's bed time...TTYT :)

Posted: Wed Dec 14, 2005 12:25 am
by shoebappa
I like XSLT... We do a lot of work with apps coming from different systems, and pull into a bunch of different layouts and designs. Since the data people rarely know how to make something look good, and I could care less what table the data comes out of, in what kind of database, on whatever server, they output XML, and then PHP grabs the XML and slaps an XSL template on it. Best of all it's a standard, and can be done in any language we use other than PHP, and even client side, but that's only realistic in certain circumstances.

I guess we've never done a whole application with this, it's usually just displaying data in webpages from other systems, but I don't see a reason you couldn't have your app output XML and pop XSL Templates to display the interface. Can be a bit verbose I suppose, but it's a fairly simple language, that's still smart enough to do some incredible things for what it is.

PHP -> XML + XSL -> HTML would give you seperation of PHP and HTML, and still have something smart enough to do the job. Might be a nightmare though for something large. Maybe breaking it down into simple templates, but then who knows what the overhead would be. Be interesting to try once.

That and maybe a designer who doesn't hand-code HTML wouldn't have much fun making XSL templates : /

Posted: Wed Dec 14, 2005 4:56 am
by patrikG
With regards to XSLT: that's not a framework. Yes, it helps implement whatever MVC means to you (by that I mean that there are so many different ways of implementing the perceived understanding of MVC), but it is not MVC, nor does it pretend to be. It is a powerful templating language.

I've found the number of frameworks for PHP staggering. I tried out a few (PEAR, Prado, Smarty, even out-of-the-box stuff like ezPublish, Mambo and, I think it was called Phorum) but they didn't do for me what I expected of them: make my life easier by reducing complexity.
I was awed (and still am to a degree) by Vincent Oostindie's Eclipse when I first stumbled across it some years ago - a stable, fast, small and fully OO framework. Am still using it today at times.

The newest kid on the block is ezComponents which will be followed shortly by the Zend framework. Whether those are adding to the construction of the great tower of PHP-Babel or will, at long last, be authoratative, standardised (and standardising) best-practise solutions remains to be seen. In terms of clout, Zend surely have the upper hand, but if you've ever looked under the hood of ezPublish, you realise the quality of their achievement. So they've thrown their lot together (given that the "ez"-guys are very closely connected to the PHP core-development team) and done the collaboration project: http://www.zend.com/collaboration/

I'm somewhat interested in Ruby on Rails simply to see if it lives up to the hype and to find a more standardised language than PHP. Someone tries to port Rails over to PHP ( http://www.phpontrax.com ) - which is a great idea, but these days, with probably around 100+ differenet frameworks, it's not the quality that matters most, it's how many developers you can convince of the benefits of your framework and keep on board.

Posted: Wed Dec 14, 2005 7:01 am
by shoebappa
I thought Smarty was basically a templating language? What makes something a framework, and something else a powerful templating language. Why is it benefitial to use something proprietary called a framework over a standard technology and PHP.

Posted: Wed Dec 14, 2005 7:02 am
by patrikG
My mistake. Smarty is of course a templating language, not a framework.

Posted: Wed Dec 14, 2005 7:02 am
by Maugrim_The_Reaper
Part of the problem I found with frameworks is their scope - are there any truly Lite frameworks that don't include everything plus the kitchen sink? I think (not a Zend follower) that they are at following a shallow approach (max 3 levels of inheritance) which can only be a good thing...
As for the psuedo language bit...

IMHO...not a bad idea...and heres why...

If the language enforces content-only logic, it's a good thing!!!
Problem is the Smarty sub-language (at least) is just PHP in a wrapper. You can even call normal PHP from it. Then again I sit in the "PHP is a templating language" camp anyways so don't mind me. Anyone tried Savant2 or 3? No sub-language unless you require one, so no compilation, so no template cache directory...unless you need to strictly limit access to PHP, a sub-language - though neat - is not a necessity

Posted: Wed Dec 14, 2005 1:04 pm
by alvinphp
A framework is really the environment/tools/methods you build in. I have been working on a portal using a little bit of front controller methodology and mvc structure. I have many reusable classes that make it very quick to build modules in my portal. I consider all the classes and stuctural rules I have set to create modules in my portal to be my framework.

If you want to get more confused with frameworks just look into Java and frameworks. They must have a good hundred of them, though some do compliment each other. (not sure if that is a good or bad thing)

Posted: Wed Dec 14, 2005 7:15 pm
by alex.barylski
Maugrim_The_Reaper wrote:Part of the problem I found with frameworks is their scope - are there any truly Lite frameworks that don't include everything plus the kitchen sink? I think (not a Zend follower) that they are at following a shallow approach (max 3 levels of inheritance) which can only be a good thing...
As for the psuedo language bit...

IMHO...not a bad idea...and heres why...

If the language enforces content-only logic, it's a good thing!!!
Problem is the Smarty sub-language (at least) is just PHP in a wrapper. You can even call normal PHP from it. Then again I sit in the "PHP is a templating language" camp anyways so don't mind me. Anyone tried Savant2 or 3? No sub-language unless you require one, so no compilation, so no template cache directory...unless you need to strictly limit access to PHP, a sub-language - though neat - is not a necessity
Hence my problem with Smarty :)

Posted: Wed Dec 14, 2005 8:35 pm
by neophyte
Unlike (ASP), PHP is a language where you can construct your own framework. I think that's what makes it so popular. You can include ADODB, PEAR, SMARTY whatever you like into it. But here again the choice is yours to make. You don't have to depend on a Framework that forces you into a particular design path. In PHP you can make your framework as big or as small as you like it. I may be wrong but I think that these are some of the reasons why no framework like PRADO has emerged as the defacto system. Unless Zend introduces one standard into PHP I doubt one will emerge.

I've looked at the Savant site and I have a couple of questions for those of you who have used Savant. What are the key advantages to using Savant over just putting PHP code in your templates? What does PEAR have to do with Savant?

Posted: Wed Dec 14, 2005 9:24 pm
by alex.barylski
neophyte wrote:Unlike (ASP), PHP is a language where you can construct your own framework. I think that's what makes it so popular. You can include ADODB, PEAR, SMARTY whatever you like into it. But here again the choice is yours to make. You don't have to depend on a Framework that forces you into a particular design path. In PHP you can make your framework as big or as small as you like it. I may be wrong but I think that these are some of the reasons why no framework like PRADO has emerged as the defacto system. Unless Zend introduces one standard into PHP I doubt one will emerge.

I've looked at the Savant site and I have a couple of questions for those of you who have used Savant. What are the key advantages to using Savant over just putting PHP code in your templates? What does PEAR have to do with Savant?
BINGO!!! I agree 100%...

Great minds think alike ;)