1. 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="" />?

Discussion in 'XenForo Development Discussions' started by CyberAP, Aug 10, 2016.

  1. CyberAP

    CyberAP Well-Known Member

    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?
  2. Mike

    Mike XenForo Developer Staff Member

    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.
    CyberAP likes this.
  3. CyberAP

    CyberAP Well-Known Member


Share This Page