The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
How To New Pages in vb style
Ok ive seen that alot of people have been asking how to create new pages with the vbulletin style on them like i have used on forum.imaedia.com for the link/games etc pages, so ive decided to write this to tell everyone how to do it Ok i usualy start by creating a basic template in the admin cp that i will use for all the pages that im going to add. log into your admin cp go to styles and templates then go to the style manager and expand the style that you are currently using on the right of the page you will see a drop down menu, select add new template from it and then you need to name it for this example im naming mine : "test" now we need to create a very basic html template to go in this template: because im doing this quickly i just added any css i wanted to use onto this page instad of using the vbulletin css styles ok so put the following into your temoplate and change the parts that say page name and page content to suit your needs Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers --> <title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title> <style type="text/css"> <!-- .top { border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000; border-left-color: #000000; } .all { border: 1px solid #000000; background-color: #FFFFFF; } --> </style> $headinclude </head> <body> $header $navbar <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="all"> <thead> <tr align="center"> <td align="left" valign="top" class="thead"> <div align="left"></div> <div align="left"> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td class="tcat">**********Test Page**********</td> </tr> <tr> <td>********Page Content would go here :)**********</td> </tr> </table> <font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></div></td> <if condition="$vboptions[showmoderatorcolumn]"> </if> </tr> </thead> $forumbits <tbody> </tbody> </table> $footer </body> </html> The next step is to create the php file that will call the template, Here is the code i used, to incldue the naviation and header/footer Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'yourscript'); // ################### 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( 'TEMPLATENAME' ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('TEMPLATENAME') . '");'); ?> then go to yourforumurl/pagename.php and you got yourself a non vb page with vb template on it hope that helps post any questions, i prolli missed something or done something totaly wrong but hehe just trying to help :P |
#32
|
|||
|
|||
Nevermind I don't know what I did but I got it to work. And thanks very much for showing me how to do this. I like this "how to". Thanks
|
#33
|
|||
|
|||
Nothing like bumping a very old topic...
I've used this tutorial to create a page, and for the most part, it's working. But this part: define('THIS_SCRIPT', 'yourscript'); What does 'yourscript' refer to? I'm not sure what to replace there. |
#34
|
|||
|
|||
Hello just feeling my way too...
I havce an insight and a question... There are two places in the .php program where you must put the name of your script. If the .php program is calles say "wunderbar.php" then near the top of the program is define('THIS_SCRIPT', 'wunderbar');// note no .php towards the end of the program you need eval('print_output("' . fetch_template('wunderbar') . '");'); In my case the template is called wunderbar too so that things work. My question. I'd like to know the user name in the program wunderbar.php. I've jsut got it working a little. I have a post with a link to my-forum/wunderbar.php If I click on the link it executes wunderbar.php. wunderbar.php calls the template script wuinderbar. I need some way to get the username in here. I'd really like to put some dynamic content into the template script. Or perhaps have two templates, a top and a tail, and I'll put in the dynamic content in wunderbar.php. John |
#35
|
|||
|
|||
Is there an updated version for 3.6.x ?
|
#36
|
|||
|
|||
Ok I'm stumped
I have put in the php file betaform.php http://askatech.autorepairdata.com/betaform.php Modified the base template Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'yourscript'); // ################### 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( 'BetaForm' ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('BetaForm') . '");'); ?> Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <!-- no cache headers --> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> <meta http-equiv="Cache-Control" content="no-cache" /> <!-- end no cache headers --> <title><phrase 1="$vboptions[bbtitle]">$vbphrase[x_powered_by_vbulletin]</phrase></title> <style type="text/css"> <!-- .top { border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-top-color: #000000; border-right-color: #000000; border-bottom-color: #000000; border-left-color: #000000; } .all { border: 1px solid #000000; background-color: #FFFFFF; } --> </style> $headinclude </head> <body> $header $navbar <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="all"> <thead> <tr align="center"> <td align="left" valign="top" class="thead"> <div align="left"></div> <div align="left"> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td class="tcat">**********Test Page**********</td> </tr> <tr> <td>********Page Content would go here :)**********</td> </tr> </table> <font size="2"><font face="Verdana, Arial, Helvetica, sans-serif"></font></font></div></td> <if condition="$vboptions[showmoderatorcolumn]"> </if> </tr> </thead> $forumbits <tbody> </tbody> </table> $footer </body> </html> |
#37
|
|||
|
|||
You need to include global.php from your forum directory...
Change: PHP Code:
PHP Code:
|
#38
|
|||
|
|||
Quote:
Here is my folderstructure. /rootfolder/forum I want a php file to work in /rootfolder/anotherfolder So here is the code I am trying to use in my php file in /rootfolder/anotherfolder PHP Code:
Thanks if you can help. BTW, I have dropped a straight HTML file in /rootfolder/anotherfolder and that works fine. The php files gives me a white screen and when I view the source all I see are the default html structure tags. |
#39
|
|||
|
|||
Try:
PHP Code:
PHP Code:
|
#40
|
|||
|
|||
Code:
<?php // ###SET PHP ENVIRONMENT### error_reporting(E_ALL & ~E_NOTICE); // ###DEFINE IMPORTANT CONSTANTS### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'PHPFILENAMEWITHOUTEXTENSION'); // If your PHP file is goober.php, this should be goober // ###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( 'INSERTTHENAMEOFTHETEMPLATEYOUAREUSINGHERE', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ###REQUIRE BACK-END### require_once('./global.php'); // If your PHP file is not in your root forum directory, then change this path. // ###START MAIN SCRIPT### $navbits = array(); $navbits[$parent] = 'EVEIT'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); // ###YOUR PHP CODE### // Put all your PHP code here. You want to store all output in variables, // and then display those variables from the template, rather than echoing // data directly from the PHP file. Anything output by this PHP file will screw // up your layout and not follow the CSS and styles of your forum. $outputvara = '<table width="50%"><tr><td>Hello</td><td>' $outputvara .= $vbulletin->userinfo['username'].'</td></tr></table>'; // ###END OF YOUR PHP CODE### // ###TEMPLATE OUTPUT### eval('print_output("' . fetch_template('INSERTTHENAMEOFTHETEMPLATEYOUAREUSINGHERE') . '");'); ?> Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <title>$vboptions[bbtitle]</title> $headinclude </head> <body> $header $navbar <!-- PUT YOUR CONTENT AFTER THIS --> <if condition="is_member_of($bbuserinfo, array(2))"> <!-- If user if a member of group 2 ("Registered Users") display the content --> <div>$outputvara</div> <else /> <div>You aren't registered. Please register</div> </if> <!-- PUT YOUR CONTENT BEFORE THIS --> $footer </body> </html> If the code you posted is what you're actually using, you need to change the DEFINE 'yourscript' to the name of the PHP file, minus the .php extension. |
#41
|
|||
|
|||
I have no idea how to do this sorry I have managed to do the first part but the second code i have no idea what to do with where to put it or what i should do cause when i did put it onto a blank page i got errors.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|