Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Appending .px to template variable


Reply


4 Posts   1003 Views

Avatar
Samba Sam

Community Member, 85 Posts

20 February 2010 at 1:38pm

Hi,
How would I append to .px to a template variable.

For example,

This in the template
<div id="FlashContainer" style="margin:$TopMargin.px 0 0 $LeftMargin.px">

returns
<div id="FlashContainer" style="margin: 0 0 ">

How do I add .px to the end of $TopMargin or $LeftMargin so that I get something like:
<div id="FlashContainer" style="margin:300.px 0 0 400.px">

Thanks in advance,
Sam

Avatar
Willr

Forum Moderator, 5513 Posts

20 February 2010 at 2:03pm

Edited: 22/02/2010 6:12pm

You need to escape the variable like {$Var}px

Edit - Woops, had a dot after the }. Thanks banal

Avatar
banal

Community Member, 901 Posts

20 February 2010 at 8:22pm

Yes, what Will said, but skip the dot ;)
Like this:

"margin: {$TopMargin}px 0 0 {$LeftMargin}px;"

Avatar
Samba Sam

Community Member, 85 Posts

20 February 2010 at 8:42pm

Thanks Guys. It works!

For some strange reason I added an unnecessary period in front of the px in my original post.
Don't need it.

Cheers,
Sam