The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Putting a php in a template
I read tons of tut's and guides on this, but i understand how to get html pages running with vbulletin, but i made this php script, but just don't understand how to get it working with the plugin system.
PHP Code:
Thanks guys, Brandon |
#2
|
||||
|
||||
why use a plugin?
just build a custom page, you just need to add header and footer templates (well, and navbar if you like). try something like this: Code:
<?php error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NOSHUTDOWNFUNC', 1); define('THIS_SCRIPT', 'your_script_name'); // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $vbulletin->input->clean_array_gpc('r', array( 'weapon1' => TYPE_STR, 'explosive' => TYPE_STR, 'special' => TYPE_STR, 'powerups' => TYPE_UINT, 'health' => TYPE_UINT, 'speed' => TYPE_UINT, 'capturer' => TYPE_STR, )); $weapon1 = $vbulletin->GPC['weapon1']; $explosive = $vbulletin->GPC['explosive']; $special = $vbulletin->GPC['special']; $powerups = $vbulletin->GPC['powerups']; $health = $vbulletin->GPC['health']; $speed = $vbulletin->GPC['speed']; $capturer = $vbulletin->GPC['capturer']; $navbits = array(); $navbits[$parent] = 'Your forum root title'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); $navbar = process_replacement_vars($navbar); eval('$headinclude = "' . fetch_template('headinclude') . '";'); $headinclude = process_replacement_vars($headinclude); eval('$footer = "' . fetch_template('footer') . '";'); $footer = process_replacement_vars($footer); echo<<<VAPRINT $stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> $headinclude <title>Your page title</title> </head> $header $navbar VAPRINT; // $output .= <<<VAPRINT <table align="center"> <tr> <td><span class="style1">#Equipment Pack<br /> $archivo <br> $weapon1 <br> $weapon1 <br> $explosive <br> $special <br> $powerups <br> $health <br> $speed <br> $capturer <br><br></span></td> </tr></table> <table align="center"> <form id="form1" name="form1" method="post" action=""> <tr><td><fieldset><legend>Weapon 1 Replacement:</legend> <select name="weapon1" id="weapon1"> <option value="01" selected="selected">Blaster Rifle</option> <option value="02">Arc Caster</option> <option value="03">Carbonite Freeze Gun</option> <option value="04">Incinerator</option> <option value="05">Shotgun</option> <option value="06">Sniper Rifle</option> <option value="07">Chaingun</option> <option value="08">Bowcaster</option> <option value="09">Rocket Launcher</option> <option value="0A">Blaster Pistol</option> <option value="0B">Fusion Cutter</option> <option value="0C">Tri Shot</option> <option value="0D">EMP Launcher</option> <option value="0E">Explosive Blaster Pistol</option> <option value="0F">Grenade Launcher</option> <option value="10">Guided Rocket</option> <option value="11">Orbital Strike</option> <option value="13">Thermal Detonator</option> <option value="14">Detpacks</option> <option value="15">Proximity Mines</option> <option value="16">Cluster Grenade</option> <option value="17">Wrist Rocket</option> <option value="19">Health and Ammo</option> <option value="1A">Auto-Turret</option> <option value="1B">Recond Droid</option> <option value="1C">Stealth Suit</option> <option value="1D">Jet Pack</option> <option value="1E">Jump Pack</option> <option value="1F">Personal Shield</option> <option value="21">Rally</option> <option value="22">Rage</option> <option value="23">Stamina</option> <option value="24">Regenerate</option> </select></fieldset> <fieldset><legend>Weapon 2 Replacement:<br /></legend> <select name="weapon2" id="weapon2"> <option value="00">Blaster Pistol</option> <option value="01">Fusion Cutter</option> <option value="02">Tri Shot</option> <option value="03">EMP Launcher</option> <option value="04">Explosive Blaster Pistol</option> <option value="05">Grenade Launcher</option> <option value="06">Guided Rocket</option> <option value="07">Orbital Strike</option> <option value="09">Thermal Detonator</option> <option value="0A">Detpacks</option> <option value="0B">Proximity Mines</option> <option value="0C">Cluster Grenade</option> <option value="0D">Wrist Rocket</option> <option value="0F">Health and Ammo</option> <option value="10">Auto Turret</option> <option value="11">Recond Droid</option> <option value="12">Stealth Suit</option> <option value="13">Jetpack</option> <option value="14">Jump Pack</option> <option value="15">Personal Shield</option> <option value="17">Rally</option> <option value="18">Rage</option> <option value="19">Stamina</option> <option value="1A">Regenerate</option> </select></fieldset> <fieldset><legend>Explosive:<br /></legend> <select name="explosive" id="explosive"> <option value="01">Thermal Detonator</option> <option value="02">Detpacks</option> <option value="03">Proximity Mines</option> <option value="04">Cluster Grenade</option> <option value="05">Wrist Rocket</option> <option value="07">Health and Ammo</option> <option value="08">Auto Turret</option> <option value="09">Recond Droid</option> <option value="0A">Stealth Suit</option> <option value="0B">Jetpack</option> <option value="0C">Jump Pack</option> <option value="0D">Personal Shield</option> <option value="0F">Rally</option> <option value="10">Rage</option> <option value="11">Stamina</option> <option value="12">Regenerate</option> </select></fieldset> <fieldset><legend>Special Items:<br /></legend> <select name="special" id="special"> <option value="01">Health and Ammo</option> <option value="02">Auto Turret</option> <option value="03">Recond Droid</option> <option value="04">Stealth Suit</option> <option value="05">Jetpack</option> <option value="06">Jump Pack</option> <option value="07">Personal Shield</option> <option value="09">Rally</option> <option value="0A">Rage</option> <option value="0B">Stamina</option> <option value="0C">Regenerate</option> </select></fieldset> </td><td> <fieldset><legend>Power Ups:<br /></legend> <select name="powerups" id="powerups"> <option value="01">Rally</option> <option value="02">Rage</option> <option value="03">Stamina</option> <option value="04">Regenerate</option> </select></fieldset> <fieldset><legend>Health:<br /></legend> <select name="health" id="health"> <option value="04" selected="selected">No Change</option> <option value="01">Level 1</option> <option value="02">Level 2</option> <option value="03">Level 3</option> </select></fieldset> <fieldset><legend>Speed:<br /></legend> <select name="speed" id="speed"> <option value="04">No Change</option> <option value="01">Level 1</option> <option value="02">Level 2</option> <option value="03">Level 3</option> </select></fieldset> <fieldset><legend>Capture Rate:<br /></legend> <select name="capturer" id="capturer"> <option value="04">No Change</option> <option value="01">Level 1</option> <option value="02">Level 2</option> <option value="03">Level 3</option> </select></fieldset></td></tr> <tr><td colspan="2"> <center><input type="submit" name="Submit" value="Submit" /></center> </form></td></tr> </table> $footer VAPRINT; echo $output; ?> |
#3
|
|||
|
|||
Have you checked the manual too? Including External Files
|
#4
|
|||
|
|||
thanks alot man, but is there any place to read on how to do something like that
Quote:
Thanks guys, Brandon |
#5
|
||||
|
||||
<font color="darkgreen">That is the nature of programming. If you want to do something complex then the amount of code goes up. You shouldnt be using that much code in a plugin anyways as its bad for overhead.</font>
|
#6
|
|||
|
|||
the include works great thanks everyone for your help :-)
|
#7
|
|||
|
|||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|