View Full Version : is there a way to put a description in the theme chooser rather than the current ?
is there a way to put a description in the theme chooser rather than the current theme ?
The dropdown I have (optgroup label tag), is appearing as second entry in a dropdown list ($vbphrase[quick_style_chooser]) . I want it to be the first entry instead of the actual theme.
Is it possible?
Lynne
04-10-2009, 03:00 PM
I don't understand what you want. Do you have an image to show what you want?
See attachement. I took screenshot of vbulletin.com board itself at the bottom of topic lists.
By default, the name of the current running theme is shown on the box, when you click for scroll the legend of the box only appear as the second item. I want the contrary of this, I want the legend to be the selector title and the list of the available items showing next.
thanks.
Lynne
04-10-2009, 03:47 PM
Hmmm, if the selected style is "vBulletin 3 White Liquid", then that is what is going to show in the dropdown box. That is the way that element works in a form. If you don't want it to show the selected item, I suppose you could try modifying the option template to not show it. However, that template gets used in many places. So, perhaps you should just modify the code itself to not show selected="selected"
Hmmm, if the selected style is "vBulletin 3 White Liquid", then that is what is going to show in the dropdown box. That is the way that element works in a form. If you don't want it to show the selected item, I suppose you could try modifying the option template to not show it. However, that template gets used in many places. So, perhaps you should just modify the code itself to not show selected="selected"
I can only see $quickchooserbits as the option display in templates.
If I go deeper, I can see it declared in global.php:
if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))
{
$stylecount = 0;
$quickchooserbits = construct_style_options(-1, '--', true, true);
$show['quickchooser'] = ($stylecount > 1 ? true : false);
unset($stylecount);
}
else
{
$show['quickchooser'] = false;
}
it been build by the function construct_style_options, your 'selected' tag is called in includes/functions.php. So I tried to duplicate the function to my own personnal customization :
// myfunctions.php
function construct_style_options_myf($styleid = -1, $depthmark = '', $init = true, $quickchooser = false)
{
global $vbulletin, $stylevar, $vbphrase, $stylecount;
$thisstyleid = iif($quickchooser, $vbulletin->userinfo['styleid'], $vbulletin->userinfo['realstyleid']);
if ($thisstyleid == 0 AND $quickchooser)
{
$thisstyleid = $vbulletin->options['styleid'];
}
// initialize various vars
if ($init)
{
$stylesetlist = '';
// set the user's 'real style id'
if (!isset($vbulletin->userinfo['realstyleid']))
{
$vbulletin->userinfo['realstyleid'] = $vbulletin->userinfo['styleid'];
}
if (!$quickchooser)
{
if ($thisstyleid == 0)
{
//$optionselected = 'selected="selected"';
}
$optionvalue = 0;
$optiontitle = $vbphrase['use_forum_default'];
eval ('$stylesetlist .= "' . fetch_template('option') . '";');
}
}
// check to see that the current styleid exists
// and workaround a very very odd bug (#2079)
if (is_array($vbulletin->stylecache["$styleid"]))
{
$cache =& $vbulletin->stylecache["$styleid"];
}
else if (is_array($vbulletin->stylecache[$styleid]))
{
$cache =& $vbulletin->stylecache[$styleid];
}
else
{
return;
}
// loop through the stylecache to get results
foreach ($cache AS $x)
{
foreach ($x AS $style)
{
if ($style['userselect'] OR $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
{
$stylecount++;
if ($thisstyleid == $style['styleid'])
{
// $optionselected = 'selected="selected"';
}
else
{
$optionselected = '';
}
$optionvalue = $style['styleid'];
$optiontitle = $depthmark . ' ' . $style['title'];
eval ('$stylesetlist .= "' . fetch_template('option') . '";');
$stylesetlist .= construct_style_options($style['styleid'], $depthmark . '--', false, $quickchooser);
}
else
{
$stylesetlist .= construct_style_options($style['styleid'], $depthmark, false, $quickchooser);
}
}
}
return $stylesetlist;
}
I commented out where the 'selected' are declared.
then on my php module where I build my $quickchooserbits = construct_style_options_myf(-1, '--', true, true);
I still get a dropdown list where the legend appear when you click on it. I'm weak in php programmation, I still don't see why it doesn't work.
I also noticed that these option tags are nested in a optgroup tag, WHICH contain the label that generate the quick_style_chooser phrase legend. I can remove it, but I won't have any legends in the selector.
Lynne
04-10-2009, 07:48 PM
Are you simply saying you don't want it to say Quick Style Chooser in the dropdown? Or are you saying you want it to say Quick Style Chooser at the top of the dropdown list (and not the actual style)? I am still totally unclear on what you want.
Or are you saying you want it to say Quick Style Chooser at the top of the dropdown list (and not the actual style)?
^This.
I want the selector to show the legend on top of the list rather than the actual theme running under the user. When the user click on the selector, or the legend, the dropdown options are the themes available.
I almost done it. I had to do is to add an empty <option> tag with the vbphrase in it. It showing first like I tried to described, the only problem is it selectable, I wish it wasn't selectable like the original legend when it was placed second. But that's in Firefox, in IE, the selected theme still appear first.
<select class="forumselector" name="newstyleset" id="sel_newstyleset" onchange="switch_id(this, 'style')">
<optgroup>
<option><?= echo $vbphrase[quick_style_chooser] ?> </option>
<?php echo $quickchooserbits ?>
</optgroup>
</select>
Lynne
04-10-2009, 08:14 PM
Basically, you want to change it from this (sample):
<optgroup label="Quick Style Chooser">
<option value="2" class="" >-- vBulletin Default</option>
<option value="30" class="" selected="selected">---- Testing</option>
<option value="28" class="" >-- Mobile, Cell, Phone, PDA, iPhone Style</option>
</optgroup>
To this:
<option value="" class="" >Quick Style Chooser</option>
<option value="2" class="" >-- vBulletin Default</option>
<option value="30" class="" >---- Testing</option>
<option value="28" class="" >-- Mobile, Cell, Phone, PDA, iPhone Style</option>
Got rid of the optgroup, the selected statement, and added the Quick Style as a blank value as first in the option list.
it almost working :)
I need to get rid of the 'selected' popup. When users come in the page it still show the current running theme first, the legend second.
I tried to commenting out the $optionselected = 'selected="selected"'; in my myfunctions.php (see my code above) and it still have a selected theme as default showing.
<select class="forumselector" name="newstyleset" id="sel_newstyleset" onchange="switch_id(this, 'style')">
<option value="" selected="selected" disabled="disabled" ><?php echo $vbphrase[quick_style_chooser]; ?> </option>
<?php echo $quickchooserbits; ?>
</select>
Lynne
04-10-2009, 08:35 PM
You changed the lines in global.php to your new function where $quickchooserbits is defined?
You changed the lines in global.php to your new function where $quickchooserbits is defined?
everythings is defined properly, but from the code above, I am doing it wrong.
I almost found the culprit. $stylesetlist hold the selected="selected" value. It collect it html values from fetch_template('option').
Where fetch_template('option') is defined? where 'option' is defined? which file it came from?
if I echo fetch_template('option'); it return this php/html code:
<option value=\"$optionvalue\" class=\"$optionclass\" $optionselected>$optiontitle</option>
Lynne
04-10-2009, 11:03 PM
Where fetch_template('option') is defined? where 'option' is defined? which file it came from?
That is saying, fetch the template named "option". The "option" template is with all your other templates. So, right before evaling that template, just set $optionselected to '' .
ok now I know why it wasn't working,
it was the
$stylesetlist .= construct_style_options($style['styleid'], $depthmark . '--', false, $quickchooser);
in the if line, it wasn't renamed construct_style_options_myf. I totally didn't know a function could be expressed in the function itself.
I renamed it properly and now it working, I got quick style chooser as the first item :)
both IE and FF.
Not entirely the way I wanted, sometime it still show innapropriately because of maybe cookies, or maybe there's HTML limitations.
And browser compatibilities also play: in FF, disabled="disabled" work, the item is unselectable and greyed out, whereas IE it still selectable and plain color.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.