smarty-php / smarty-php/smarty
"Invalid compiled template for...." only on first load with caching enabled [Smarty 3.1.40]
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Smarty throws exception when I include the same template with the same cache_id more than once in one page. I am trying to display the same cached product card in the main menu and then later in slider again. It happens only on first load when cache is building. After reload it works.
exception
SmartyException
#message: "Invalid compiled template for 'file:product-card.tpl'"
settings
$marty->caching = 1;
$marty->compile_check = false;
$marty->force_compile = false;
home.tpl
{include file="menu.tpl"}
<div id="slider">
<div class="item">
{include file="product-card.tpl" cache_id="product|1"}
</div>
</div>
menu.tpl
<ul>
<li>Home</li>
<li>About us</li>
<li>Newest product:
{include file="product-card.tpl" cache_id="product|1"}
</li>
</ul>
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
Reproduce the first-load failure using home.tpl and menu.tpl with caching enabled, compile_check and force_compile disabled, and the repeated product-card.tpl cache_id="product|1" includes. Trace the compiled-template handling during cache creation; done means the first request renders both product cards without the Invalid compiled template exception and subsequent reloads still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100