The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi everyone!
The guys from the vbulletin.com forum sent me over here I'd like to include custom PHP in two of my templates ('headinclude' and 'navbar'; for a PHP style sheet switcher, to be exact) and am seriously stuck as to how to get vBulletin to parse my code. Here's what I have so far:1. two external PHP files: Code:
rootdir/_custom_includes/switcher.php rootdir/_custom_includes/Styleswitcher.php (goes inside the <head> tag, replaces 'traditional' links to style sheets) Code:
<?php
// BEGIN STYLESWITCHER CODE
if(!isset($reqPath)){ $reqPath = "./"; }
require_once($reqPath ."_custom_includes/Styleswitcher.php");
$ss = new Styleswitcher();
$ss->addStyle("basic", "basic.css", "", "", true);
$ss->addStyle("blue", "blue.css");
$ss->addStyle("green", "green.css");
... more identical stuff here ...
// End Styleswitcher code
?>
(the controls for the style sheet switcher) Code:
<form action="_custom_includes/switcher.php" method="post">
<!-- Automatically redirect to the referer -->
<input type="hidden" name="referer" id="referer" value="<?php print $_SERVER['PHP_SELF']; ?>" />
<input type="hidden" name="inputStyle1" id="inputStyle1" value="fonts" />
<input type="hidden" name="inputStyle2" id="inputStyle2" value="style" />
<strong>Font Style:</strong><br />
<input type="radio" name="fonts" id="fontStyle1" value="normal" <?php $ss->printSetInputChecked("fonts", "normal"); ?>/> <label for="fontStyle1">Normal text (smaller)</label>
<input type="radio" name="fonts" id="fontStyle2" value="large" <?php $ss->printSetInputChecked("fonts", "large"); ?>/> <label for="fontStyle2">Large text</label><br />
... addtl. form elements here ...
<input type="submit" name="setChanges" value="Change styles" />
</form>
Thanks much! effgee (* - e.g., do I put the code for these controls in a separate file?) |
|
#2
|
|||
|
|||
|
Since this will be in the header, you likely need to make a global start hook plugin. Try putting the above code in a global start hook.
hook code global start PHP Code:
HTML Code:
<form action="_custom_includes/switcher.php" method="post"> <!-- Automatically redirect to the referer --> <input type="hidden" name="referer" id="referer" value="$SS_script" /> <input type="hidden" name="inputStyle1" id="inputStyle1" value="fonts" /> <input type="hidden" name="inputStyle2" id="inputStyle2" value="style" /> <strong>Font Style:</strong><br /> <input type="radio" name="fonts" id="fontStyle1" value="normal"$SS_normal /> <label for="fontStyle1">Normal text (smaller)</label> <input type="radio" name="fonts" id="fontStyle2" value="large"$SS_large /> <label for="fontStyle2">Large text</label><br /> ... addtl. form elements here ... <input type="submit" name="setChanges" value="Change styles" /> </form> don't forget to cache the template.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|