Smarty

Problems, solutions and everything in between.
Latest entries

Passing variables when building addons for GEOCore Classifieds - geoTemplate::loadInternalTemplate

A little gotcha I just come across when building an addon for GEOCore Classifieds was handling variables passed into a a .tpl file. I'm going to assume you have an addon already set up. Below is the code to display "Hello" followed by a name. function display_hello($params, $smarty){ $tpl_vars = array(); // Define a blank array (can be variable) $tpl_vars['name'] = 'Chris'; $tpl_vars['weather'] = 'Cold'; return geoTemplate::loadInternalTemplate($params, $smarty, 'name.tpl', geoTemplate::ADDON,…

Dump all variables available in Smarty with {debug}

I've been developing a classifieds system which is built with the Smarty templating system, I've never used Smarty before so I'm learning on the fly, a simple technique I've been using is to dump all the variables I have available to me with {debug}. {debug} Note: Your browser may block popups as default and it will look like nothing is happening, you'll need to allow popups from your URL