smarty-php / smarty-php/smarty
custom compiler_class for sub-templates
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
I can change the source.compiler_class for a template but not for a sub-template that is included with {include}.
Smarty version: 4.2.0
The problem may be located in Smarty_Internal_Template
_subTemplateRender:
A new source is created here with the default compiler_class shortly before it is rendered.
Maybe at least it would make sense to set the compiler_class of the parent template with:
$tpl->source->compiler_class = $tpl->parent->source->compiler_class;
Or is there a solution to set the compiler class of sub-templates I am missing?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in libs/sysplugins/smarty_internal_template.php at _subTemplateRender, especially the linked lines where the sub-template source is created. Reproduce an include with a custom parent compiler_class and inspect how the sub-template receives its compiler class. Done means included sub-templates consistently honor the intended configured compiler class, with regression coverage if an existing test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100