Smarty Xmas


The first Xmas card arrived in the mail today, from the parents with a couple nice gift cards from Safeway in it, just what I need! Thought about sending cards the other day and dug out the left over supply from last year, enough for this one too, but they just sat on the desk until today’s reminder and now a few are in the post from myself as well.

Getting more familiar with the php-Smarty template-ing slash MVC, the mgwebservices.ca web site is mostly running on it now. I’ve made smarty functions out of the ones that were already there so they can be included with simple curly braces { function_name } in the html templates, which are free of any code except xhtml mark up and aforementioned curly braces.

Spent a good number of hours on getting Manuel Lemos’s forms generator working with something other than the default configuration, it wasn’t until I groked that some of the dynamic functions I was using in my modified set_env.php file needed to be copied over to the second invocation of the smarty engine (something about one of the filters in the forms, don’t ask me why it needs to be done twice) and I had found all the places where my custom located template, complile etc. files needed to be referenced that everything worked right.

Now that it does though, even though the form creation tools already included with Smarty are very easy to use it separates the entire form from the person doing the html and all they see is {$form} in the main page markup. If needed, the form html itself is also in a separate file to keep things nicely compartmented. Kind of a toss-up to use the built in Smart form goodness or the extra overhead of Manuel’s, if the xhtml markup person needs to access the values in the form the built in Smarty functions are probably an easier route for them.

Over all am impressed with this Smarty business, it was super easy building the html files as I gave the templates an html extension instead of the default .tpl and colour coding, auto completion etc. works as expected in an any editor. It’s also super easy for the application/web site programmer to give the mark-up html access to change the Smarty variables where desired, or not. With all the plug in goodies available, flexible page caching features for busy web sites and ease of use for when designers or CEO’s want to change things this application is definitely part of my web site toolbox now.

,