vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=192)
-   -   [How to] Add custompages to your forum (https://vborg.vbsupport.ru/showthread.php?t=124749)

utw-Mephisto 08-22-2006 10:00 PM

[How to] Add custompages to your forum
 
This is not really a mod, since this is simply a "reminder" of a function build in but not documented. Submitted also to vbulletin.com of course.

If you would like to add custom pages (including header / footer of your forum) do the following:

Add a new template in the style of your choice. You can name it whatever you want, it has to have the prefix
Code:

custom_
though.

You are then able to call the custompage using

http://www.ut2007world.com/misc.php?do=page&template=test2

Change www.ut2007world.com with your domain and the test2 with your template name accordingly.

Lets make an example.

Admincp > Styles & Templates > Style Manager > In drop down choose Add New Template

Name the template for example custom_google

Use the following code :

Code:

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

$header
$navbar
<!-- Custom Code Start Here -->
<center>
<iframe src="http://www.google.com" width="80%" height="400"></iframe></center>
<!-- / Custom Code Ends here -->
$footer
</body>
</html>

As you can see, I just use an iframe for you to see any results.

Now use your web-browser and go to

http://<domain>/misc.php?do=page&template=google

And change the domain to your own.

See attached a screenshot how the above example would look like. Also attached a default html code for a template. The page name will be automatically parsed in the navbar.

If you would like to have the code displayed for certain usergroups only, you can add one ID

Code:

<if condition="$bbuserinfo['usergroupid'] == '6'">
</if>

Or more usergroup IDs

Code:

<if condition="$bbuserinfo['usergroupid'] == '5' OR $bbuserinfo['usergroupid'] == '6' OR $bbuserinfo['usergroupid'] == '7'">
</if>

If you just would like to make sure that ANY user who is registered can see the code, regardless of its group, add

Code:

<if condition="$bbuserinfo[userid]">
</if>

instead.

Example code would be now:

Code:

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

$header
$navbar         
<if condition="$bbuserinfo[userid]">
<!-- Custom Code Start Here -->
<center>
<iframe src="http://www.google.com" width="80%" height="400"></iframe></center>
<!-- / Custom Code Ends here -->
</if>
$footer
</body>
</html>


On request:
Creating Custom Pages using vbadvanced
Anyway, some people would like to add for example flashchat, irc chat or simple iframes including all those modules etc. etc.

Some demos :

FlashChat
Custom Stuff

etc. etc.

So lets get started.

First, you need to create a template. Lets use as exmaple an iframe where google.com runs in it ...

Create a new template with the prefix adv_portal_ and name it for example google.

Admincp > Styles & Templates > Style Manager > In drop down choose Add New Template

http://img168.imageshack.us/img168/4764/2pi5.th.jpg

Put in the code

Code:

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

$header
$navbar
<!-- Custom Code Start Here -->
<center>
<iframe src="http://www.google.com" width="80%" height="400"></iframe></center>
<!-- / Custom Code Ends here -->
$footer
</body>
</html>

and call it adv_portal_google

http://img168.imageshack.us/img168/9233/1ao2.th.jpg

Now add a new Page which is Template Based

http://img168.imageshack.us/img168/2752/2ms5.th.jpg

Page Title : What you would like to have displayed in the browser title bar
Page Identifier : This is the variable that will be used in the URL to link to this page. For example, if this option is set to 'games', then the link to this page would look like this: /cmps_index.php?page=games
Template : adv_portal_google

Should look something like

http://img168.imageshack.us/img168/1...tledso5.th.jpg

You don't have to use the Module Shell Template Options, only if you would like to have a typicall box around the stuff you display including the button to expand / collapse it

Now the important stuff : modules

There is not really a guideline for it ... The most important modul you need :

Custom Page Content

If you don't use it - you will get a white page ..

But for this example, lets disable all modules in the middle, except the one just mentioned, and some modules on the left and right. You will proparbly have a different module set, but once again : Custom Page content MUST and WILL be there :)

http://img169.imageshack.us/img169/4...tledht8.th.jpg

Since you named the identifier google - you can browse now to that page using

http://<domain>/cmps_index.php?page=google


