• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Pass a variable to <xen:require css="" />?

CyberAP

Well-known member
#1
It is possible to pass a variable into <xen:require css="" /> statement?

For example in CSS template I have something like this:

.selector { width: {$myVar}px; }

In container template I would like to have something like this:

<xen:require css="my.css"><xen:set var="$myVar" value="50" /></xen:require>

It works with <xen:include /> but it does not with <xen:require />. Maybe there is a proper way of doing it?
 

Mike

XenForo developer
Staff member
#2
You can't access dynamic variables in CSS like that. You would either need to inline the CSS or consider using CSS attr()'s, though there's limits with what you can do.