Log in

View Full Version : How do I Add a Profile Field Selector to the Homepage?


davide101
03-25-2008, 10:20 PM
I have a column running down the right side of my forum homepage. I would like to have a profile variable that controls whether the user sees a 300px column or a 160px one. It's straightforward to create a variable and use a conditional to control this.

How do I let the user update the value from the right column of the homepage? I basically want a drop-down box that says "Narrow Layout" and "Wide Layout". When the user makes a selection, is there a way to use a Javascript onChange call to set the value? Or should I create a form that somehow reaches into the database and sets the value?

I really need guidance on the best way to approach this.

Please note that I don't want to use multiple styles to accomplish this. It leads to too much maintenance over the long run.

Dismounted
03-26-2008, 02:52 AM
You COULD use an onchange call, but then it'd lock out non-JS enabled users and wouldn't be remembered.

If you really wanted that drop-down box, you'd have to see how vBulletin does the style chooser and replicate it.

Have you tried using "child styles" to accomplish the task?

davide101
03-26-2008, 01:17 PM
Dismounted, I've tried using child styles, but I haven't been thrilled with how it alters my development process. Is there a way to create a new style "between" the parent and the child?

After a day of reflection, you're right that this is probably the best way to do it. In reality, it's only the footer that changes in the child style.

Can I just work on a copy of the parent style, download it, and then merge it back in with the original when I want to push it live? I'm assuming that for all different templates, vBulletin uses the content from the merged style?

Dismounted
03-27-2008, 01:48 AM
Export the parent style, and then work on the XML. Import it back, overwriting the current parent style, and the changes will be merged. You may need to revert templates that are different in the child styles to get the changes, then reapply the changes to the child styles.