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.

ASP.NET style framework for PHP5

I've noticed over the last few months that this seems to be a hotbed of discussion on template based frameworks, so I thought I'd throw a project I've been working on up into the mix. It's only in its infancy, so there is still a lot left to do, and the templating engine is rather fragile (based on regexs), and it's by no means blazingly fast (speed is one of the main things I'll be looking at improving). There are a couple of examples included, the one below and another one that has a bit of everything; modules, user-defined template based controls, and validators, which is included in the download.

I've rewritten a project I was working on called WebPanels for PHP5, and based it around ASP.NET's code behind approach. This means that you can design a form in Visual Studio or the free ASP.NET WebMatrix editor, and it will be displayed by my framework, with controls declared in the template file imported into the Page class' namespace. A quick example;

If you're playing around with PHP5, I'd appreciate if you could take a bit of time to look at it and give me some suggestions, or criticise me for being a fool reimplementing something that's not so great to begin with .

Unfortunately I'm still with version 4 for the foreseeable future, but I'd be interested in seeing how your

PHP Code:

using("WebPanels.Web.UI");

works Is it possible for you to post it I wonder ??

It's quite simple really; replace all the '.' characters with path separator characters, do a quick check to make sure that you haven't already made a call to 'using' for that namespace, then simply add it to the "include_path" variable with ini_get and ini_set .

PHP Code:

//The base directory (note that you must include the trailing slash).
define("WEBPANELS_PARENT", "C:/Development/websites/WebPanels2/");
define("WEBPANELS_BASE", WEBPANELS_PARENT."WebPanels/");