Assign a variable

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

Assign a variable

Post by Barrowboy »

Hi
Need some help with assigning one variable to another.

{assign var=AnyVariable value= Withmind}
{assign var=$AnyVariable value= $Withmind}

This is what I've tried but both fail.
Also tried $1 = $2

Can someone give me a working formula to transfer one variable to another. Does smarty come in somewhere.

Would like to put the code into UDT if poss.

A bit thick on this subject.

Thanks
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Assign a variable

Post by Rolf »

Don't forget the scope parameter, examples: http://www.cmscanbesimple.org/blog/smar ... e-examples
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Assign a variable

Post by velden »

Code: Select all

{assign var=AnyVariable value= Withmind}
{assign var=$AnyVariable value= $Withmind}

try:
{assign var=AnyVariable value=$Withmind}
or short:
{$AnyVariable=$Withmind}
Barrowboy
Forum Members
Forum Members
Posts: 223
Joined: Mon Dec 16, 2013 4:09 pm

Re: Assign a variable

Post by Barrowboy »

Hi
Thanks for your suggestions but still unable to get it working.

{assign var=AnyVariable value=$Withmind}
or short:
{$AnyVariable=$Withmind}

Trying your suggestions,
the var shows error T_Var and the other one errors with Evali.

Below is what I have tried and does not error but the result not correct.

$smarty->assign('temp' , $temp1);

I am trying just to copy one var to the other and this within a UDT and then just call the UDT in template.

No luck, it seems an easy thing to try but the formula is not correct.

Any further help would be appreciated.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Assign a variable

Post by Jeff »

You probably should post your whole template.

What is the UDT for? to do the assignment or something else?
Locked

Return to “The Lounge”