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

Smarty 3 RC3 released
Goto page Previous  1, 2, 3
 
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 3
View previous topic :: View next topic  
Author Message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Aug 23, 2010 12:48 pm    Post subject: Reply with quote

{extends} must always be the first line of a template file, so you can't decide if a template extends another template or not. Either it does or it doesn't.
Back to top
View user's profile Send private message Visit poster's website
Vultapher
Smarty n00b


Joined: 20 Aug 2010
Posts: 3

PostPosted: Mon Aug 23, 2010 3:22 pm    Post subject: Reply with quote

Vultapher wrote:
Huh yea, didn't think about that. Thanks Smile
Correction: This does not work, it looks like one can't pass the output to the modifier, Smarty throws a syntax error.
We tried
Code:
{html_select_date <parameters> |utf8_encode}
and some other variations, with the same results.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Mon Aug 23, 2010 4:31 pm    Post subject: Reply with quote

The modifier must be attached directly to the tag name.

Code:
{html_select_date|utf8_encode  <parameters>}
Back to top
View user's profile Send private message
mayco
Smarty n00b


Joined: 03 Sep 2010
Posts: 1

PostPosted: Fri Sep 03, 2010 2:25 pm    Post subject: Reply with quote

I'm having issues to load the variable that is specified in a {include tag

I have this code in a template

customer_view.tpl
Code:

{include file="header.tpl" currentPage="customer_search.php"}


header.tpl
Code:

This works: {$currentPage}
{php}

$tmp = $smarty->getTemplateVars('currentPage');

print_r($tmp); // This doesn't work

{/php}


$tmp seems to be a Undefined_Smarty_Variable Object ( )

I also tried the $smarty->getVariable();

I also noticed that i had to use $smarty instead of $this. When i use $this, i get the following message:

Fatal error: Using $this when not in object context in /home/x/smarty3svn/Smarty3Dev/distribution/libs/plugins/block.php.php(24) : eval()'d code on line 10
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Sep 03, 2010 2:50 pm    Post subject: Reply with quote

you are trying to access a local var. I'm not sure how that works internally, Uwe may chime in.

Of course the real question, why use the deprecated {php} tag for anything. It should be avoided, and there is always a better way.
Back to top
View user's profile Send private message Visit poster's website
ziege
Smarty Rookie


Joined: 16 Aug 2005
Posts: 13

PostPosted: Sat Sep 04, 2010 12:32 pm    Post subject: Reply with quote

I think I have an issue too (or a missing point in the Smarty2 BC Notes):

I work with several includes, in one a variable named "tmp" is set.

But when I use

{counter start=0 assign=tmp}

later on in another include, the "tmp" variable is not overwritten.

I printed out the value of "tmp" before and after the {counter...} call, and it's the same old value (which was set in the other include) in both cases.

I fixed it by replacing {counter...} with {assign...} (in this case I can overwrite the variable "tmp").
Back to top
View user's profile Send private message
ziege
Smarty Rookie


Joined: 16 Aug 2005
Posts: 13

PostPosted: Sat Sep 04, 2010 2:14 pm    Post subject: Reply with quote

Another issue:

I got the following error

Quote:
Syntax Error in template "C:/Apache2/htdocs/xxx.tpl" on line 3 "{/strip}" - Unexpected "{/strip}", expected one of: "comment" , "PHP start tag" , "PHP end tag" , ASPSTARTTAG , ASPENDTAG , "Fake PHP start tag" , XMLTAG , "text" , "newline" , "Literal start" , "{" , LDELIF , LDELFOR , LDELFOREACH , "closing tag"

for the following (uncommon but correct) template:

Code:
{strip}

{/strip}
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Tue Sep 07, 2010 4:53 pm    Post subject: Reply with quote

{counter} and {cycle} plugins did not use the correct scope when assigning results.

Templates containing just {strip} and {/strip} tags did produce an error.

The fixes are in the SVN now.
Back to top
View user's profile Send private message
vorapoap
Smarty Rookie


Joined: 22 Dec 2009
Posts: 32

PostPosted: Thu Sep 09, 2010 7:14 am    Post subject: gettext? Reply with quote

Any plan to incorporate gettext into Smarty Core?
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 3 All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
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