Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
How to create your own vBulletin-powered page! (uses vB templates)
Gary King's Avatar
Gary King
Join Date: Jan 2002
Posts: 2,046

 

Show Printable Version Email this Page Subscription
Gary King Gary King is offline 03-03-2004, 10:00 PM

Want to create your very own vBulletin powered page which includes the header, footer, and the user permissions system as well?

Well now you can

Want to know how it will look? Take a look at the attached screenshot below!

Now includes the Who's Online modification!
Also, instructions included on how to create your own pages that are integrated with current vBulletin files!

I'm going to give you a generic page but you can easily modify the contents of the page by changing the template

So here we go

Instructions:

Create a new file, whatever you want to call it (let's say test.php).
Open up test.php and add the following (replace TEST with whatever template you want to show):
PHP Code:
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''test'); // change this depending on your filename

// ################### 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(
    
'TEST',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'Test Page';

$navbits construct_navbits($navbits);
eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' fetch_template('TEST') . '");');

?>
Be sure to change 'TEST' to the actual template name, and change 'test' to the filename. Also, change 'Test Page' to whatever you want to show in the navbar, such as 'Viewing Member Profile' (just an example).

Now create the template, called TEST with the following content:
HTML Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat">Title</td>
</tr>
<tr>
    <td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>
All done
Now check it out by going to test.php

Who's Online Modification

Now if you want to show who is browsing this new page of yours, just open up includes/functions_online.php and find:
PHP Code:
    case 'bugs.php':
        
$userinfo['activity'] = 'bugs';
        break; 
Below, add:
PHP Code:
    case 'test.php':
        
$userinfo['activity'] = 'test';
        break; 
(Be sure to change the values to your own!)

Then find:
PHP Code:
        case 'modcplogin':
            
$userinfo['action'] = $vbphrase['moderator_control_panel_login'];
            break; 
Below add:
PHP Code:
        case 'test':
            
$userinfo['action'] = 'Viewing Test Page';
            break; 
All done!

----------------------------------

Also if you want to create your own pages 'within' current vBulletin files, do the following:

Open the file you want, and then right before the final ?> in the source code, add the following:

PHP Code:
if ($_REQUEST['do'] == 'xxx')
{
    eval(
'print_output("' fetch_template('TEMPLATE_XXX') . '");');

Replace 'xxx' with whatever you want ?do= in the query string to be (for example, replace 'xxx' with 'showprofile' so then someone would type in example.php?do=showprofile to view this template.) Then of course, change TEMPLATE_XXX to your template name, it's that simple!


edit by Lynne: If running 3.8.4 or above, see this post to take care of the PHP 5.3.0-related problems - https://vborg.vbsupport.ru/showpost....postcount=1171
Attached Images
File Type: jpg template_test.jpg (62.5 KB, 0 views)
Reply With Quote
  #872  
Old 11-11-2008, 06:09 AM
merk_aus merk_aus is offline
 
Join Date: Feb 2008
Location: Australia
Posts: 582
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

where do you create the template and where do you put the html code
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">Title</td>
</tr>
<tr>
	<td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>
????
Reply With Quote
  #873  
Old 11-11-2008, 06:22 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by merk_aus View Post
where do you create the template and where do you put the html code
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">Title</td>
</tr>
<tr>
	<td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>
????
Templates are created in your Style Manager.
Reply With Quote
  #874  
Old 11-20-2008, 08:15 PM
cindy helmond cindy helmond is offline
 
Join Date: Feb 2006
Location: The Netherlands
Posts: 334
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice but when i go back to forum or memberlist the pagina is going everytime to the added page ?
whats wrong?

all the links that i click are going to the new page but if a delete the link in the navbar and going to the url then the links are good !
thx
Reply With Quote
  #875  
Old 11-20-2008, 08:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cindy helmond View Post
nice but when i go back to forum or memberlist the pagina is going everytime to the added page ?
whats wrong?

all the links that i click are going to the new page but if a delete the link in the navbar and going to the url then the links are good !
thx
I don't really understand what the problem is except it revolves around a link you added in the navbar? Perhaps you have it coded wrong. You might want to post what you did.
Reply With Quote
  #876  
Old 11-20-2008, 09:02 PM
cindy helmond cindy helmond is offline
 
Join Date: Feb 2006
Location: The Netherlands
Posts: 334
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I don't really understand what the problem is except it revolves around a link you added in the navbar? Perhaps you have it coded wrong. You might want to post what you did.
Code:
<td class="vbmenu_control"><a href="http://www.xx.eu/forum/Chat.php/">Chat</a></td>
thats the link if i add that to the navbar the page are going to it but i cant back to another link in the forum he get the link with Chat for the link everytime
Reply With Quote
  #877  
Old 11-20-2008, 09:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cindy helmond View Post
Code:
<td class="vbmenu_control"><a href="http://www.xx.eu/forum/Chat.php/">Chat</a></td>
thats the link if i add that to the navbar the page are going to it but i cant back to another link in the forum he get the link with Chat for the link everytime
I'm think your link is incorrect. Try this:
Code:
<td class="vbmenu_control"><a href="http://www.xx.eu/forum/Chat.php">Chat</a></td>
Reply With Quote
  #878  
Old 11-20-2008, 09:13 PM
cindy helmond cindy helmond is offline
 
Join Date: Feb 2006
Location: The Netherlands
Posts: 334
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
I'm think your link is incorrect. Try this:
Code:
<td class="vbmenu_control"><a href="http://www.xx.eu/forum/Chat.php">Chat</a></td>
THX WORKING !!

--------------- Added [DATE]1227225877[/DATE] at [TIME]1227225877[/TIME] ---------------

--------------- Added [DATE]1227225965[/DATE] at [TIME]1227225965[/TIME] ---------------

--------------- Added [DATE]1227244261[/DATE] at [TIME]1227244261[/TIME] ---------------

i have now an dating script but its not working to login (i know its not working with vbulletin username) if i open the script in a new window its working ! if i open it in vbforum cant login the script iframe not working cookies?
any idea?
thx
Reply With Quote
  #879  
Old 11-24-2008, 11:02 PM
LaPiba LaPiba is offline
 
Join Date: Apr 2002
Location: Argentina
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I have a serious problem.

I made the following chat page; it is called parachat.php and this is the code:

Quote:
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'parachat'); // change this depending on your filename

// ################### 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(
'parachat',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$nombre = $vbulletin->userinfo['username'];

$navbits = array();
$navbits[$parent] = '?Chat!';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('parachat') . '");');

