Log in

View Full Version : conditional custom css in specific forum


fxdigi-cash
09-13-2013, 12:53 AM
Hi,

I was trying to create a custom css for each forum when a specific forum is displayed by user.

This is what i've done do far:


<vb:if condition="$forumid == 135">
<style type="text/css">
.style {background: #ff0000; color:#fff}
</style>
</vb:if>


Then I decided to change that since it didn't work to a multiple conditional style to see whether it works that way or not:


<if condition="$forum[forumid] == 135">
<style type="text/css">
.style {background: #ff0000; color:#fff}
</style>
<vb:elseif condition="$forum[forumid] == 141">
<style type="text/css">
.style {background: #000; color:#fff}
</style>
<vb:elseif condition="$forum[forumid] == 160">
<style type="text/css">
.style {background: #000; color:#fff}
</style>
</vb:if>


after many tried, it still doesn't work :confused: something weird in here...

any idea what wrong in here and how to do the right coding??

Thanks

tbworld
09-13-2013, 01:26 AM
Post a couple of lines of template code where you are inserting class 'style'.

It probably is not a problem, but I would stay away from using "style" as a CSS selector.

Zachery
09-13-2013, 02:00 AM
Just do individual statements, also, try using $GLOBALS[forumid]

fxdigi-cash
09-13-2013, 02:13 AM
Post a couple of lines of template code where you are inserting class 'style'.

It probably is not a problem, but I would stay away from using "style" as a CSS selector.

I used this codes on af_articlebit in the article forum mod. I don't know if I did the right thing or not, but possibly the location where I used it is not correct, maybe. :o

ok, assume I'm a dump and know nothing, how and where can I insert this code? do I have to create a plugin or just insert the code somewhere in the headinclude template or somewhere else.

Thanks

--------------- Added 1379045978 at 1379045978 ---------------

Just do individual statements, also, try using $GLOBALS[forumid]

Hi Zachery,

Thanks for the comments. however, do you mean like this:



<vb:if condition="$GLOBALS[forumid] == 140">
<style type="text/css">
.style {background: #ff0000; color:#fff}
</style>
</vb:if>


should I insert that in any template or headinclude template... I'm using the forum article by the way.

Thanks