|
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 |
sushko Smarty Rookie
Joined: 14 Feb 2019 Posts: 5
|
Posted: Thu Feb 14, 2019 1:03 pm Post subject: dashed array key |
|
|
I have an array:
$activity = array("name" => "Challenge", "start-date" => "2019/02/14");
In order to output this variable, in the TPL file I put:
{$activity.start-date}
Unfortunately it does not work since Smarty engine interprets the hyphen as a minus sign.
Is there a way to output this array element anyhow without renaming it or copying the value to a different variable? |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Thu Feb 14, 2019 7:01 pm Post subject: |
|
|
I believe this works:
Code: | {$activity['start-date']} |
|
|
Back to top |
|
sushko Smarty Rookie
Joined: 14 Feb 2019 Posts: 5
|
Posted: Thu Feb 14, 2019 7:35 pm Post subject: |
|
|
That worked, thank you! |
|
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
|