Skip to content
Discussion options

You must be logged in to vote

Thanks @wisskid, I came to the same conclusion when going over the implementation again : as a custom Class Object is registered as the resource handler, the DB-query result can be passed as Dependency 👍 This also allows me to assign the Template information retrieved to both, my PHP app and Smarty Vars.

My concern was not really on performance, but more from an architectural standpoint; I find it confusing when same queries are executed in different parts.

The solution, abstracted for example purpose, looks something like this:

<?php
use Smarty\Resource\CustomPlugin;

class DbTemplateResource extends CustomPlugin
{
    protected string $tplsource;
    protected integer $tpltimestamp;

    …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@oliveratgithub
Comment options

Answer selected by oliveratgithub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants