PDA

View Full Version : Change Style dropdown on ALL of your vB pages :) (hardcoded, no queries)


KuraFire
06 Feb 2003, 13:30
HACK: Change Style dropdown on ALL of your vB pages :) (hardcoded, no queries)
BY: KuraFire [www.kurafire.com]
DESCRIPTION: Allows users/guests to change the style on ANY given vB page of yours
DIFFICULTY: Medium
INSTALL-TIME: 10 minutes
STEPS: 9

Demo: www.kurafire.com/thecouch/
Just browse around and try changing the style on various pages :)

EXTENDED DESCRIPTION:
This hack will put a small drop-down box in your Header template, containing all the styles of your vBulletin forum. This particular version of the hack will not require a query for every pageload to get the different Styles, but it does require you to hardcode your Styles into the global.php file. There is also a version where you don't have to do that, but that will add one query to every page load.

PROS FOR THIS VERSION:
- no query extra for every page load of your vB
- drop down box isn't as wide as with the other version of the hack
CONS FOR THIS VERSION:
- the amount of users using each style is not displayed;
- if you add more styles, you have to hardcode the new ones into your global.php again.

Personally, I use this version, for I don't add styles very often at all (made 6 initial ones and will only add 1 more style somewhere in the coming year or two :D), and I like to keep my query count as low as possible on every page load :)



Install instructions are in the attachment. Enjoy / good luck :)

KuraFire
06 Feb 2003, 13:31
This file is needed for Step 4 of this hack (put it in your /admin directory!!)

PSI|Dr-X
06 Feb 2003, 14:07
Ill try

Floris
06 Feb 2003, 14:07
Sigh .. what can I say :)

Another feature filled by kurafire :) Thank you! :)

gameplanetz
06 Feb 2003, 15:00
nice, might try...

saint_seiya
06 Feb 2003, 20:54
The hack is nice, might use it in the future ;)

leviw
10 Feb 2003, 02:00
Having some trouble with step 8, you say:

Step 8
----------
Run this query on your database (in phpMyAdmin or wherever you run your queries on):

UPDATE template SET templatesetid='-1' WHERE title LIKE 'header_stylebox%' LIMIT 2;

I'm pretty new to php, how do I run this query? I assume phpMyAdmin is a seperate program sort of like Telnet?

Thanks in advance for any tips.

KuraFire
10 Feb 2003, 14:08
you just have to run that query on your database. phpMyAdmin is a webbased administration system in which you can very easily run queries on your DB, but you can also telnet to your server, login to the mysql server and run that query from there. :)

AlexanderT
20 Mar 2003, 20:26
I tried to run the Query in phpMyAdmin but it didnt seem to work.

I went to menu SQL (right to Structure) and pasted

UPDATE template SET templatesetid='-1' WHERE title LIKE 'header_stylebox%' LIMIT 2;

into the "Run SQL query/queries..." field. Then I hit Go. After that, it says "Affected rows: 0" and I dont see any changes to the database.

Any help would be greatly appreciated!!!

Conundrum9
04 May 2003, 22:27
I'm not sure if there is a reason fo rit, but I found a problem with the instructions for Step 5.


$boxurl = $PHP_SELF . "?" . $_SERVER['QUERY_STRING'];
$boxurl = str_replace("s=$session[sessionhash]", "", $boxurl);
$boxurl = preg_replace("/(&changestyle=(.{0,2}))/", "", $boxurl);
$boxurl = str_replace("?&", "?", $boxurl);
if(substr($boxurl, -1)!="&"){
$boxurl .= "&";
}
$dropdownbits = "";

foreach($allstyles as $key=>$val) {
$stylesel = ($styleid==$key) ? "selected=\"selected\"" : "";
eval("\$dropdownbits .= \"".gettemplate('nc_stylechangebit')."\";");
}
eval("\$dropdownbox = \"".gettemplate('header_stylebox')."\";");


I found that on installing this on my test board the nc_stylechangebit needed to be changed to header_styleboxbit which is a template the instructions tell you to make in Step 6.

Anyway since I'm still just learning the finer points of php it might just be me, but I thought I should bring it up.

KuraFire
05 May 2003, 09:17
Today at 12:27 AM Conundrum9 said this in Post #10 (http://www.vbulletin.org/forum/showthread.php?postid=391455#post391455)
I'm not sure if there is a reason fo rit, but I found a problem with the instructions for Step 5.

I found that on installing this on my test board the nc_stylechangebit needed to be changed to header_styleboxbit which is a template the instructions tell you to make in Step 6.

Anyway since I'm still just learning the finer points of php it might just be me, but I thought I should bring it up.


Gleh, you're right.

I updated the attachment in the first post with the instructions, it now has the right template name.

AlexanderT: that query is only to make your new templates be 'global' templates. It's not a necessary step, really, so don't worry. Just make sure to check your hack install to see if you have to adjust the template name (see Conundrum9's post above this one) in the code. :up:

-Sidekick-
08 Jun 2003, 07:12
Does this hack update things like the style postbit hack, like Grog6's?

Kamui Shirou
29 Jun 2003, 19:47
no queries? if i put it one the forumhome, there will be no additional queries?