vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to create your own vBulletin-powered page! (uses vB templates) (https://vborg.vbsupport.ru/showthread.php?t=62164)

Adrian Schneider 07-23-2005 04:56 PM

global.php
Find
PHP Code:

define('STYLEID'$style['styleid']); 

Above it, add
PHP Code:

if (THIS_SCRIPT == 'yourscriptname')
{
    
$styleid X


Make sure you have yourscriptname defined in your custom page.

derekivey 07-24-2005 12:47 AM

Thanks :)

Didn't work :(

MRGTB 07-26-2005 04:11 PM

I have a question, how can you create the template so it uses it own custom folder to store the template in, so the option is there to restore the template to original state.

Just like all the other vb templates use there own folders. Like FORUMHOME stores all the forumhome templates for example, if you understand what I mean to tidy things up much better in the admin template section.

MRGTB 08-02-2005 02:12 PM

I hate to reply to myself - but anybody got an answer to the above question? :surprised:

attroll 08-02-2005 04:17 PM

Quote:

Originally Posted by Gary Bolton
I have a question, how can you create the template so it uses it own custom folder to store the template in, so the option is there to restore the template to original state.

Just like all the other vb templates use there own folders. Like FORUMHOME stores all the forumhome templates for example, if you understand what I mean to tidy things up much better in the admin template section.

I know you can create a folder so that it is stored in its own folder but I don't know any way to have the template have a default code.

Adrian Schneider 08-02-2005 04:24 PM

To create the categories to store them in edit adminfunctions_template.php, at the very end add to the array.
PHP Code:

'prefix' => 'Text'

remember that for it to work, the template name must be "prefix" or contain "prefix_", and the text "Templates" is automatically added.

To be able to revert it, you must add it into the MASTER STYLE {requires being in debug mode}.

m0nde 08-02-2005 06:30 PM

Quote:

Originally Posted by SVTBlackLight01
OK. To answer my own question, on line 32, I replaced

Code:

require_once('./global.php');
with this

Code:

chdir('/home/site/public_html/testvb/');
require('./global.php');

;)

How can that work? Wouldn't you have to put the whole path to global.php once you change the directory?

- Sid

MRGTB 08-02-2005 07:05 PM

Quote:

Originally Posted by TheSpecialist
To create the categories to store them in edit adminfunctions_template.php, at the very end add to the array.
PHP Code:

'prefix' => 'Text'

remember that for it to work, the template name must be "prefix" or contain "prefix_", and the text "Templates" is automatically added.

To be able to revert it, you must add it into the MASTER STYLE {requires being in debug mode}.

Can you please be a little more clear in laymans terms. I really don't understand what your saying for me to do :disappointed:

Adrian Schneider 08-02-2005 07:12 PM

Okay, in /includes/adminfunctions_template.php there is an array at the very end of the file:
PHP Code:

