Webmaster Forum
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

UK Web Hosting
UK Web Hosting
Website Hosting
Website Hosting
UK One Way
UK One Way
Free Website Thumbnail Creator
 
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-01-2007, 08:43 PM
melkior_inactive
Guest
 
Posts: n/a
iTrader: / %
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-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">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, 10:35 PM
melkior_inactive
Guest
 
Posts: n/a
iTrader: / %
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, 01:58 PM
gkd_uk's Avatar
Super Moderator
 
Join Date: Mar 2007
Location: zeshaan.info
Posts: 3,653
iTrader: 3 / 100%
gkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud ofgkd_uk has much to be proud of
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, 11:14 AM
Shadab's Avatar
Member
 
Join Date: Dec 2007
Location: Bhopal (India)
Posts: 76
iTrader: 0 / 0%
Shadab is on a distinguished road
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 !
__________________
Webmaster Forum
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
Reply

Bookmarks

Webmaster Resources
UK Web Hosting
UK WW SEO Tools
Free site submission
Web Directory
 
Advertisement
Get top 10 exposure
 
Site Of the Month
BizzFace
Nominate site of the month
 
Tag Cloud
ads adsense ads space buy banners cheap off page packages cheap seo packages cheap seo services closing directory announcement e brochures facebook flash website promotion flash websites forum free directory google host quack hostquack inline price changes introduction ipn paypal payment boss job site link bid script hungarian link exchange linux host managemen lesson off page seo packages picture of the day ppc referral salesman jokes sell baners seo seonotes seo packages shared hosting submit url thumbnail today in history traffic travel uk shipping postcodes webinare webmaster tools websites for sale wordpress

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 02:25 AM
Getting a welcome box on the first page in vBulletin? Stephanie General Webmaster Talk 8 08-05-2007 02:55 PM
Creating Banners gkd_uk General Webmaster Talk 1 05-26-2007 12:36 PM
Creating your own blog melkior_inactive General Webmaster Talk 17 05-18-2007 12:29 AM
[Sale] Smooth & Sexy vBulletin Skin with custom postbit TheWebJunkie Marketplace (Buy, Sell, Trade or Exchange Forum) 4 04-04-2005 01:03 PM


All times are GMT. The time now is 04:00 AM.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149