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
  #352  
Old 08-27-2005, 11:32 AM
---MAD--- ---MAD--- is offline
 
Join Date: Jun 2005
Location: Earth
Posts: 191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the online thing doesnt work :S
Reply With Quote
  #353  
Old 08-27-2005, 06:19 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MAD_PLayEr1
the online thing doesnt work :S
Yes it does.

What version of vBulletin are you using? Post the edits you made.
Reply With Quote
  #354  
Old 08-30-2005, 05:15 AM
geoff4787 geoff4787 is offline
 
Join Date: Apr 2005
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, great tutorial!
Reply With Quote
  #355  
Old 08-30-2005, 07:27 AM
o0stephane0o's Avatar
o0stephane0o o0stephane0o is offline
 
Join Date: Feb 2002
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

SirAdrian it works like a charm, thanks a lot
Reply With Quote
  #356  
Old 08-31-2005, 12:43 PM
digidivakathy digidivakathy is offline
 
Join Date: Jul 2005
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PLEASE could someone help me with this?

I have made a vBulletin powered page with bio information about my team members and have managed to get everything perfect in FF, but I have one little problem in IE and don't know how to fix it. The time stat is over to the far right instead of at the bottom above the nav bar. I'm sure it's something very tiny, but I just don't know what it is...can anyone help me?

http://www.digiscrapdivas.com/forums/AAM_suzy.php

That's the page. If you have any other suggestions on how to make it look better, feel free to let me know, but I'm happy with it other than the little problem I described.

I'm sorry if this isn't the right place to ask this, but there are so many help forums out there that I didn't know where to start.

Thanks so much!!
Reply With Quote
  #357  
Old 08-31-2005, 08:46 PM
Huijting Huijting is offline
 
Join Date: Jul 2005
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SirAdrian
After calling global.php (and before the main output)
PHP Code:
if (!is_member_of($bbuserinfo6) AND !is_member_of($bbuserinfo8) AND !is_member_of($bbuserinfo13))
{
    
print_no_permission();

Replace "$bbuserinfo" with "$vbulletin->userinfo" if you are using 3.5

Thank U for this one , i have seen all the pages :squareeyed: and found it here

Rob
Reply With Quote
  #358  
Old 08-31-2005, 09:01 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by digidivakathy
I have made a vBulletin powered page with bio information about my team members and have managed to get everything perfect in FF, but I have one little problem in IE and don't know how to fix it. The time stat is over to the far right instead of at the bottom above the nav bar. I'm sure it's something very tiny, but I just don't know what it is...can anyone help me?
Try cleaning up your HTML a bit in your template, just as an example I noticed you opened a new <tr> without closing the last one, things like that will break the page, just keep in mind that IE and FFX render things differently, so it may appear fine on one and not the other...

Also, best place for that kind of thing would be the PHP / MySQL / JS / (X)HTML forum.
Reply With Quote
  #359  
Old 08-31-2005, 11:56 PM
MRGTB MRGTB is offline
 
Join Date: Dec 2004
Posts: 548
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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; 
Just to slightly improve on this for people who want to also add a link on there "Who's Online" page that links to the test page when clicked. You can also use this as a replacment for the above bottom code.

PHP Code:
case 'test'
            
$userinfo['action'] = 'Viewing Test Page';
            
$userinfo['where'] = "<a href=\"test.php\">Test</a>";
            break; 
Reply With Quote
  #360  
Old 09-11-2005, 12:17 AM
BlueBulletRL BlueBulletRL is offline
 
Join Date: Apr 2005
Posts: 91
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am currently trying to integrate a paypal store that I had purchased into my website. I used the template in the thread and couldn't get it to work the store actually uses a few files that it calls and uses. I tried adding the main page which calls all the files to the template file and use the ob_start(); thing such as you pointed out but still am unable to get it to bring up my page. Any insight and help and kicks in the right direction would be greatly appreciated. Oh and also my paypal store uses a mysql backend. Thanks

ok sweet looks like I got it to work........somewhat I get the page to display like my store front however when I click on one of my products instead of reloading the page like it should with just the product and all the details it just reloads my whole front page again. This is driving me nuts I'm gonna keep trying but if anyone has any ideas please let me know. Oh and it uses this at the end of the page do=buy&pid=6 within the actual file it does a post within its self thanks guys I NEED HELP!
Reply With Quote
  #361  
Old 09-16-2005, 06:41 PM
Nullifi3d Nullifi3d is offline
 
Join Date: Apr 2004
Location: FL, USA
Posts: 215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SirAdrian
After calling global.php (and before the main output)
PHP Code:
if (!is_member_of($bbuserinfo6) AND !is_member_of($bbuserinfo8) AND !is_member_of($bbuserinfo13))
{
    
print_no_permission();

Replace "$bbuserinfo" with "$vbulletin->userinfo" if you are using 3.5
IMO, an array would be better.

vB 3.0.x:
PHP Code:
if (!in_array($bbuserinfo['usergroupid'], array(6,8,13))) print_no_permission(); 
vB 3.5.x:
PHP Code:
if (!in_array($vbulletin->userinfo['usergroupid'], array(6,8,13))) print_no_permission(); 
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 06:13 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.07962 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
  • (1)bbcode_html
  • (13)bbcode_php
  • (5)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