// template groups
$only = array
(
    
// phrased groups
    
'buddylist' => $vbphrase['group_buddy_list'],
    
'calendar' => $vbphrase['group_calendar'],
    
'faq' => $vbphrase['group_faq'],
 ... 

Each of these creates a 'folder' into the template manager to oraganize your templates. You can add your own in using the above format (left part is the prefix, right part is the 'folder' Name (which automatically adds Templates to the end).

Example:
PHP Code:

    'attachmentlist' => $vbphrase['group_attachment_list'],
    
'subscription' => $vbphrase['group_paid_subscriptions'],
        
'league' => 'League'// I added this one 
    
'aaa' => 'AAA Old Backup' 


MRGTB 08-02-2005 11:41 PM

Quote:

Originally Posted by TheSpecialist
Okay, in /includes/adminfunctions_template.php there is an array at the very end of the file:
PHP Code:

// template groups
$only = array
(
    
// phrased groups
    
'buddylist' => $vbphrase['group_buddy_list'],
    
'calendar' => $vbphrase['group_calendar'],
    
'faq' => $vbphrase['group_faq'],
 ... 

Each of these creates a 'folder' into the template manager to oraganize your templates. You can add your own in using the above format (left part is the prefix, right part is the 'folder' Name (which automatically adds Templates to the end).

Example:
PHP Code:

    'attachmentlist' => $vbphrase['group_attachment_list'],
    
'subscription' => $vbphrase['group_paid_subscriptions'],
        
'league' => 'League'// I added this one 
    
'aaa' => 'AAA Old Backup' 


Your a star, that works great and I created a new line called:
'vbindex' => 'vBindex',

And it moved all my loose vbindex templates into the folder so everything is nice and neat now. I have one other question though that I also hope you can help me with the finish it off.

By default when you go into a templates folder and view a template there, there is an option to view the default template code in-case you mess up. So you can copy and paste that code back intoi the box and save.

I noticed even though I now have all my vbindex templates in there own folder under default template, the option to view default template just shows me a blank white box with no code in it. Is it possible to make that show the default code for all my vbindex templates when clicked for each one?

Marco van Herwaarden 08-03-2005 04:34 AM

That is because they are custom templates. If you want to show them also as default, you will have to set them manually in the database to belong to styleid -1.

This can however mean that they get removed on a vB upgrade.

/me didn't have his coffee yet, so use the above only on a testboard.

MRGTB 08-03-2005 12:44 PM

Does that also mean then if you make some manual edits to some of the default templates, like when you add a new mod that requires some edits in FORUMHOME templates, the chances are an update to an higher version can mess things up becuase they were default templates edited,

Out of interest how would you go about making them changes in your database. Would you go into the template section and edit each template and change the ID.

JMH11788 08-03-2005 11:53 PM

I have this hack working perfect for my forum rules, but I tried making another page today using a template called ARTICLES and a .php file called articles.php. I modifed the template and .php file correctly, but when I go to http://forums.theoverclocked.com/articles.php, I get that error. :confused: Can anyone help?

EDIT: Nvm...appears to be working now....wierd

Selene 08-04-2005 12:57 AM

thanx

derekivey 08-04-2005 01:18 AM

I still can't get it to show the page in a certain style, it always shows it in the style the user is using. Any ideas?

MRGTB 08-04-2005 03:14 PM

Sorry can't help you there, I only use the default style here, so I don't have that problem.

But I also would still like to know how you edit your database so the new template displays a default template for in the edit template page.

James Grant 08-04-2005 08:27 PM

This is a really useful bit of code, but i want to change the style to something different too :ermm:

TylerL 08-06-2005 04:47 PM

Am I the ONLY one with this error?

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/myovercl/public_html/sudburyskate/skatespots/index.php on line 43

PHP Code:

  <?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''index'); // 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(
    
'skatespots',
);

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

);

// ######################### REQUIRE BACK-END ############################
chdir('$vboptions[homeurl]/');
require(
'./global.php');

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

$navbits = array();
$navbits[$parent] = 'Sudbury Skate Spots'';

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

?>

Created a template called 'skatespots'. The file is located at:

http://www.sudburyskate.com/skatespots/index.php

Adrian Schneider 08-06-2005 05:13 PM

PHP Code:

$navbits[$parent] = 'Sudbury Skate Spots''; 

should be
PHP Code:

$navbits[$parent] = 'Sudbury Skate Spots'

(it had an extra quote)

Also,
PHP Code:

chdir('$vboptions[homeurl]/'); 

won't work, as $vboptions is set after global.php is ran, and of course even if it was set, you can't use variables inside single quotes.:)

Quote:

Originally Posted by James Grant
This is a really useful bit of code, but i want to change the style to something different too :ermm:

Assuming you are on 3.0.x: (mine is 3.0.7, may be a little dif)

global.php - find:
PHP Code:

$styleid intval($styleid); 

Above it, add:
PHP Code:

if (THIS_SCRIPT == 'yourscriptname')
{
    
$styleid X;


(where yourscriptname is what you have defined at the top of your page)

cnczone 08-10-2005 04:37 PM

Has this been redone for VB 3.5?

Adrian Schneider 08-10-2005 04:38 PM

Quote:

Originally Posted by cnczone
Has this been redone for VB 3.5?

Tis the exact same for both. :)

JohnBee 08-11-2005 06:10 PM

I would l like to use vB templates to design a dynamic page (with changing content)
specificaly the page is for news and would have a: Page 2 >> Page 3 >> type of arrangement. but I want to keep the vB header and footer active.

Normally this is not a problem on a regular .php page because I can use php includes but using vBulletins php include variable in the php_include_start template I am limited to one variable. The news page links are generated on the fly with there own unique ID's.

Is there any way to call php includes from an external file or something to get this working? can this addon do this?

Any help on this would be greatly appreciated

AndyA 08-15-2005 07:00 PM

Great I've got the page showing http://www.throttlejockey.co.uk/forum/info.php but am I right in thinking that any text is entered into the template and not the page itself ?

How do I get links or images to work on my new page ?

BigIke 08-15-2005 09:52 PM

Quote:

Originally Posted by AndyA
Great I've got the page showing http://www.throttlejockey.co.uk/forum/info.php but am I right in thinking that any text is entered into the template and not the page itself ?

How do I get links or images to work on my new page ?

Yes. What you want to put on the actual page goes into the template. However, whatever goes into the template must be html. So you can't put http://img.photobucket.com/albums/v1...4/P9060045.jpg that url and expect to have the image come up, you must use html like this:
HTML Code:

<img src="http://img.photobucket.com/albums/v185/andyaveyard/Tan%20Hill%20Meet%204-9-04/P9060045.jpg"></img>

keymistress 08-16-2005 03:56 AM

erm... for those who are using this mini mod for sub-domains, you have to add these two steps for it work:

find
PHP Code:

require_once('./global.php'); 

and add this before it
PHP Code:

define('CHDIR_PATH''/usr/local/psa/home/vhosts/yourdomain.com/subdomains/forums/httpdocs'); //just an example, please change to your own forum's full path
chdir(CHDIR_PATH); 

next you'll need to copy the login.php from your forums folder and paste it in your sub-domain directory. also find
PHP Code:

require_once('./global.php'); 

and add this before it
PHP Code:

define('CHDIR_PATH''/usr/local/psa/home/vhosts/yourdomain.com/subdomains/forums/httpdocs'); //just an example, please change to your own forum's full path
chdir(CHDIR_PATH); 

after that the mod will work for your sub-domain... just something i discovered while trying it for my own site... hope it helps!

eljeffe 08-21-2005 03:03 AM

I created a index.php file for our IRC chat client. I built a vbulletin header and footer wraper for it and it works like a champ. However, my chat client is outside the vB forum directory and the navbar links contain the wrong URL.

For the purposes of this example, my forums directory is in: http://www.mydomain.com/forums

My chat directory is in: http://www.mydomain.com/chat

I'll eventually have several other features that will be a subdirectory off of the http://www.mydomain.com/ website (i.e., chat, photos, files, journal, etc...)

Anyone have any ideas on what I can do to fix this. Here is the code in my index.php file:

PHP Code:

<?php 

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

        
// #################### DEFINE IMPORTANT CONSTANTS ####################### 
        
define('NO_REGISTER_GLOBALS'1); 
        
define('THIS_SCRIPT''index'); // 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( 
                    
'java_irc_client'
                ); 

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

                ); 

        
