- smarty plugins
Important note: this plugin goes directly against Smarty's best practices. I think there are cases when it is useful to do so, even though the its developers disagree. So beware, using this plugin may ruin your sense of right and wrong in software design. This may be a better approach.
This plugin allows one to use a SQL SELECT statement as a for-loop. One could, for example, view the contents of a database table of an inventory with this piece of Smarty template:
This requires, of course, an existing database. Its details are specified as properties of the smarty object. For example:
There code is database-specific and currently there is are versions for MySQL and SQLite. Download one of them and save it into your smarty plugins directory with filename block.forsql.php and you're set: