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

variable template file names not allow within {block} tags
Goto page Previous  1, 2
 
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 -> General
View previous topic :: View next topic  
Author Message
U.Tews
Administrator


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

PostPosted: Mon Aug 04, 2014 5:50 pm    Post subject: Reply with quote

It does look like that "SIDEMENU" is used as array element of of a template variable, but it is not defined. I think it's not related to this topic.
Back to top
View user's profile Send private message
TilmP
Smarty Rookie


Joined: 04 Aug 2014
Posts: 8

PostPosted: Tue Aug 05, 2014 6:57 am    Post subject: Reply with quote

The only thing I changed in our webapp is that I exchanged Smarty 3.14 with Smarty 3.19. Using Smarty 3.14 all our integrated templates are working fine.

If (using 3.19) I comment out on page/smarty constructor the line:
#$this->inheritance_merge_compiled_includes = false;
I get other error message:

Exception: Syntax error in template "styles\default\templates\common\layout.html" on line 164 "{if $LAYOUT.HTML}{include "modules/{$TABS.ACTIVE}/{$LAYOUT.HTML}.html"}{/if}" variable template file names not allow within {block} tags

These are the related template lines:
163 {block name="body"}
164 {if $LAYOUT.HTML}{include "modules/{$TABS.ACTIVE}/{$LAYOUT.HTML}.html"}{/if}
165 {/block}

What has been changed within SMARTY environment that now causes these errors? What can I do to get rid of these errors and can update to Smarty 3.19? Thanks for the advices!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue Aug 05, 2014 7:51 pm    Post subject: Reply with quote

Do not comment out $this->inheritance_merge_compiled_includes = false;

The notice is caused by an access to an undefined array index. Somewhere you must have a variable access like

Code:
$FOO.SIDEMENU


Where FOO is a placeholder for some real variable which has array index SIDEMENU not defined.
Maybe it did not popup with 3.1.14 because you did suppress E_NOTICE errors in that enviroment?
Back to top
View user's profile Send private message
TilmP
Smarty Rookie


Joined: 04 Aug 2014
Posts: 8

PostPosted: Wed Aug 06, 2014 7:46 am    Post subject: Reply with quote

It's the same environment (only changing the used Smarty).

- Our development environment is XAMPP1.7.7/PHP5.3.8,
- Using Smarty 3.1.14, no issues, pages are generated stable,
- Exchanging 3.1.14 with 3.1.19 I receive these warning/errors:

a. (NOT setting $this->inheritance_merge_compiled_includes = false ).
Message: "Exception: Syntax error in template "styles\default\templates\common\layout.html" on line 164 "{if $LAYOUT.HTML}{include "modules/{$TABS.ACTIVE}/{$LAYOUT.HTML}.html"}{/if}" variable template file names not allow within {block} tags"

b. (setting $this->inheritance_merge_compiled_includes = false ).
Message:"PHP Notice: in file Smarty-3.1.19/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 86: Undefined index: SIDEMENU"

How can it happen that I see different behavior from the webapp if only the Smarty version changes?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Aug 06, 2014 5:27 pm    Post subject: Reply with quote

a.) Using variable file names within {block} tags could create the problem that when the filename was changed a wrong subtemplate got displayed.
For that reason this case is now catched by an error.
With $this->inheritance_merge_compiled_includes = false; this case can be handled. (See the inheritance release notes).

b.) This is a different problem. I currently have no idea why you did not see this notice in 3.1.14 unless your server has a different setting of the error reporting level.

It's caused by an arry variable which does use index 'SIDEMENU' which is not defined. Search for the usage of 'SIDEMENU' in your templates and make sure the the variable has that index defined.
Back to top
View user's profile Send private message
TilmP
Smarty Rookie


Joined: 04 Aug 2014
Posts: 8

PostPosted: Thu Aug 07, 2014 12:11 pm    Post subject: Reply with quote

- if I introduce "isset checks" like
{if isset($TABLEFILTER) && $TABLEFILTER} these segments are not complaint anymore. There seems to be introduced "code eval" into Smarty-3.1.19\sysplugins\smarty_internal_templatebase.php ?

- Smarty 3.14 seems to be more "tolarant" as of accepting if elements like
{if $LAYOUT.MODAL_DIALOG || $LAYOUT.MODAL_POPUP}

- The webapp based on SMARTY has been handed over to me with more than 300 templates (using inheritance)! I found more than 300 if elements to be taken care of ...

- If I plan to update to 3.19 what else (except for stricter checking) has to be considered for our webapp sources to successfully migrate from 3.14 -> 3.19?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Aug 07, 2014 2:36 pm    Post subject: Reply with quote

Nothing has changed on Smarty's error checking regarding the E_NOTICE messages.

It does look like that your server does not use the default settings like

E_ALL & ~E_NOTICE which does suppress the E_NOTICE messages.
See http://de2.php.net/manual/de/errorfunc.configuration.php#ini.error-reporting

You can change this in php.ini

Or set in your script
Code:
$smarty->error_reporting = E_ALL & ~E_NOTICE;


See http://www.smarty.net/docs/en/variable.error.reporting.tpl
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 -> General All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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