IF you renamed cmps_index.php to index.php - you need to change that of course...

Here is a demo :

http://www.ut2007world.com/index.php?page=google


http://img169.imageshack.us/img169/3...tledep9.th.jpg

Selene 08-23-2006 11:41 PM

excellent and very useful!

thanks for it.

tested and worked

utw-Mephisto 08-23-2006 11:42 PM

Glad to hear :) Its a shame that this is not documented even though its a build in option :)

Selene 08-24-2006 10:34 AM

utw, just one question tho, what i want that page to be viewed by Registered Members only. Is that possible?

Benedict 08-24-2006 10:36 AM

That's a great hack thank you.

I too would be interested in knowing if i can modify this to show for selected usergroups :)

utw-Mephisto 08-24-2006 10:47 AM

Quote:

Originally Posted by Selene
utw, just one question tho, what i want that page to be viewed by Registered Members only. Is that possible?

You could add an <if> condition to achieve it

Code:

<if condition="$bbuserinfo['usergroupid'] == '2'">
</if>

where the 2 is the usergroup id which is in this example registered user.

If you would like to speficy or usergroupids use

Code:

<if condition="$bbuserinfo['usergroupid'] == '5' OR $bbuserinfo['usergroupid'] == '6' OR $bbuserinfo['usergroupid'] == '7'">
and so on .. the complete template would look like

Code:

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

$header
$navbar
<if condition="$bbuserinfo['usergroupid'] == '6'">
<center>
<iframe src="http://www.google.com" width="80%" height="400"></iframe></center>
</if>
$footer
</body>
</html>

However, I am not a professional if it comes to <if> stuff. In this example you simply would not see the iframe instead of getting an error and you need to specify each usergroup id .. if you specify registered user, you still need to add administrator as well otherwise you won't be able to see it either ..

There is another solution for this, I simply don't know it... but lemme browse a bit here and on vb.com - I might come up with a solution ...

Benedict 08-24-2006 10:58 AM

That looks good enough for me. Thank you for the clear and thorough response :D

utw-Mephisto 08-24-2006 11:01 AM

Not good for me though - I NEED to know :D :D :D

I will keep you posted of course ..

utw-Mephisto 08-24-2006 11:08 AM

Ok, if you use

<if condition="$bbuserinfo[userid]">

instead, you don't have to specify all usergroup ids, still no error though ..

Selene 08-24-2006 11:53 AM

Ok i wanted guests not to view that page.

So i did:

Quote:

<if condition="$bbuserinfo['usergroupid'] == '2'">

(my code)

</if>
For the msg that i wanted to show the "guests" i just used IF code again and specified the Guest usergroup and wrote the msg so it works now :)

Cool!

utw-Mephisto 08-24-2006 03:18 PM

Quote:

Originally Posted by Selene
Ok i wanted guests not to view that page.

So i did:



For the msg that i wanted to show the "guests" i just used IF code again and specified the Guest usergroup and wrote the msg so it works now :)

Cool!

Nice "think outside the box" - solution - cool ..

utw-Mephisto 08-24-2006 04:30 PM

Ok, I was playing around a bit..

If your template would look like

Code:

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

$header
$navbar
<if condition="$bbuserinfo[userid]">
<center>
<iframe src="http://www.google.com" width="80%" height="400"></iframe></center>
<else />               
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="70%" align="center">
<tr>
        <td class="tcat">vBulletin Message</td>

</tr>
<tr>
        <td class="panelsurround" align="center">
        <div class="panel">
                <div align="left">
       
                               
                        <!-- main error message -->
                       
                       
                        <blockquote><p><p><strong>$bbuserinfo[username]</strong>, you do not have permission to access this page. This could be due to one of several reasons:</p>

<ol>
        <li>Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?</li>

        <li>If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.</li>
</ol>

<div align="right">
        <a href="login.php?do=logout&amp;logouthash=b79dddc3a894bac9fea040e270f00ee7">Log Out</a>
        <a href="index.php?">Home</a>
