Working on a new tempalte engine for dolphin.

PhyraxDesigns posted 13th of March 2008 in Community Voice. 3 comments.
CyberXing and I are working on writing a new template engine for Dolphin. This will be an individual application I suppose or maybe we'll make it as a plug-in, I have no idea yet. I'm playing with three template engines right now, hopefully when I can get in contact with CyberXing we'll decide on which template engine to go with. So far i'm looking at the following:
  • Joomla's (patTemplate)
    • Very simple to use, only uses one template file.
    • Uses a similar layout to XML so it separates code from design.
  • phpBB (phpBB Template Class)
    • I know this template engine very well.
    • Multiple TPL files are required depending on the core software being used.
  • Smarty
    • Seems to be the most logical choice.
    • Joomla's current developers are discussing switching to smarty.
    • Seems to be the fastest of the three
    • Comes with extensive and complete documentation
    • Separates php code from template files.
I'm probably looking towards smarty due to the complete documentation and the speed. Plus according to smarty developers:
  • Designers can't break application code. They can mess with the templates all they want, but the code stays intact. The code will be tighter, more secure and easier to maintain.
  • Errors in the templates are confined to the Smartys error handling routines, making them as simple and intuitive as possible for the designer.
  • With presentation on its own layer, designers can modify or completely redesign it from scratch, all without intervention from the programmer.
  • Programmers aren't messing with templates. They can go about maintaining the application code, changing the way content is acquired, making new business rules, etc. without disturbing the presentation layer.
  • Templates are a close representation of what the final output will be, which is an intuitive approach. Designers don't care how the content got to the template. If you have extraneous data in the template such as an SQL statement, this opens the risk of breaking application code by accidental deletion or alteration by the designer.
  • You are not opening your server to the execution of arbitrary PHP code. Smarty has many security features built in so designers won't breach security, whether intentional or accidental. They can only do what they are confined to in the templates.
First of course, we need to identify all the files that would be effected by removing current code associate with dolphins templates and patch it accordingly. Once we figure out where the core code is starting we can start from the bottom up. So far i've found where all the $_page['name_index'] files are coming from which is of course the root files such as about_us.php, activation_email.php, etc... and according to some posts from modmysite.com if once the $_page['name_index'] is called and no page_x.html is in the in the templates directory it then uses the default.html. Once the page variable is defined it is then later in the documents placed into yet another variable ($_ni) which is then passed to an array variable ($_page_cont[x][x] = PageCompMainCode() ). The function PageCompMainCode() is then defined below usually at the end of the document which of course makes the page and becomes the __page_main_code__ variable in the template files.

This is going to be fun to trace all this stuff and figure out what we can remove and what stays the same
, rather to make a plugin, or change the core code, should we make a new release or just offer this as a separate package? No one knows yet, but I hope we keep going with this project. The Dolphin product is a great piece of software that seems to lack certain abilities and I hope CyberXing and I can change that.


----------------------
L8r
Phyrax.com
 
Comments
·Oldest
·Top
Please login to post a comment.
DosDawg
i would like to volunteer for beta testing. i am familiar with smarty templates, through a script called jamroom which can be reviewed at jamroom.net i think is the url. at any rate, if you need any help that i can provide, just please let me know.

later,
DosDawg
PhyraxDesigns
thanks for the offer, but there's no testing yet, we're just planning and laying things out.
rbuzziol
You can also consider PHPTAL, a kind of a ZPT porting. http://phptal.motion-twin.com/

The templates will be in xhtml (no php syntax or similar, just attributes) and designers can use their preferred tools to design the template and include example information too.
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.045466899871826