Greg
09-02-2007, 04:25 PM
This is a pretty simple hack. The php part of it is the driver to hook into vBulletin where we will store the content for this page.
The template is the content part of the page which is manageable from the style manager in the ACP. You won't need to touch the php page in the future to change content.
First we look at the PHP.
<?php
/*================================================= =================*\
|| ################################################## ############## ||
|| # Stand Alone Custom vBulletin Page - Version .1 # ||
|| # ------------------------------------------------------------ # ||
|| # www.cpurigs.com 2002-2008 # ||
|| ################################################## ############## ||
\*================================================ ==================*/
// Error Reporting
error_reporting(E_ALL & ~E_NOTICE);
// Environment
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'YOUR_CUSTOM_TEMPLATE_NAME');
// init vB arrays
$specialtemplates = array();
$phrasegroups = array();
$actiontemplates = array();
$globaltemplates = array(
'YOUR_CUSTOM_TEMPLATE_NAME'
);
// vb globals
require_once("./global.php");
// NavBar
$navbits = construct_navbits(array('' => 'YOUR_NAVBAR_PAGE_NAME'));
eval('$navbar = "' . fetch_template('navbar') . '";');
// spit out template
eval('print_output("' . fetch_template('YOUR_CUSTOM_TEMPLATE_NAME') . '");');
?>
It's a simple driver file.
1) You name the script something unique so if you need to, you can use the THIS_SCRIPT constant in vBulletin to know what page you are on. (ie. links)
2) You set the template name the script will use. This is a new template we will create next. Name it the same as the script to be consistent. (ie. links)
3) Put the name of the page you want to appear in the breadcrumb of the navbar. (ie. Links)
4) Set the template name again the same as in step 2 for the eval statement.
5) save the file as scriptname.php. For instance, if it's a links page, links.php. (ie. links.php)
6) upload it to your forums folder and make sure it has execute rights. Usually 755, the default on many systems, is ok.
Now we need a template for the content. Here's the shell.
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$stylevar[languagecode]" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>YOUR_PAGE_TITLE - $vboptions[bbtitle]</title>
</head>
<body>
$header
$navbar
<!- example table with some vBulletin CSS -->
<div class="center">
<table width="100%" class="tableline" cellspacing="1" cellpadding="4" border="2">
<tr>
<td colspan="2" class="tcat"><strong>YOUR_TITLE</strong></td>
</tr>
<tr>
<td valign="top" width="50%" class="alt1">
<!-- Content -->
</td>
</tr>
</table>
</div>
<!- /example table with some vBulletin CSS -->
$footer
</body>
</html>
Let's populate it with unique content.
1) Set the page title you want.
2) Put a title in the example html table header or replace all the example content as needed.
3) Copy and paste the whole template into a new template in the vB ACP style manager under add new template with the name you decided in step 2 of the php for the styles you want the new page to appear in and save it.
Go to your /forums/yourscriptname.php and test it.
You can do this for different topics and needs and you can make the page more dynamic with more php code. But those are different how to discussions.
Good luck. It should work out great for you!
Soon you will notice there needs to be a who's online hook or you get an Unknown Location on WOL. That's another discussion too, but we'll try and get to it.
The template is the content part of the page which is manageable from the style manager in the ACP. You won't need to touch the php page in the future to change content.
First we look at the PHP.
<?php
/*================================================= =================*\
|| ################################################## ############## ||
|| # Stand Alone Custom vBulletin Page - Version .1 # ||
|| # ------------------------------------------------------------ # ||
|| # www.cpurigs.com 2002-2008 # ||
|| ################################################## ############## ||
\*================================================ ==================*/
// Error Reporting
error_reporting(E_ALL & ~E_NOTICE);
// Environment
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'YOUR_CUSTOM_TEMPLATE_NAME');
// init vB arrays
$specialtemplates = array();
$phrasegroups = array();
$actiontemplates = array();
$globaltemplates = array(
'YOUR_CUSTOM_TEMPLATE_NAME'
);
// vb globals
require_once("./global.php");
// NavBar
$navbits = construct_navbits(array('' => 'YOUR_NAVBAR_PAGE_NAME'));
eval('$navbar = "' . fetch_template('navbar') . '";');
// spit out template
eval('print_output("' . fetch_template('YOUR_CUSTOM_TEMPLATE_NAME') . '");');
?>
It's a simple driver file.
1) You name the script something unique so if you need to, you can use the THIS_SCRIPT constant in vBulletin to know what page you are on. (ie. links)
2) You set the template name the script will use. This is a new template we will create next. Name it the same as the script to be consistent. (ie. links)
3) Put the name of the page you want to appear in the breadcrumb of the navbar. (ie. Links)
4) Set the template name again the same as in step 2 for the eval statement.
5) save the file as scriptname.php. For instance, if it's a links page, links.php. (ie. links.php)
6) upload it to your forums folder and make sure it has execute rights. Usually 755, the default on many systems, is ok.
Now we need a template for the content. Here's the shell.
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$stylevar[languagecode]" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>YOUR_PAGE_TITLE - $vboptions[bbtitle]</title>
</head>
<body>
$header
$navbar
<!- example table with some vBulletin CSS -->
<div class="center">
<table width="100%" class="tableline" cellspacing="1" cellpadding="4" border="2">
<tr>
<td colspan="2" class="tcat"><strong>YOUR_TITLE</strong></td>
</tr>
<tr>
<td valign="top" width="50%" class="alt1">
<!-- Content -->
</td>
</tr>
</table>
</div>
<!- /example table with some vBulletin CSS -->
$footer
</body>
</html>
Let's populate it with unique content.
1) Set the page title you want.
2) Put a title in the example html table header or replace all the example content as needed.
3) Copy and paste the whole template into a new template in the vB ACP style manager under add new template with the name you decided in step 2 of the php for the styles you want the new page to appear in and save it.
Go to your /forums/yourscriptname.php and test it.
You can do this for different topics and needs and you can make the page more dynamic with more php code. But those are different how to discussions.
Good luck. It should work out great for you!
Soon you will notice there needs to be a who's online hook or you get an Unknown Location on WOL. That's another discussion too, but we'll try and get to it.