The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[How to] Add custompages to your forum Details »» | |||||||||||||||||||||||||||
[How to] Add custompages to your forum
Developer Last Online: Feb 2013
This is not really a mod, since this is simply a "reminder" of a function build in but not documented. Submitted also to vbulletin.com of course.
If you would like to add custom pages (including header / footer of your forum) do the following: Add a new template in the style of your choice. You can name it whatever you want, it has to have the prefix Code:
custom_ You are then able to call the custompage using http://www.ut2007world.com/misc.php?do=page&template=test2 Change www.ut2007world.com with your domain and the test2 with your template name accordingly. Lets make an example. Admincp > Styles & Templates > Style Manager > In drop down choose Add New Template Name the template for example custom_google Use the following code : Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> $headinclude <title>$vboptions[bbtitle]</title> </head> <body> $header $navbar <!-- Custom Code Start Here --> <center> <iframe src="http://www.google.com" width="80%" height="400"></iframe></center> <!-- / Custom Code Ends here --> $footer </body> </html> Now use your web-browser and go to http://<domain>/misc.php?do=page&template=google And change the domain to your own. See attached a screenshot how the above example would look like. Also attached a default html code for a template. The page name will be automatically parsed in the navbar. If you would like to have the code displayed for certain usergroups only, you can add one ID Code:
<if condition="$bbuserinfo['usergroupid'] == '6'"> </if> Code:
<if condition="$bbuserinfo['usergroupid'] == '5' OR $bbuserinfo['usergroupid'] == '6' OR $bbuserinfo['usergroupid'] == '7'"> </if> Code:
<if condition="$bbuserinfo[userid]"> </if> Example code would be now: Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> $headinclude <title>$vboptions[bbtitle]</title> </head> <body> $header $navbar <if condition="$bbuserinfo[userid]"> <!-- Custom Code Start Here --> <center> <iframe src="http://www.google.com" width="80%" height="400"></iframe></center> <!-- / Custom Code Ends here --> </if> $footer </body> </html> On request: Creating Custom Pages using vbadvanced Anyway, some people would like to add for example flashchat, irc chat or simple iframes including all those modules etc. etc. Some demos : FlashChat Custom Stuff etc. etc. So lets get started. First, you need to create a template. Lets use as exmaple an iframe where google.com runs in it ... Create a new template with the prefix adv_portal_ and name it for example google. Admincp > Styles & Templates > Style Manager > In drop down choose Add New Template Put in the code Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> $headinclude <title>$vboptions[bbtitle]</title> </head> <body> $header $navbar <!-- Custom Code Start Here --> <center> <iframe src="http://www.google.com" width="80%" height="400"></iframe></center> <!-- / Custom Code Ends here --> $footer </body> </html> Now add a new Page which is Template Based Page Title : What you would like to have displayed in the browser title bar Page Identifier : This is the variable that will be used in the URL to link to this page. For example, if this option is set to 'games', then the link to this page would look like this: /cmps_index.php?page=games Template : adv_portal_google Should look something like You don't have to use the Module Shell Template Options, only if you would like to have a typicall box around the stuff you display including the button to expand / collapse it Now the important stuff : modules There is not really a guideline for it ... The most important modul you need : Custom Page Content If you don't use it - you will get a white page .. But for this example, lets disable all modules in the middle, except the one just mentioned, and some modules on the left and right. You will proparbly have a different module set, but once again : Custom Page content MUST and WILL be there Since you named the identifier google - you can browse now to that page using http://<domain>/cmps_index.php?page=google IF you renamed cmps_index.php to index.php - you need to change that of course... Here is a demo : http://www.ut2007world.com/index.php?page=google Show Your Support
|
Comments |
#12
|
|||
|
|||
Quote:
|
#13
|
|||
|
|||
Ok, I was playing around a bit..
If your template would look like Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> $headinclude <title>$vboptions[bbtitle]</title> </head> <body> $header $navbar <if condition="$bbuserinfo[userid]"> <center> <iframe src="http://www.google.com" width="80%" height="400"></iframe></center> <else /> <table class="tborder" cellpadding="6" cellspacing="1" border="0" width="70%" align="center"> <tr> <td class="tcat">vBulletin Message</td> </tr> <tr> <td class="panelsurround" align="center"> <div class="panel"> <div align="left"> <!-- main error message --> <blockquote><p><p><strong>$bbuserinfo[username]</strong>, you do not have permission to access this page. This could be due to one of several reasons:</p> <ol> <li>Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?</li> <li>If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.</li> </ol> <div align="right"> <a href="login.php?do=logout&logouthash=b79dddc3a894bac9fea040e270f00ee7">Log Out</a> <a href="index.php?">Home</a> </div></p></blockquote> <!-- / main error message --> </div> </div> <!-- <div style="margin-top:6px"> <input type="submit" class="button" value="Go Back" accesskey="s" onclick="history.back(1); return false" /> </div> --> </td> </tr> </table> </if> $footer </body> </html> You can also remove the $bbuserinfo[username] and replace it with something you like or whatever ... Since I am using in the example above <if condition="$bbuserinfo[userid]"> - it will give out an error regardless of the usergoupid |
#14
|
|||
|
|||
utw, nice one!
thanks a lot for this one. I am going to use this custom page thing on my vbulletin site. |
#15
|
||||
|
||||
Why doesn't vBulletin document things like this -- it's a huge time-saver.
|
#16
|
||||
|
||||
I've got to echo what others have said here - this is an outstanding integrated feature of vBulletin that deserves a LOT more attention. Finding this thread has saved me a few hours of coding and testing, and like they say, time is money. Spread the word on this great feature, guys, and many thanks to utw for bringing this up!!!
|
#17
|
|||
|
|||
How would you change it so in the little nested directory thing showing where you are has a different name than just the template name. Using the example in the first post. It would just say that you were in test2. And that looks a little weird.
Edit: The reason why I am asking is that I want the name to be two separate words, and you can't have spaces...so yeah. |
#18
|
|||
|
|||
Added to vbulletin.com too
http://www.vbulletin.com/forum/showthread.php?t=197563 Thanks guys for the great responses |
#19
|
|||
|
|||
Quote:
Lets call the template custom_Jeordie015 Here the result : http://www.ut2007world.com/misc.php?...ate=Jeordie015 |
#20
|
|||
|
|||
Added instructions (on request) how to use vbadavanced for custom pages and also how to use permissions.
|
#21
|
|||
|
|||
Quote:
Create an empty file and use the following code : Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.
define('THIS_SCRIPT', 'test');
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'test',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('"clientscript', '"' . $vbulletin->options['bburl'] . '/clientscript', $headinclude);
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Test Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('test') . '");');
?>
Basicially the colored code. Here you can specify the title using more than one word. Now simply call the php file, like http://<domain>/<php file> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|