</div></p></blockquote>
                       
                               
                        <!-- / main error message -->                       
               
               
                </div>
        </div>

        <!--
        <div style="margin-top:6px">
                <input type="submit" class="button" value="Go Back" accesskey="s" onclick="history.back(1); return false" />
        </div>
        -->
        </td>
</tr>
</table>               
                </if>
$footer
</body>
</html>

Which would look like

http://img20.imageshack.us/img20/4681/untitledhw6.jpg

You can also remove the $bbuserinfo[username] and replace it with something you like or whatever ...

Since I am using in the example above <if condition="$bbuserinfo[userid]"> - it will give out an error regardless of the usergoupid

Selene 08-24-2006 05:07 PM

utw, nice one!

thanks a lot for this one. I am going to use this custom page thing on my vbulletin site.

Kirk Y 08-24-2006 07:09 PM

Why doesn't vBulletin document things like this -- it's a huge time-saver.

LanciaStratos 08-24-2006 09:26 PM

I've got to echo what others have said here - this is an outstanding integrated feature of vBulletin that deserves a LOT more attention. Finding this thread has saved me a few hours of coding and testing, and like they say, time is money. Spread the word on this great feature, guys, and many thanks to utw for bringing this up!!! :)

Jeordie015 08-24-2006 09:29 PM

How would you change it so in the little nested directory thing showing where you are has a different name than just the template name. Using the example in the first post. It would just say that you were in test2. And that looks a little weird.

Edit: The reason why I am asking is that I want the name to be two separate words, and you can't have spaces...so yeah.

utw-Mephisto 08-24-2006 10:06 PM

Added to vbulletin.com too :)

http://www.vbulletin.com/forum/showthread.php?t=197563

Thanks guys for the great responses :) :D

utw-Mephisto 08-24-2006 10:10 PM

Quote:

Originally Posted by Jeordie015
How would you change it so in the little nested directory thing showing where you are has a different name than just the template name. Using the example in the first post. It would just say that you were in test2. And that looks a little weird.

Edit: The reason why I am asking is that I want the name to be two separate words, and you can't have spaces...so yeah.

Don't quite understand what you mean tbh .. You can give the template any name, example :

Lets call the template custom_Jeordie015

Here the result :

http://www.ut2007world.com/misc.php?...ate=Jeordie015

utw-Mephisto 08-24-2006 10:25 PM

Added instructions (on request) how to use vbadavanced for custom pages and also how to use permissions.

utw-Mephisto 08-24-2006 10:40 PM

Quote:

Originally Posted by Jeordie015
How would you change it so in the little nested directory thing showing where you are has a different name than just the template name. Using the example in the first post. It would just say that you were in test2. And that looks a little weird.

Edit: The reason why I am asking is that I want the name to be two separate words, and you can't have spaces...so yeah.

Good question. Try this :

Create an empty file and use the following code :

Code:

<?php

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

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'test'); 

// #################### 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(
        // change the lines below to the list of actual templates used in the script
        'test',
);

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

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

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('"clientscript', '"' . $vbulletin->options['bburl'] . '/clientscript', $headinclude);

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

$navbits = array(); 
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Test Page';

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

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('test') . '");');

?>

Check the comments within the code to see what you need to change ..

Basicially the colored code.

Here you can specify the title using more than one word.

Now simply call the php file, like http://<domain>/<php file>

Jeordie015 08-25-2006 04:27 AM

Okay, let me be more specific. If I wanted the page to be for a Top 10 List, how would I be able to call it that with the spaces? In the header, you have the directory structure break down, and if you called the template "top10list," that's how it would look in the header thing, and that doesn't look right.

Onur 08-25-2006 05:29 AM

Hello, to check more than 1 or 2 Usergroups i think
Code:

<if condition="is_member_of($bbuserinfo, 2,3,4,5,6)">
is more clear ;)

utw-Mephisto 08-25-2006 07:24 AM

Quote:

Originally Posted by Jeordie015
Okay, let me be more specific. If I wanted the page to be for a Top 10 List, how would I be able to call it that with the spaces? In the header, you have the directory structure break down, and if you called the template "top10list," that's how it would look in the header thing, and that doesn't look right.

This works with the file I gave you ...

Check out what I mean :

http://www.ut2007world.com/top10.php