?>
The "parachat" template has conditionals... it is something like this:

Quote:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="alt1">
<if condition="$bbuserinfo['usergroupid'] != 1 AND
$bbuserinfo['usergroupid'] != 2 AND
$bbuserinfo['usergroupid'] != 3 AND $bbuserinfo['usergroupid'] != 4 AND $bbuserinfo['usergroupid'] != 10 AND $bbuserinfo['usergroupid'] != 18 AND $bbuserinfo['usergroupid'] != 19 AND $bbuserinfo['usergroupid'] != 21">

Here it comes a chat applet.

<else />
Here it comes a message for non authorized usergroups.
<br /><br />
<if condition="$bbuserinfo['usergroupid'] == 2">
Here another message, specifically for usergroup 2 which is non-authorized for chat in my forum.
<br /><br />
</if>
</if>
</td>
</tr>
</table>
<br /><br />
$footer
</body>
</html>
However, one member managed to enter that page, although she is in a non-authorized usergroup (usergroup 21).

Is this a problem with the php page, or with the use of conditionals?

Could anybody help me? Thanky you in advance.
Reply With Quote
  #880  
Old 11-24-2008, 11:38 PM
cindy helmond cindy helmond is offline
 
Join Date: Feb 2006
Location: The Netherlands
Posts: 334
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by LaPiba View Post
Hi,

I have a serious problem.

I made the following chat page; it is called parachat.php and this is the code:



The "parachat" template has conditionals... it is something like this:



However, one member managed to enter that page, although she is in a non-authorized usergroup (usergroup 21).

Is this a problem with the php page, or with the use of conditionals?

Could anybody help me? Thanky you in advance.

its not working the php script in a vbulletin page , the users cant login i have the same problem with a dating inlog program
Reply With Quote
  #881  
Old 11-25-2008, 01:37 AM
LaPiba LaPiba is offline
 
Join Date: Apr 2002
Location: Argentina
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In my case, the page IS working for all users, with only one excepcion: there is ONE user that is entering the page, although she belongs to a usergroup which is not authorized to enter it.

That user is the only exception... the page is working fine for all other users.

Some days ago, this user belonged to another usergroup (a usergroup allowed to enter the page), and, after i moved her to usergroup #21, she continued entering the page.

Perhaps her browser is showing her a cached version?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06558 seconds
  • Memory Usage 2,381KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)bbcode_html
  • (6)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (5)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete