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

Variables with minus char

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
peregrin
Smarty n00b


Joined: 16 Apr 2007
Posts: 1

PostPosted: Mon Apr 16, 2007 8:47 am    Post subject: Variables with minus char Reply with quote

PHP
Code:

$test['var-with-minus'] = 'testvar';
$this->assign('test',$test);


Template:
Code:
{$test.var-with-minus}


This return '0'

Compile file contain:
Code:
<?php echo $this->_tpl_vars['test']['var']-$this->_tpl_vars['ith']-$this->_tpl_vars['inus']; ?>


And:
Code:

$test['var-with-minus'] = 'testvar';
$this->assign('test',$test);
$this->assign('inus',100);
$this->assign('ith',-7);


Return: -93
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 17, 2007 3:31 pm    Post subject: Reply with quote

Hi. Thanks for taking the time to submit this but this a feature request rather than a bug. Key names must follow var name conventions if you want to access them lexically.

The workaround is to rename your incoming keys or to use temporary assignments in your template to represent unusuable keynames. Finally, you can consider a custom modifier such as the "lookup" modifier (search the forums) or something more radical like the "from" modifier (also search the forums).
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 -> Feature Requests 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