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   1020 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
baba-papa

7 March 2010 at 5:12am (Last edited: 7 March 2010 5:13am), Community Member, 279 Posts

<div id="FlashContainer" style="margin:{$TopMargin}px 0 0 {$LeftMargin}px">

Don´t let anyone change CSS via the backend, this will blow up in your face sooner or later.

Avatar
lerni

7 March 2010 at 7:02am Community Member, 80 Posts

hi

i guess the issue is solved with {$x}px.

but baba-papa ok there are pros & contras for controlling styles trough the cms - what is best practice if you do? would you make inline styles in the template? how do you actually use $vars in the css files?

luk

Avatar
baba-papa

7 March 2010 at 8:19pm Community Member, 279 Posts

Usualy customers are the ones that work with the backend. As they do not know much about css or browser bugs they should not interact with css.