Im not 100% sure where to add this, this is not a product, it is a work around the template system (only uses the template system for grabbing any template you want and displaying it in this page)
To use this addon, make a new file "page.php" in your forum root (if you want it in another directory you will need to edit a few lines in the code, not a big deal though). Paste the below code into the page.php and save. Run https://www.site.com/forum/page.php
Here is the code.
PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.8
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2010 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
/**
* If you want to move this file to the root of your website, change this
* line to your vBulletin directory and uncomment it (delete the //).
*
* For example, if vBulletin is installed in '/forum' the line should
* state:
*
* define('VB_RELATIVE_PATH', 'forum');
*
* Note: You may need to change the cookie path of your vBulletin
* installation to enable your users to log in at the root of your website.
* If you move this file to the root of your website then you should ensure
* the cookie path is set to '/'.
*
* See 'Admin Control Panel
* ->Cookies and HTTP Header Options
* ->Path to Save Cookies
*/
//define('VB_RELATIVE_PATH', 'forums');
// Do not edit.
if (defined('VB_RELATIVE_PATH'))
{
chdir('./' . VB_RELATIVE_PATH);
}
/**
* You can choose the default script here. Uncomment the appropriate line
* to set the default script. Note: Only uncomment one of these, you must
* add // to comment out the script(s) that you DO NOT want to use as your
* default script.
*
* You can choose the default script even if you do not plan to move this
* file to the root of your website.
*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'home'); // change this so you can use other conditionals like "THIS_PAGE" != "home" etc.. in other, real templates.
define('CSRF_PROTECTION', false); // turn on for token layer security
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// cache any templates you want to use for this mod .
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
//This appears in your breadcrumbs navigation.
$navbits = construct_navbits(array('' => 'Welcome to animeFans.tv. No fancy "we\'re the best, we\'re #1, you judge this site your self by browsing our forums below :D'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
//appears in the <title> tags in the head
$pagetitle = 'animeFans Home';
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
// register your templates
$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('header', $header);
$templater->register('headinclude', $headinclude);
$templater->register('navbar', $navbar);
$templater->register('footer', $footer);
$templater->register('pagetitle', $pagetitle);
//
//important variables, already queried and ready to use
$userid = $vbulletin->userinfo[userid];
$username = $vbulletin->userinfo[username];
$usergroup = $vbulletin->userinfo[usergroupid];
$avatarrevision = $vbulletin->userinfo[avatarrevision];
//
// your own custom head and css files
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html dir="ltr" lang="en"> <head>
'.$headinclude.'
<title>'.$pagetitle.'</title>
<link href="clientscript/animefans/rpg.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.advertisement {display: none !important}
-->
</style>
</head> <body> ';
// output templates
echo $header, $navbar;
//content here
echo 'you can do queries, loops, anything you want here';
//footer, close everything
echo $footer;
echo '</body></html>';
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 16:53, Mon Nov 8th 2010
|| # CVS: $RCSfile$ - $Revision: 35749 $
|| ####################################################################
\*======================================================================*/
?>
Please note that you can use the switch() to loop through conditions so that you can have one page for a whole custom mod. example:
PHP Code:
switch($do){
case "register":
echo 'registration form';
break;
case "member":
echo 'member details';
break;
default;
echo 'something here if $do is empty';
}
and access it like
https://www.site.com/page.php?do=register //registration
https://www.site.com/page.php?do=member // member page
https://www.site.com/page.php?do=fgdgf // nonsense will be directed to the default; in the switch
https://www.site.com/page.php // empty $do will be directed to the default; in the switch
I know this is not the the best way to use vb, and has some security risks when csrf protection is off but its a great way to get used to vbulletin.
Benefits:
- Automatically adjusted to suite any skin when a user switches, no extra coding needed
- Simple and easy
- can access other databases
- can use any php function available to your server
- can access ALL of vbulletin's functions and classes.
- can use any html tag
- can use any css file and selector
- canuse any amount of javascript
- no messy plugins and settings to sort through.
- have full access to all vbulletin's plugins, classes, templates and much more!!!
Downsides
- requires small amounts of php/html/css knowledge.
CHANGELOG:
- Fixed some minor bugs - 12/3/2010
- New error found - 11/29/2.10
http://www.vbulletin.com/forum/project.php?issueid=37110
Although this mod does not affect your forum in a visible way, caching probably wont work, il update this when i have a workaround for it