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   970 Views

Avatar
Samba Sam

20 February 2010 at 1:38pm Community Member, 85 Posts

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

20 February 2010 at 2:03pm (Last edited: 22 February 2010 6:12pm), Forum Moderator, 5511 Posts

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

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

Avatar
banal

20 February 2010 at 8:22pm Community Member, 901 Posts

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

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

Avatar
Samba Sam

20 February 2010 at 8:42pm Community Member, 85 Posts

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