// ######################### REQUIRE BACK-END ############################ 
        
chdir('/home/www/mydoman.com/forums');
        require_once(
'./global.php'); 

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

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

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

?>

Any ideas are appreciated.

Thanks

MRGTB 08-21-2005 03:21 AM

Can you not move your IRC into your forums folder, things would be much easier for you then

eljeffe 08-21-2005 03:30 AM

Quote:

Originally Posted by Gary Bolton
Can you not move your IRC into your forums folder, things would be much easier for you then

I'm trying to keep my vb directory as clean as possible. I have to imagine there is some way to do this without throwing everything into the top directory of the forums.

Quote:

Originally Posted by Gary Bolton
Can you not move your IRC into your forums folder, things would be much easier for you then

Gary,

On second thought, I don't have a problem with keeping chat.php in my forum directory and accessing the chat system via http://www.mydomain.com/forum/chat

However, I would like to store the jar files, images, and support files outside of the forum directory. Even a subdirectory under forums (like chat) would work for me.

o0stephane0o 08-26-2005 12:44 PM

How would I create a page that only group ID 6, 8, 13 can see?
I tried with the information page 2 but it doesn´t work

Adrian Schneider 08-26-2005 03:09 PM

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

---MAD--- 08-27-2005 11:32 AM

the online thing doesnt work :S

Adrian Schneider 08-27-2005 06:19 PM

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.

geoff4787 08-30-2005 05:15 AM

Thanks, great tutorial!

o0stephane0o 08-30-2005 07:27 AM

SirAdrian it works like a charm, thanks a lot ;)

digidivakathy 08-31-2005 12:43 PM

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!!

Huijting 08-31-2005 08:46 PM

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

Adrian Schneider 08-31-2005 09:01 PM

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.

MRGTB 08-31-2005 11:56 PM

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; 


BlueBulletRL 09-11-2005 12:17 AM

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!

Nullifi3d 09-16-2005 06:41 PM

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(); 



All times are GMT. The time now is 12:41 AM.

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.03500 seconds
  • Memory Usage 1,924KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (27)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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