Monday, November 21, 2011

My answer to "Error in profile page"

This is my answer to a Question on Support site for LampCMS project


It's fixed now. What happened is that I redesigned a templating engine, basically improved it alot. Now the templating engine has 2 base classes "Fast" and "Simple", Simple extending Fast.

The "Fast" template has ordered placeholders - in the format that works with sprintf() function, which basically has placeholders like %1$s, %2$s, etc - in order, and each placeholder can appear more than once in the template if necessary. This template uses vsprintf() function of php to render the template, which is very fast.

The "Simple" template has named placeholders like {some_name}, {something_else}, etc. This type of template is alot easier to create and edit but it's 20% slower to render. Basically any template that being used inside the loop - like to render a list of comments or a list of answers, etc should extend "Fast" template, but templates that used only once on page like to render some block on the page can extend "Simple" template.

Anyway, now I uploaded new templates to go with the new templating engine and everything works again.

Also in debug mode the templating engine automatically adds html comment blocks to <!-- begin sometemplate --> and <!-- // end sometemplate --> and also comments before and after the template loop. This makes it very easy to debug your template design by just viewing the source html of the page.

These comments are not added in production (non-debug mode), so you don't worry about extra overhead for your production site.

I also plan to release this templating engine as a stand-alone project, calling it "Fast and Simple" php templates.

No comments:

Post a Comment