Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

ob_start in smarty_internal_templatebase.php causing problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
danjfoley
Smarty n00b


Joined: 20 Jun 2008
Posts: 4

PostPosted: Tue Oct 14, 2014 4:04 am    Post subject: ob_start in smarty_internal_templatebase.php causing problem Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Oct 15, 2014 12:32 am    Post subject: Reply with quote

How do your display() and fetch() functions look like?
Back to top
View user's profile Send private message
danjfoley
Smarty n00b


Joined: 20 Jun 2008
Posts: 4

PostPosted: Mon Nov 10, 2014 4:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Nov 10, 2014 10:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP