PDA

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


KuraFire
02-05-2003, 10:00 PM
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
02-06-2003, 12:31 PM
This file is needed for Step 4 of this hack (put it in your /admin directory!!)

PSI|Dr-X
02-06-2003, 01:07 PM
Ill try

Floris
02-06-2003, 01:07 PM
Sigh .. what can I say :)

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

gameplanetz
02-06-2003, 02:00 PM
nice, might try...

saint_seiya
02-06-2003, 07:54 PM
The hack is nice, might use it in the future ;)

leviw
02-10-2003, 01:00 AM
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
02-10-2003, 01:08 PM
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
03-20-2003, 07:26 PM
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
05-04-2003, 09:27 PM
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-05-2003, 08:17 AM
Today at 12:27 AM Conundrum9 said this in Post #10 (https://vborg.vbsupport.ru/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-
06-08-2003, 06:12 AM
Does this hack update things like the style postbit hack, like Grog6's?

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