View Full Version : [release] Dynamic Style Set Dropdown
filburt1
11-01-2002, 10:00 PM
Author: filburt1
Description: Chen's style set dropdown hack, extended description below.
Demo: None yet
Screenshot: http://www.vbulletintemplates.com/mods/attachment.php?s=&postid=14502
Be sure to apply this mod to every template set you have! Otherwise the dropdown will disappear when you change style sets.
This is Chen's style dropdown without hacking. Unlike the style set dropdown mod released here, it doesn't require updating the code each time a style set is added/deleted. The tradeoff is that it adds one query to forumhome.
Unlike Chen's hack, this will not show how many people are using each style set (would mean more queries). But, just like his, this does not update your user CP style set, it only cookies you with a new style set.
filburt1
11-02-2002, 03:43 PM
Screenshot:
Breaker
11-02-2002, 03:51 PM
I've been looking for this for about 2months i had to create in manually :D
filburt1
11-02-2002, 03:52 PM
I did it in an hour :p
LiL pImPsTeR
11-02-2002, 08:32 PM
theres already a hack like this, but u did it very very differentlly :)
filburt1
11-02-2002, 08:34 PM
I know there's a hack but the point is that this doesn't require hacking.
Unless you're talking about the existing template mod here which I already said how this one is far superi--I mean, different--than that one ;)
Tony G
11-02-2002, 10:06 PM
The one released before this one here needed manual updating of the dropdown. The hack is like this one but requires file hacking. This mod does the same thing but only via template modifying.
Hope that helps. Nice mod. :)
Obi-Wan
11-03-2002, 02:15 PM
Nice job m8
Smoothie
11-04-2002, 01:09 AM
Just saved 1 query on forumhome by using this instead of Chens style dropdown hack
filburt1
11-04-2002, 01:10 AM
Well the extra query Chen probably used would be for the user table to find out how many people were using the style set...:)
imported_cono
11-04-2002, 01:19 AM
great template mod! thanks.
Smoothie
11-04-2002, 01:29 AM
Bit of a pain to change over, but works well, and I'm 1 less query then before.
stark427
11-15-2002, 12:48 AM
another great hack Filburt :)
*clicks install*
stark427
11-15-2002, 01:00 PM
Filburt
How could I make the combo box to change styles with a button next to it, and not automaticaly?
I mean - I would like the combo box to only be used for selecting the style and a button on the right with which you apply the change...
how can this be done? :)
thanx in advance
filburt1
11-15-2002, 02:24 PM
Untested but try replacing $styledropdown on forumhome with:
$styledropdown <input type="button" value="Go"
onClick="window.location = 'index.php?s=$session[sessionhash]&styleid='
+ document.newstyleid.value">
Then in phpinclude get rid of the onChange=\"window.location='index.php?s=$shash&styleid=' + this.value\".
stark427
11-15-2002, 02:51 PM
A Run Time error :
when I press Go:
filburt1
11-15-2002, 02:54 PM
Maybe document.all['newstyleid'] instead of document.newstyleid?
stark427
11-15-2002, 03:00 PM
Yeah :)
It seems that it works ok now :)
Something more: (please don't shoot me...)
Is there a way I can make the GO button smaller?
Or even better instead of this common GO button I would like to use another one... like this :
http://www.synthpopavenue.gr/eimages/go.gif
u know a gif I have... that goes better with my styles...
thanx anyway
filburt1
11-15-2002, 03:02 PM
Try:
$styledropdown <a href="javascript:window.location =
'index.php?s=$session[sessionhash]&styleid='
+ document.all['newstyleid'].value">
<img src="images/go.gif" border="0" align="absmiddle"></a>
stark427
11-15-2002, 03:11 PM
Thanx
problem inow s that although it works with IE... and everything is fine... there are 2 probs with netscape:
1) The button does not work at all. You press it - it does not do anything.
2) The button seems to be wrongly aligned - its lower that what it should be
look at the screenshot
filburt1
11-15-2002, 03:12 PM
1. document.all only works in IE ;)
2. absmiddle just never works in NS
stark427
11-15-2002, 03:17 PM
thanx again
I guess i will have to go with the standard GO button...
But is there a way to make it at least "smaller?
filburt1
11-15-2002, 03:18 PM
Smaller?
The image is just vB's go button.
stark427
11-15-2002, 03:21 PM
I meant the initial GO button - shown with this code:
$styledropdown <input type="button" value="Go"
onClick="window.location = 'index.php?s=$session[sessionhash]&styleid='
+ document.all['newstyleid'].value">
stark427
11-15-2002, 11:22 PM
Filburt.
I'd like the combo box to have as default text the "choose style"...
instead of a style name...
so when a guest or a member sees the board, the thing he sees in the box is *not* a style name, but the text "choose style"
can we do this?
stark427
11-15-2002, 11:31 PM
The reason why I'm asking for this is because ....
I had 3 styles. (for example)
1) Blue (default)
2) Emerge
3) Dark
Now after I installed the dropdown box, I changed the default style.
Actually what I wanted to do was to make the Emerge default - but without deleting/overwriting the Blue (ex-default).
So I did this:
I created a new style called Default2. I pointed it to take the templates and replacements of the Blue style.
Then I went to the Blue style and pointed it to take the Emerge templates and replacements.
Then I renamed the Blue to "Emerge"
and I renamed the Default2 to Blue...
this way the default now is the Emerge ;)
But there is a small bug...
Lets say that I'm logged in. And I have chosen the Emerge (default) style on the combo box....
Then I loggout. Now (here is the bug) the style of the board is still the Emerge (because it is now the default one), but in the combo box the "blue" is shown!!!!!
Can you figure out why this happens?
It seems like the combo box has kept as default style the blue? or somthing like that...
Clearing the cookies did not help.
Im thinking of 2 solutions
1) Uninstalling the combo box and reinstall it.
or
2) Making the combo to always display a non-selectable text "choose style"
will any of these solutions work?
thanx in advance
I will appreciate it if you look into this
stark427
11-15-2002, 11:54 PM
I did this:
I disabled the (new) Blue.
Now when I log out, the Dark is shown in the combo box... although I have the Emerge on the board...
I enabled again the Blue and renamed it to WBlue
then I logged out...
Now the Dark is again in the box, athough the board is no the Emerge style. And the Wblue is last on the box...
So maybe afte all the combo box juts displays the styles alphabeticaly?!! ??
maybe this is why a logged out user sees in the box the Blue as first style ? :confused:
filburt1
11-15-2002, 11:58 PM
No idea why it's doing that, the only thing that will change across users is which one is initially selected. The contents of the dropdown will always be identical.
stark427
11-16-2002, 12:01 AM
When a user is logged out.... from where does the combo take the style that it shows as first?
does it just display the styles alphabetically?
$result = mysql_query("SELECT styleid,title FROM style WHERE userselect=1 ORDER BY title");
doesn't this ORDER BY title mean that it shows the styles by alphabetical order for a guest?
stark427
11-16-2002, 12:15 AM
Here is what I did:
I renamed my styles like this:
1. Emerge
2. Blue
3. Dark
Now when I'm a guest... the 1.Emerge is shown on the combo (as it should)
and the other come sorted by the number...
so it has to be that the combo box displays the styles alphabetically... and not according to which is the default....
just my 2 cents - I might be wrong...
filburt1
11-16-2002, 12:17 AM
No offense but I think you are. The query will always return an alphabetical listing of style sets and their ids.
Run the query in PMA or the MySQL console and you'll see what phpinclude is getting and parsing to create the dropdown.
stark427
11-16-2002, 12:21 AM
No offense at all by me :)
I appreciate it that you sit here and help me on this... but I admit that now I'm even more confused...
Originally posted by filburt1
The query will always return an alphabetical listing of style sets and their ids.
what does this mean? That it displays the styles according to their IDs or according to the first letter? (alphabetically)...
sorry but my English is not so good so I dont easily understand :(
filburt1
11-16-2002, 12:26 AM
It sorts it by title alphabetically, but it probably would get confused by different case (i.e., uppercase and lowercase) and sort them differently.
stark427
11-16-2002, 12:45 AM
Ok.
The "thing" in my case is that I cannot really reproduce the... problem...
because back when I had the "Blue" as default... it would be displayed first *anyway* because the name starts with "b" which is a letter alphabeticaly first in the order than D and E.
But what I have done is that I placed those numbers in front of the style names... so I guess now I'm ok...
thanx for the support Filburt
I really appreciate it.
alkatraz
11-17-2002, 05:35 AM
works great thx!
I added it to my header though so it can be changed on any page. =)
Zehlek
11-18-2002, 12:06 AM
Thanks a lot Now me and my members don't have to go into my usercp whenever I put in a new style to view it.
filburt1
11-18-2002, 12:16 AM
They really should though because this is just a cheap hack. Updating your User CP pref will always stick, this will not.
kj187
11-19-2002, 10:52 AM
Great
Gibts in addition one chop where one on a new side to see can which
user of which Style benuzt??
Gibts dazu einen Hack wo man auf einer neuen Seite sehen kann welcher User Welches Style benuzt ??
filburt1
11-19-2002, 02:27 PM
English?
stark427
11-20-2002, 12:52 AM
Originally posted by stark427
Filburt.
I'd like the combo box to have as default text (unselectable) the text "choose style"...
instead of a style name...
so when a guest or a member sees the board, the thing he sees in the box is *not* a style name, but the text "choose style"
can we do this?
Filburt
do you think we could do this? :)
filburt1
11-20-2002, 01:37 AM
Yes, but not today :)
stark427
11-20-2002, 09:20 AM
Ok whenever you can :D
filburt1
11-20-2002, 01:17 PM
Okay, this is untested but should do it:
imported_Mathiau
11-20-2002, 04:02 PM
Is it possible to have a "preview" of the colors?
Almost as said make a button to press - but have another option which will link to a img that the person has placed somewhere for you to view? Just a thought.
filburt1
11-20-2002, 04:03 PM
Originally posted by Mathiau
Is it possible to have a "preview" of the colors?
Almost as said make a button to press - but have another option which will link to a img that the person has placed somewhere for you to view? Just a thought.
Not without adding more queries...
stark427
11-20-2002, 06:06 PM
Originally posted by filburt1
Okay, this is untested but should do it:
Hmm I could swear I replied... probably it was when the server crashed [ex] :confused:
anyway
Filburt thanx but nothing changed...
the "select style" did not show up
CobraR
11-27-2002, 05:26 AM
ok, im kinda confused on how its gonna work for me. Right now on my board i have each board on its own template so each board has a picture to go along with the board subject. So how is it gonna work when I install this hack? I have many templates, but only want users to be able to choose 2 different styles yet each board still has the picture on top to go along with that board.
thanks alot
Nairb
12-11-2002, 12:48 AM
Sry, but I havnt looked at the other posts
What's name of the hack for the style set dropdown, where it shows how many people are using that style?
*edit: sry, i found the hack thx
filburt1
12-11-2002, 12:55 AM
<a href="https://www.vbulletin.org/hacks/index.php?s=&action=showhack&hackid=129" target="_blank">http://www.vbulletin.org/hacks/index...ack&hackid=129</a>
imported_-Sidekick-
12-31-2002, 08:38 AM
Chen's version does change which style you have picked in UserCP btw. =]
filburt1
12-31-2002, 02:01 PM
No it doesn't unless he updated it.
Prince
12-31-2002, 02:15 PM
i already made this hack.. it doesn't need actual code hacking.. maybe you should've checked out my release :\
filburt1
12-31-2002, 02:16 PM
Yes but yours requires updating each time a style is modified, this one doesn't.
Originally posted by Prince
i already made this hack.. it doesn't need actual code hacking.. maybe you should've checked out my release :\
Yours requires updating the html each time a style is added. Also if someone dosent know what they are doing they could forget the sessionhash in the urls witch is a bad thing. This one grabs the styles via a query.
So, they both stay.
imported_-Sidekick-
01-02-2003, 05:05 AM
Originally posted by filburt1
No it doesn't unless he updated it.
Actually, his hack does do that. It has since 12/28/01.
Link to Hack (https://vborg.vbsupport.ru/showthread.php?postid=209544#post209544)
filburt1
01-02-2003, 12:43 PM
But this is a template modding forum last time I checked.
imported_-Sidekick-
01-03-2003, 06:15 AM
The reason why I said his does is because in your hack explaination, you say his doesn't. Which isn't true.
That's all I was trying to point out. :)
filburt1
01-03-2003, 02:46 PM
Hacks are file edits, mods are template changes. I always say mods, and the hack I referenced in the first post was Chen's.
Vladdy
03-08-2003, 09:54 PM
Filbie can you help me please.
I have it working fine, I am just having trouble placing it where I want it.
Here is a screenie and my forumhome in case you need it.
Also, just so you can compare to where I want to put it, when I am following your instructions, for some reason it keeps ending up on the left side of my board. I also coded it so it isn't included with the welcome text and new posts as I have those in different places...
Thanks for this awesome mod too!
filburt1
03-08-2003, 10:12 PM
Sorry but I don't have time to help people with layout issues; just put $styledropdown where you'd normally put the HTML.
Vladdy
03-08-2003, 10:20 PM
I have been and it keeps going in the wrong places...
Matrixgl
03-08-2003, 10:48 PM
Nice one....installed perfectly :)
imported_Jamie
03-22-2003, 06:23 AM
How can i set it so that if Default is in the style drop down list, that shows at the top?
stark427
03-22-2003, 06:54 PM
How can i set it so that if Default is in the style drop down list, that shows at the top?
Check a previous post of mine for this.
kitzzy
06-25-2003, 11:37 PM
Can someone tell me how I can make this work on ALL pages instead of just forumhome? I tried placing it in header template instead of forumhome and removing the part in phpinclude where it specifies it should only be index.php but if I do that I get some weird side effects. Can anyone offer me some direction as to how the code needs to be modified to work on every page instead of just index?
Can someone tell me how I can make this work on ALL pages instead of just forumhome? I tried placing it in header template instead of forumhome and removing the part in phpinclude where it specifies it should only be index.php but if I do that I get some weird side effects. Can anyone offer me some direction as to how the code needs to be modified to work on every page instead of just index?
Use this block in the phpinclude instead and add the call to any global template, this will run the query on every page load however, that can add alot of strain on your server if your board is large. Never-the-less heres you code:
Code removed
kitzzy
06-26-2003, 03:12 AM
I am getting the same problem with this code, I didnt look it at closely but it did you just remove the intial If statement? That is what I had initially done but for some weird reason when I do this, every time someone posts a reply it adds "The Lobsters" as the subject of the reply and nothing you do can get rid of it. FYI - This is the name of one of the schemes so something is causing it to get transferred to that and I cannot figure out why :-\
Let me have a look at something right quick, looks like something in this code is sending database to the subject feild.
Lemme know if this works for you:
// Filburt1's style drop down - modified for all pages by brad.loo
$result = mysql_query("SELECT styleid,title FROM style WHERE userselect=1 ORDER BY title");
if (!$result)
{
$styledropdown = 'Couldn\'t get a list of styles';
}
else
{
$s = mysql_fetch_row($result);
$selected = '';
while ($s != false)
{
$styleid = $s[0];
$styletitle = htmlspecialchars($s[1]);
if ($bbuserinfo['userid'] != 0)
{
$selected = ($styleid == $bbuserinfo['styleid']) ? " selected" : "";
}
$styledropdown .= "<option value=\"$styleid\"$selected>$styletitle</option>";
$s = mysql_fetch_row($result);
}
$shash = $session[sessionhash];
if ($bbuserinfo['userid'] == 0)
{
$styledropdown = "<option value=\"" . $bbuserinfo['styleid'] .
"\" selected>Select a style:</option>";
}
$styledropdown = "
<select name=\"newstyleid\" onChange=\"window.location='index.php?s=$shash&styleid=' + this.value\">
$styledropdown
</select>";
}
// End style drop down- modified
kitzzy
06-26-2003, 08:43 PM
yay ... it finally worked! Thanks so much :D
21productionz
07-30-2003, 03:05 AM
you can copy and paste from your edit options to frontpage grab the html and put it in the header and footer.
I'm new to this and that's what I did.
Probably sounds like a lot to someone but I love html over php or java and all that
Michael2
09-14-2003, 03:15 PM
Just added it to my board (running vB3) and it worked like a charm, thanks!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.