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

Issue with Smarty

 
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
tzak902
Smarty n00b


Joined: 28 May 2019
Posts: 2

PostPosted: Tue May 28, 2019 1:29 am    Post subject: Issue with Smarty Reply with quote

Hello,

I have Edited the OrderDetailController file and added a simple function to do some tests before implementing desired code:

Code:
public function SayHello (){
      $HelloWorld = "Hello World";
      $this->context->smarty->assign('HelloWorld' , $HelloWorld);
   }

and I added the following to my tpl file in my view:

Code:
<li><strong>Tracking#</strong> {$HelloWorld}</li>

All I'm getting is Undefined Index HelloWorld



Not sure what's the issue
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue May 28, 2019 4:52 am    Post subject: Reply with quote

You can't modify running template variables from outside.
This is done for security and consistency reasons.
Back to top
View user's profile Send private message
tzak902
Smarty n00b


Joined: 28 May 2019
Posts: 2

PostPosted: Tue May 28, 2019 3:29 pm    Post subject: Reply with quote

AnrDaemon wrote:
You can't modify running template variables from outside.
This is done for security and consistency reasons.


Ok, can you please tell me how to achieve the mentioned code
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu May 30, 2019 8:22 pm    Post subject: Reply with quote

Assign the variable before invoking the template.
https://www.smarty.net/docs/en/language.variables.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 -> 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