Given a Category (parent) and Product (child) tables in a database, say, I want to create Smarty Block Plugins that would enable template snippets similar to this:
{products category="Some Category"}
<h1>{products_name}</h2>
<p>{products_description}</p>
{/products}
I believe plugins like these would help avoid repeated chunks of code that read a database and do a smarty-assign on the result in my controller.
I know how to write this as a smarty function. But I am looking for a block version to give the template designer the flexibility to style the individual columns in whatever way he wants. I am a long-time Perl programmer and new to Smarty. Perl users will recognise something like this in the Movable Type Templating System for example, and I wonder if a smarty version is possible.
Is something like this possible in Smarty at all? Is it a good thing to make a DB call from inside a smarty plugin?