XF 2.0 Global template variable in extra.css/less

_PkZ_

Active member
I am trying to add a global template variable in templater_global_data listener.
The variable is available in my templates, but it doesnt seem to work in extra.less using <xf:if...
Is it supposed to work in css too?

If not possible to get variables in css - is there a way to alter the body class from php in addon?
 
Last edited:
I believe you have to extend the CSS renderer to pass in additional parameters. Note that CSS is cached (both server side and client side), so the utility of conditionals is limited.
 
I believe you have to extend the CSS renderer to pass in additional parameters. Note that CSS is cached (both server side and client side), so the utility of conditionals is limited.
I see. So CSS conditions wont work that well i guess.
Any idea how to alter the <body> tags class? I mean like adding a new class to the body that i can later use as a selector in CSS.
 
You can edit the page container using a tertiary operator to add a class conditionally:
HTML:
<body class="{{ $foo ? 'bar' : '' }}">

You'd probably want to use a regex template modification to better retain compatibility with other add-ons which may do the same thing.
 
Back
Top Bottom