Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum - UKWW > General > General Webmaster Talk > Running a forum > Forum Software
Register FAQ Members List Downloads Calendar Today's Posts Webmaster Resources Webmaster Blogs
 
 

Forum Software Discussions and questions how to use or modify particular forum software.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-01-2007, 06:43 PM
melkior_inactive
Guest
 
Posts: n/a
Default Creating a custom page in vBulletin

I've often seen people asking how to create a page inside vBulletin which would contain custom content.
And I had to do it myself a couple of times.

When in need of something like this people usually just save some vB page on their disk, edit it and upload it. This works OK, the page looks like the rest of your forum.
But, your user doesn't see the dynamic content (like wether he's logged in or not) and if you make modifications to the header, footer or CSS you'll need to make them on the static custom page as well.
That's OK if you have one page to take care of. But if you have multiple pages it gets boring and also too complicated.
And sometimes you'll need to modify the content of the custom page and you don't have access to the FTP of the site.
Well, this is how you create a page that will be the part of your vBuletin forum, and it's content will be located in a custom template so it makes it easy to modify.

First create a PHP file and name it as you'd like to call the page.
We'll use example.php. Create that file and put this code into it:
PHP Code:
<?php
  error_reporting
(E_ALL & ~E_NOTICE);
 
 
define('NO_REGISTER_GLOBALS'1);
 
define('THIS_SCRIPT''example');
 
 
$phrasegroups = array();
 
 
$specialtemplates = array();
 
 
$globaltemplates = array(
 
'CUSTOMPAGETEMPLATE'
 
);
 
 
$actiontemplates = array();
 
 require_once(
'./global.php');
 
 eval(
'$navbar = "' fetch_template('navbar') . '";');
 eval(
'print_output("' fetch_template('CUSTOMPAGETEMPLATE') . '");');
 
 
?>
First of all you need to do some modifications to the code above since this is only an example. 3 modifications are necessary to get your custom page going:
On line:
PHP Code:
define('THIS_SCRIPT''example'); 
You need to change example to the name of your custom page without the .php extension. So if you called your custom page dollhouse.php this line would read like this:
PHP Code:
define('THIS_SCRIPT''dollhouse'); 
Next two modifications are on lines 12 and 20.
Substitute CUSTOMPAGETEMPLATE with the name of the custom template you'll be creating in a second. It's best to call it descriptively so you'll find it easier, and know what it does.
Note the name cause you'll need it later.
If you're really interested, the code above communicates with the rest of the vBulletin and calls out the template you'll create. It also takes out the content from the template CUSTOMPAGETEMPLATE so it renders as the part of vBulletin.
OK, upload the file to your web server, in the forum's root folder.

You've got the page. Now you need content for it. Let's do it.
Go to your Admin CP, log in and select Styles & Templates from the left menu. Click on the Style Manager link. Find the name of your active style and select Add New Template from the drop down menu. Press Go if the page doesn't load automatically.
This part of the Admin CP allows you to create custom templates. And that is exactly what we want.
There are two fields you'll need to fill: title and content.
Remember the name of the custom template I said you should note? Write it under Title. In my example it would be CUSTOMPAGETEMPLATE.
And put this code under content:
PHP 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-width1px;
    
border-right-width1px;
    
border-bottom-width1px;
    
border-left-width1px;
    
border-top-stylesolid;
    
border-top-color#000000;
    
border-right-color#000000;
    
border-bottom-color#000000;
    
border-left-color#000000;
}
.
all {
    
border1px 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">My super cool example page</td>
            </
tr>
            <
tr>
              <
td>And this is my super cool content!</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
OK, this is your page. Change the name of the page on line 39 and the content on the line 42. You can put here anything you like. You'll notice that the actual content of the page is a table with two rows. The first row is the title of the page so keep it short and informative. The second row is the content of the page.
You can put anything you like here.
After you've designed your page press the Save button and you're off.
Navigate to the page to see if it's working and wether everything is OK.
Don't forget to link to the page! :-)

One more important notice. Not all forums have just one style. In fact most of them have various skins and allow the members to choose the skin they like. If this is the case with your vBulletin forum, then you should create the same template in every active style and name it the same.
Once the user navigates to the page, the script itself will decide which template to use according to the skin the user has set.

If you see a white page when you navigate to your custom page it means that you either misspelled the name of the template, or you didn't create it at all.

Well that's about it.
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 05-01-2007, 08:35 PM
melkior_inactive
Guest
 
Posts: n/a
Default

I forgot to add, when a new version of vBulletin comes out, it might happen that you'll need to change the code a little bit but this should work for vB 3.5.4-3.6.5 (maybe others too).
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 05-03-2007, 11:58 AM
gkd_uk's Avatar
Super Moderator
1904 posts this year. Platinum VIP!
Trusted Member - This user is a Master!
Last months UKWW Tokens: 73
 
Join Date: Mar 2007
Location: zeshaan.info
Posts: 3,717
Thanks: 1
Thanked 10 Times in 8 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Default

Great post Melkior
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 01-18-2008, 10:14 AM
Shadab's Avatar
Member
90 posts this year. Executive spud!
We have not managed to scare them away..
Last months UKWW Tokens: 2
 
Join Date: Dec 2007
Location: Bhopal (India)
Posts: 80
Thanks: 1
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Send a message via MSN to Shadab Send a message via Yahoo to Shadab
Default

I am already using this technique to create a Privacy Policy page for my Forum.

Thanx anyway !
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 09-29-2008, 09:02 AM
GrAveTzT's Avatar
Junior Member
20 posts this year. the lights are on!
User is on their way up.
Last months UKWW Tokens: 30
 
Join Date: Apr 2008
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Default

This was very usful for me!
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Webmaster Resources
UK WW SEO Tools
Find UK Hosts
 
The Forum Rules
Forum Rules - MUST READ
 
Site Of the Month
BizzFace
Nominate site of the month
 
Tag Cloud
43. wholesale adsense ready affiliate scam amazon apple iphone 16gb apple iphone 16gb 3g articles australia web hosting cash casino cheap clothes communications content custard media database dgital camerals directory domain name english teacher fantasy football fantasy football league football league free handbags home income instant jewelry link bid money money making online music news nokia n96 16gb online online shop poker professor replica sam allcock seo social networking sony vaio laptop sunglasses technology themes tutor verbalized wallet wallets wanted web web hosting widget ready wordpress xmas offer

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips for creating better website temi Webmaster Tips and Tricks 11 03-21-2008 01:25 AM
Getting a welcome box on the first page in vBulletin? Stephanie General Webmaster Talk 8 08-05-2007 12:55 PM
Creating Banners gkd_uk General Webmaster Talk 1 05-26-2007 10:36 AM
Creating your own blog melkior_inactive General Webmaster Talk 17 05-17-2007 10:29 PM
[Sale] Smooth & Sexy vBulletin Skin with custom postbit TheWebJunkie Marketplace (all other buy/sell/wanted) 4 04-04-2005 11:03 AM


All times are GMT. The time now is 09:41 PM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0