PDA

View Full Version : Custom Page


djohn
03-29-2004, 05:03 PM
I have a little fancy gallery script, that I would like to be part of my board (3.0 Gold). All I need is somehow include() the script in a custom vB page, that has the usual menu, and footer. I want the gallery to open up in vb, when i call forums/gallery.php. I can add the link in the navigation bar myself, but i've no ide how can I make the gallery look like part of vB (with navbar, footer, etc), just on a separate page.

Any ideas?

RGSerge
03-30-2004, 05:32 AM
I have a little fancy gallery script, that I would like to be part of my board (3.0 Gold). All I need is somehow include() the script in a custom vB page, that has the usual menu, and footer. I want the gallery to open up in vb, when i call forums/gallery.php. I can add the link in the navigation bar myself, but i've no ide how can I make the gallery look like part of vB (with navbar, footer, etc), just on a separate page.

Any ideas?


I haven't tested this, but it should in logic work, I have tried to make variables and things respective to your problem.


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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'gallery');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups (add which ones you want)
$phrasegroups = array(

);

// get special data templates from the datastore (add what ones you want)
$specialtemplates = array(

);

// pre-cache templates used by all actions (add the templates you are using)
$globaltemplates = array(
'GALLERYHOME',
'gallery_table',
'gallery_row'
);


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



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

// Plus any others you need


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



// Do your processing here
// Parse templates you need like this:
eval('$template_handle = "' . fetch_template('template_name') . '";');

// There must be a matching $template_handle in your
// "base template", "GALLERYHOME" for these templates to show
// Construct GALLERYHOME using something like FORUMHOME as a guide,
// it will give you your basic vbulletin layout. There are some generic
// plage layout templates, I *think* you could use these.


// Print out the page
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('GALLERYHOME') . '");');

djohn
03-30-2004, 12:21 PM
Here's a better description of what i need.
Forum address: www.site.com/forums/index.php
Image gallery main page address: www.site.com/forums/gallery/index.php
Needed address: www.site.com/forums/gallery.php

Previously, i've used invision, and there i could do this simply by adding the required entry in www.site.com/forums/index.php. For example, if my file was gallery.php, i would add the folowing:

"gal" => "gallery",

And then if I called www.site.com/forums/index.php?act=gal I'd see my gallery. Contents of the gallery.php would be as follows:
<?php
$idx = new gallery;

class gallery {

var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $base_url = "";
function Articles()
{
global $ibforums, $DB, $std, $print;
require('/home/site/public_html/forums/gallery/index.php');
$print->add_output('');
$print->do_output( array( 'TITLE' => "Gallery", 'JS' => 0, NAV => array( "Gallery" ) ) );
}
}
?>
That would do it in invision, no skin modification would even be required.

The quiestion is, how can i do this in vBulletin, still having it's design, footer and header?

Velocd
03-30-2004, 05:48 PM
You want to route the address ./forums/gallery/index.php to ./forums/gallery.php?

This could be done easily enough through your server's Cpanel url redirects.

As for integrating the gallery, just use the template above in Serge's post and place the object declaration ($idx = new gallery) below:


require_once('./global.php');


You should place the class in a separate file.

You'll have to configure the vB PHP file to then contain:


require_once('./class_gallery.php');

chdir('../');
require_once('./global.php');

RGSerge
03-30-2004, 05:50 PM
Here's a better description of what i need.
Forum address: www.site.com/forums/index.php
Image gallery main page address: www.site.com/forums/gallery/index.php
Needed address: www.site.com/forums/gallery.php

Previously, i've used invision, and there i could do this simply by adding the required entry in www.site.com/forums/index.php. For example, if my file was gallery.php, i would add the folowing:

"gal" => "gallery",

And then if I called www.site.com/forums/index.php?act=gal I'd see my gallery. Contents of the gallery.php would be as follows:
<?php
$idx = new gallery;

class gallery {

var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $base_url = "";
function Articles()
{
global $ibforums, $DB, $std, $print;
require('/home/site/public_html/forums/gallery/index.php');
$print->add_output('');
$print->do_output( array( 'TITLE' => "Gallery", 'JS' => 0, NAV => array( "Gallery" ) ) );
}
}
?>
That would do it in invision, no skin modification would even be required.

The quiestion is, how can i do this in vBulletin, still having it's design, footer and header?


Not sure if the above post would do exactly what he wants it to do. This is just a tried and tested way, it works and it works well (see PHP code in attachment, it works).


VB has been built in a way where its very easy to expand upon it and make use of functions while keeping performance at an optimum.

Just try this... put the following code in a PHP file called integrate.php, upload it to your forum directory and run it.

You will be presented with a custom page, using the vbulletin template. header, footer everything.


<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'gallery');


// ################################################## #####################
// ######################### PRE-CACHE TEMPLATES #########################
// ################################################## #####################
$globaltemplates = array(
'GENERIC_SHELL',
'agallery',
'navbar'
);


$specialtemplates = array(
'smiliecache',
'bbcodecache'
);




// ################################################## #####################
// ######################### REQUIRE BACKEND #############################
// ################################################## #####################
require_once('./global.php');




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

$navbits = array();

$navbits = construct_navbits($navbits);


// Do your processing here (thats the code to get the gallery images into a table
// or whatever it does).

// BTW, the code to parse a template is:
// eval('$HTML = "' . fetch_template('agallery') . '";');

// $HTML is your main content area (the middle bit)




// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###

eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('GENERIC_SHELL') . '");');
?>



Very simple, very powerful, very effective.

Just try it.

djohn
03-31-2004, 01:03 PM
After some stress found this topic: https://vborg.vbsupport.ru/showthread.php?t=62164&page=1&pp=15 where I found everything i needed. Thanks, everyone!

Zachery
03-31-2004, 02:36 PM
After some stress found this topic: https://vborg.vbsupport.ru/showthread.php?t=62164&page=1&pp=15 where I found everything i needed. Thanks, everyone!
Garys isnt exactly the best ;) try my sig

Dean C
03-31-2004, 02:56 PM
There's nothing wrong with Gary's code at all Zachery :)

Boofo
03-31-2004, 03:04 PM
Nothing wrong with it at all execpt Zach came up with it first. ;)

13th_Disciple
03-31-2004, 04:20 PM
pissin contests are now cut off for you since you have become a mod, boofo.. leave that to us nobodies down here with our bellies to the floor..

Zachery
03-31-2004, 04:23 PM
There's nothing wrong with Gary's code at all Zachery :)
Mine actually explains what each bit is doing and how to replicate it ;)

His is just a shot at having another hack :)

Boofo
03-31-2004, 04:53 PM
pissin contests are now cut off for you since you have become a mod, boofo.. leave that to us nobodies down here with our bellies to the floor..

Damn! You take all the fun out of being a Mod now. ;)

What I need to know is can I trust you belly-walkers to handle it for me now that I'm forbidden? ;)