|
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 |
kofi_kari_kari Smarty n00b
Joined: 06 Feb 2012 Posts: 2
|
Posted: Mon Feb 06, 2012 5:40 am Post subject: Changing variable between template |
|
|
Hi there!
I'm currently working on a smarty template "tree". I have a parent template that have children and grand children.
I created variables at the parent level and I can use them in the children and grand children template. However, when I change the value of the variables in the children or grand children template, the value doesn't change at the parent level.
Is there a mean of doing so? I would like to be able to change, in a children template, the value of a variable, created in a parent level, and to be able to use this changed value in the parent level.
I tried everything:
{assign var="foo" value="whatever" scope="global"}
{assign var="foo" value="whatever" scope="root"}
But it doesn't seem to work
Many thanks for your help. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Feb 06, 2012 7:29 pm Post subject: |
|
|
Do you use template inheritance, as you talk about parent and child templates?
Note that at template inheritace in the child templates everything outside {block}...{/block} tags is ignored. |
|
Back to top |
|
kofi_kari_kari Smarty n00b
Joined: 06 Feb 2012 Posts: 2
|
Posted: Tue Feb 07, 2012 9:53 pm Post subject: |
|
|
Thank you. I tried to use this features but it doesn't seem to solve my problem. I change the way I'm doing it. I use the variable in the php program and it work fine in smarty now.
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
|