Log in

View Full Version : Please help me tweak my outside vb directory page...


bigtime
05-24-2006, 05:08 AM
Hi,

I have a php script that has a header and footer file. I want to use the vbulletin header and footer for the script.

If I'm going about this the wrong way, please let me know. If I'm on the right track, please tell me how to display this code $testing = "this is a test";
echo 'This is my content and here is the value of $testing';which is near the bottom of my sample page below. My code is showing everything but that code and it can be seen in action here: http://www.rental-script.com/review_test/test2.php


<?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', 'test2');

// #################### 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_header',
'test_footer',
);

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

// ########################## REQUIRE BACK-END ############################
chdir('../testvb');
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') . '";');

$title = "this is my title";

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

/* I want to show this code" */
$testing = "this is a test";
echo "This is my content and here is the value of $testing";

eval('print_output("' . fetch_template('test_footer') . '");');
?>


Thanks,

Tim

Rich
05-24-2006, 12:35 PM
If I were doing what you are looking to do, I would create 3 templates instead of 2. I would assign a variable to the test footer and test header like:


eval('$testheader = "' . fetch_template('test_header') . '";');
eval('$testfooter = "' . fetch_template('test_footer') . '";');


and then I would create a third template as:


eval('print_output("' . fetch_template('new_template') . '");');


Within the new template, just add $testheader and $testfooter whereever you want them to appear. Between the 2 you can add whatever you like without having to echo anything.

bigtime
05-24-2006, 03:29 PM
Thanks Rich. In my original php script there are 100 different files/pages that are all run with a header/footer.

Is there a way I can add the vb header and footer to the other scripts header/footer file? It seems to me that using the method above, I would need to create 100 templates?

Thanks,

Tim

Rich
05-24-2006, 04:22 PM
Before I go and give it a whirl at explaining this, have you considered using a CMS? vBadvanced allows you to pull PHP files in a "module" type of setting. Since vBadvaced is already 100% integrated with vBulletin, this would likely be the easiest way to do this.

It allows you to create pages, in unlimited quantities, using external or internal files and templates. The url would read:

index.php?page=YourPageName

and it would be automatically added to a vb page! For more information on this, check out: http://www.vbadvanced.com

Did I mention it is free? lol

With 100+ pages to add, no matter how you go about doing this, you are looking at some work. I believe this would be the easiest method though.

bigtime
05-25-2006, 01:47 AM
Even though I have 100 pages in my review script, the header and footer are all controlled by one php file. If I could get that one php file to show the vbulletin header and footer, I'd be set! It doesn't seem like it would be that hard to do!

Thanks again for your input!

Tim

Rich
05-25-2006, 11:36 AM
Ok, I think I am officially confused now. lol


Even though I have 100 pages in my review script, the header and footer are all controlled by one php file.


So you must be using a review script of some sort? I am asking because if this is the case, could you please post what the file contains that is controlling the header and footer so we can see how they are processing it?

I was a bit thrown off because your first post is showing a vb powered page. If the script you are using isn't powered by vb, I don't see how a default vb powered page would work correctly.

Attach the file that controls the header and footer or add the code in PHP tags so we can check it out.

fringehead
07-05-2006, 10:19 PM
He wants to know how to inlcude the login info into the header of his website so people can "log into" the other non-vb pages. He doesn't want to use any vb templates "inside" of vbulletin.

At least that's how I see it. I want to do the exact same thing? Any help?

Thanks,

Sean