The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Custom code in Standard_Redirect template
Hey guys, I hope this is the right place.
Many years ago I customized my Standard_Redirect to pull a random quote from another template file and display it whenever the redirect page came up. This worked great. And it was only like 8 or 10 lines of code, not a huge change. Yesterday, I upgraded my board from 3.7 to 4.1, and during the process, it had marked that template as conflicting. Not surprising. It wasn't immediately obvious how to keep my modification with the changes made to the default template. Since I was in a hurry to get my board back up and running, I told it to go back to the default template, figuring I could pull up the template history later on to put my modification back in when I had a bit more time to look at it. Well, as it turns out, you can only get a template history if the template is already customized. Since I went back to the default, there is no history to go back to. Oops. I am definitely not a php guru (although I am a C++ programmer). I'd like to recreate that code, but I'm not really sure how to go about it. The quotes live in a phrase file called "randomquotequote", the contents of which are very simple: Code:
<SCRIPT LANGUAGE="JAVASCRIPT"> <!-- var r_text = new Array (); var a_text= new Array (); r_text[0] = "A quote"; a_text[0] = "The Author"; ...and so forth... r_text[16] = "The last quote."; a_text[16] = "The Author"; var i = Math.floor(17*Math.random()); document.write(r_text[i]); document.write("<BR>"); document.write(a_text[i]); //--> </SCRIPT> Can someone with a bit more PHP knowledge than me give me a nudge in the right direction? --------------- Added [DATE]1294246356[/DATE] at [TIME]1294246356[/TIME] --------------- Okay, I think I got it. The most intimidating part was figuring out how to access that phrase file, the rest is just formatting. Once I got that, it was pretty simple. I don't know if this is breaking any rules, but it seems to work. I just added this code to the top of Standard_Redirect (just after the <body> tag) Code:
<!-- my custom change --> <BR><BR><BR> <div class="standard_error"> <form class="block vbform" method="post" action="{vb:raw formfile}" name="postvarform"> <h2 class="blockhead">Today's Quote</h2> <div class="blockbody formcontrols"> {vb:rawphrase randomquotequote} </div> </form> </div> <!-- end custom change --> BTW, anyone is welcome to use this or similar code if they want random quotes to appear on their redirect page. It's kind of a popular secondary feature on my board |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|