utw-Mephisto 08-25-2006 07:25 AM

Quote:

Originally Posted by Onur
Hello, to check more than 1 or 2 Usergroups i think
Code:

<if condition="is_member_of($bbuserinfo, 2,3,4,5,6)">
is more clear ;)

Thanks, I was also thinking using in_array yesterday.... :) But yet again - my knowledge is limited - therefore thanks a lot for the tip ..

Ninth Dimension 08-26-2006 01:00 AM

Great tutorial, thank you very much. I'm not using it just yet, but I will be shortly :D

Jeordie015 08-26-2006 01:42 AM

Either I'm missing something or you didn't explain how to do what I'm wanting to do. All I'm able to figure out is to make a template called custom_whatever and I'll be able to view that by going to boardurl.com/misc.php?do=page&template=whatever

How exactly would I be able to create something like your top10.php?

Kirk Y 08-26-2006 01:52 AM

That'd require creating a new PHP file. Psionic Vision has posted a tutorial on doing this in the Articles forum.

utw-Mephisto 08-26-2006 12:21 PM

Quote:

Originally Posted by Jeordie015
Either I'm missing something or you didn't explain how to do what I'm wanting to do. All I'm able to figure out is to make a template called custom_whatever and I'll be able to view that by going to boardurl.com/misc.php?do=page&template=whatever

How exactly would I be able to create something like your top10.php?

Just a few posts up :)

https://vborg.vbsupport.ru/showpost....5&postcount=20

VBUsers 08-26-2006 06:17 PM

i added this hack and it works great but i wanted to know if there was a way to do it as a hard file. like test.php and have the content you need in there.

i tried it your way but i have 2 js scripts i need to be pulled into the page and its not working. what can i do?

utw-Mephisto 08-26-2006 06:28 PM

You mean no templates at all ?

Unfortunately my knowledge is a bit limited in how to pull header and footer in a custom file. Maybe this helps:

http://www.vbulletin.com/forum/showp...18&postcount=1

I can search myself too - but so far no idea tbh ...

VBUsers 08-26-2006 06:33 PM

Quote:

Originally Posted by utw-Mephisto
You mean no templates at all ?

Unfortunately my knowledge is a bit limited in how to pull header and footer in a custom file. Maybe this helps:

http://www.vbulletin.com/forum/showp...18&postcount=1

I can search myself too - but so far no idea tbh ...

yea i know theres a way im using 3.6. the post you gave me is great but not what i need. thanks alot i appreciate it.

utw-Mephisto 08-26-2006 06:36 PM

I simply don't get 100% what you want ... You want to use basicially a totall independend script which simply has header and footer from the forum ?

utw-Mephisto 08-26-2006 06:48 PM

<a href="https://vborg.vbsupport.ru/showthread.php?t=98009" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=98009</a>

Maybe this helps ..

VBUsers 08-26-2006 06:48 PM

edit: made my own thread

utw-Mephisto 08-26-2006 11:12 PM

If you find a way please do me a favour and share your knowledge :) Might be usefull in the future. ...

VBUsers 08-26-2006 11:29 PM

Quote:

Originally Posted by utw-Mephisto
If you find a way please do me a favour and share your knowledge :) Might be usefull in the future. ...

ill make sure to come back here. i had one made for 3.5 but it wont work. so now i need one made

this is the site i need it for.

http://www.geekscore.com/forums/

still in progress but i should be done with everything in 3 days.

www.geekscore.com

Snake 08-30-2006 04:07 PM

Thanks for the hack! I'll install it right away... :)

category 08-31-2006 02:59 AM

ok i have a problem users show as log out when i press my custom template

Smoothie 08-31-2006 04:46 AM

Quote:

Originally Posted by Snake
Thanks for the hack! I'll install it right away... :)

Are you drunk or something? You've posted this same nonsense in like 15 threads.

BETIServices 08-31-2006 04:21 PM

I'm been looking for this info all over, thank you!

One question, I have a script that I need to execute a code (custom_scripthere) and it calls another script page to bring the results code.

How I will do that?

Script => Results


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01574 seconds
  • Memory Usage 1,871KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete