Log in

View Full Version : Maintaining two closely related style options


tobias_t
04-10-2007, 09:51 PM
This is kind of hard to sum up just in the headline.

My forum offers two style options to the users. The only difference is the font color.

I didn't want to do all manual template edits in both styles all the time, so for a while I have only made changes to the default style and disregarded the other one (knowing that few people are even aware of this option).

Now I want to get both styles on the same level again. My idea is to duplicate the current version of the default style and edit its font color, and replace the old alternate style with it (by giving it the same name).

Basically, I want to make sure that the new style ends up with the same ID as the old one, or at least automatically falls into place for people who had selected the previous alternate style.

I hope this was not too hard to follow, and that somebody can help me out with this.

Thanks, Tobias

magnus
04-10-2007, 10:06 PM
Rather than having and maintaining 2 separate styles, why not just create a user option to select the font color then display proper font color using conditionals?

I may be missing something, but it seems to me you're going around the block to get next door..

WetWired
04-10-2007, 10:07 PM
Export your existing style with all the template mods.
Import it, making it non-selectable.
Make your two styles children of your new parent style based on your good style.
Revert all templates in the child styles that don't need to be different between them.
Make all future template edits to the parent style.

tobias_t
04-10-2007, 10:12 PM
Rather than having and maintaining 2 separate styles, why not just create a user option to select the font color then display proper font color using conditionals?

I may be missing something, but it seems to me you're going around the block to get next door..

How would you do this, and where would this option show up for users?

magnus
04-10-2007, 10:21 PM
AdminCP > User Profile Fields > Add New User Profile Field

Profile Field Type: Single-Selection Menu
Title: Font Color
Description: Select the color you would like the font displayed in.
Options:
(Whatever your colors are, separated by a carriage return)
Set Default: Yes, but No First Blank Option
Field Searchable on Members List: No
Show on Members List: No

Save.


Now, in the User Profile Manager you will see your new profile field listed. Under the "name" column, you'll see a field number (ie. field12). Find (and note) the field number for the field you added.

Now, I don't know how you currently implement your font colors -- whether you hardcoded <font>, <span>, etc. tags or if you're doing it via CSS (which is preferred) -- but you can then simply add the conditional:

<if condition="$bbuserinfo[fieldXX] == 'Red'">font-color: #AAAAAA;<else />font-color: #BBBBBB;</if>

Modify that however you see fit, but that's the gist of it.

Users would then be able to select it in their UserCP under Profile Options. New users would be asked during registration as well.

DiSpy
04-11-2007, 01:38 PM
Is there a way to modify this so that a user can set his/her own custom font/color/size, that it defaults to whenever they make a post, in thier cp?

magnus
04-11-2007, 01:57 PM
Yes. Just create more custom fields to your liking and call $bbuserinfo[fieldXX] where necessary.