The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Best Plugin and Templating System?

I'm just wondering, what's the best plugin and templating system you've come across in a piece of php software (such a CMS, blog, shopping cart, etc). What have you found easiest and most powerful? If you can, not only provide the name of the software, but maybe also a brief overview of what system is used and how it works.

The reason I ask is because I'm currently developing my own blogging/cms software and while I'm quite happy with the plugin and templating concepts I'm considering at the moment, it's got me curious what other people find as powerful, easy solutions to this common problem.

PHP is a templating language. This question has been debated many many times on this forum and all over the internet. My advice to you is keep it simple. I don't use smarty, and I tend to follow CakePHP's approach of auto-rendering views at the end of an action.

This is a very qood question. In my 10 years of doing web development I have realized that writing a program for which other developers will be able to develop plugins is not natural. I mean there is no universally good way to do this.

The best I came across so far was using pear installer, so you write a program that acts as a pear package, uses pear installer to install.

Then other developers release packages that are also using pear installer and your main program acts as a required dependancy, while plugins act as an optional packages for your main package.

This will result in the most flexible and most convenient way to accept plugins but, at that's a big but, it's very difficult for other developers to learn to release plugins in such a way and most importantly there will always be issues with file permissions.

The reason is that if you want to allow end-users to install plugins via a web browser, then the installer will run under the same user as web server and that user should not have write permissions for most of your directories.

The solution would be do use 'sudo', and then we are getting into something too technical for an average end-user.

Another solution is to just make all your scripts directory 'writable' but that's just a bad practice, too much of a security risk.

Another somewhat OK solution is to instruct user to temporaraly make the directories writable, then run install/upgrade, then switch them back to read-only.

There also a phing installer, which I have not used yet, but I am sure there will be the same permissions problem.

Joomla seems to have good plugin system, but there will never be a 100&#37; perfect solution. I mean in Joomla you still usually have to run some post-installation configurations manually. I really don't have experience with Joomla, I just read their documentations.

By the way, when I hear someone saying that php itself is a templating system I sometimes laugh. This is just something someone with little experience have heard somewhere and now uses as a buzz phraze. OK, maybe you can use php sort of like a templating system, but only in small sites with only few pages. Not to mention your code will look ugly and hard to maintains because you will be mixing php with html.

I've said many times that I have tried many templating systems, even wrote my own once, but was not satisfied with any of them, not even with my own. That's why I started using XSLT as templating system. It works and faster than I even expected.

Is it difficult to use XSLT? Probably the answer is yes because you need to pass XML to xslt processor, so your program will need to be written in such a way that assembles xml document instead of html page. You just have to learn to think 'data' instead of think 'html page'.

I guess it's reassuring that I'm not the only one who struggles to find an ideal solution to the templating and plugin problem. Starting with templates, I want to make a templating system that's friendly to designers with little PHP knowledge, but at the same time, want to make it flexible enough so every piece of html output can be changed via a 'theme'. The template system however, also needs to accommodate a plugin system, so any interfaces defined by a plugin must also be easy changeable (over-rideable) by a custom theme.

As for the plugin system, I want to void spamming my code with messy hooks like wordpress does, and instead take a more object-orientated approach by allowing plugin developers to over-ride specific class methods. This will however lead to possible plugin conflicts, which I'm yet to think of a way to solve.

Overall though, my main goal is to write a templating and plugin system, that allows maximum flexibility, without requiring developers to modify any files included in the core application. Plugins and themes must support uninstallation by simply deleting the folder they reside in.