XF 2.1 Calling style properties for add-on in template modification isn't working

Brad Padgett

Well-known member
I've tried everything. I can't figure out where I went wrong.

For example. Let's say I wanted to call a background color style property with some inline CSS in a template mod.

basically like this.

<div style="background: {{ property('Property_Name') }}; ">

Property name being the unique identifier I gave my property. Is there another form I need to use?

What I understand is I can call the property value this way for any css property but it's not working in a PAGE_CONTAINER template modification. I'm using inline css.

It's also my understanding that I can use this to show the contents only when it's selected:

HTML:
<xf:if is="property('Property_Name') == 'Value'">
code that only shows when the radio button with the value you selected in format parameters is selected.

Basically (value=on)
</xf:if>

I know I'm doing something wrong. Do I need to use some other form where the main style property group is apart of it as well as the sub property? Is there another way because it's "inline" css?

What other forms should I be using? None of it works.
 
I figured out why all parts weren't working except for calling a style property inside inline css. The style I was editing had style properties changed aside from the master. Everything above is valid except for the inline css style properties. How can I call those?
 
Are you sure the property doesn’t already set background Prefix?

Check the F12 tools in your browser to see the style output.

Thank you for your reply @DragonByte Tech I figured it out. I had the property as a CSS background instead of color selected under value.

It's now working. I'm actually making a really nice theme chooser where you can set the style ids up to 9 times and enable/disable and even choose the color of the preview box. Also making a configurable light switch for a one-click to dark style. I plan to release it as a free add-on here once it's fully tested and ready. Anyways I figured it out thanks for responding though
 
Top Bottom