|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
danjfoley Smarty n00b
Joined: 20 Jun 2008 Posts: 4
|
Posted: Tue Oct 14, 2014 4:04 am Post subject: ob_start in smarty_internal_templatebase.php causing problem |
|
|
Hoping the developers read this.
So i have my own display and fetch functions that override smarts, they both simply add cache and compile id's to the call.
However one of my pages stops right at line 182 of smarty_internal_templatebase.php
the line is ob_start();
it doesn't throw and expection, toss any php error or anything. Just seems to stop processing of the function and return..
It's a display override.. which ends up calling the fetch override (as all displays are really fetches.. and then it just dies right there)..
Any ideas?
I have commented out the line and all appears to work well.. but it worries me to have done so. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Oct 15, 2014 12:32 am Post subject: |
|
|
How do your display() and fetch() functions look like? |
|
Back to top |
|
danjfoley Smarty n00b
Joined: 20 Jun 2008 Posts: 4
|
Posted: Mon Nov 10, 2014 4:11 pm Post subject: |
|
|
LIke this:
Code: | function display($var) {
if (SD_IS_MOBILE) {
return parent::display($var, "m","m");
} else {
return parent::display($var, "d","d");
}
}
function fetch($var) {
if (SD_IS_MOBILE) {
return parent::fetch($var, "m","m");
} else {
return parent::fetch($var, "d","d");
}
} |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Nov 10, 2014 10:41 pm Post subject: |
|
|
display() does call fetch( ) with setting the $display parameter true. Now you have overloaded the fetch() and the $display parameter is not handled any longer.
Your implemetation does also break correct variable scoping when using subtemplates.
Instead of overloading display() and fetch() do in the main script
Code: | if (SD_IS_MOBILE) {
$smarty->compile_id = 'm';
$smarty->cache_id = 'm';
} else {
$smarty->compile_id = 'd';
$smarty->cache_id = 'd';
}
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|