View Full Version : navbar on none vb page
mossyuk
01-30-2004, 11:08 AM
Im not sure how hard this is to do, but the vb3 index.php doesnt seem to like me trying to hack it out. I have seen it included in vBindex so its do-able.
Im trying to create my own start page for a custom project, so this really would help me a lot! thanks
Zachery
01-30-2004, 11:11 AM
Are you going to be using the vB template system or no?
mossyuk
01-30-2004, 11:13 AM
Well I was hoping I could just pull that one template from the database. It is a PHP page im working on. Basically its an amalgamation of the last10threads script that was released for vB2 with hopefully the navbar on to make the entire thing consistant.
mossyuk
01-30-2004, 11:24 AM
I followed a link on your signature and managed to write a little script that pulls out the navbar. However, it is missing all its colour (presuming thats to do with a style sheet problem?) and the options are a bit wonky too - ie/ the drop down quick links menu doesnt work and the links all point to the wrong places. hmmmmmmmmmm!
Zachery
01-30-2004, 11:27 AM
I followed a link on your signature and managed to write a little script that pulls out the navbar. However, it is missing all its colour (presuming thats to do with a style sheet problem?) and the options are a bit wonky too - ie/ the drop down quick links menu doesnt work and the links all point to the wrong places. hmmmmmmmmmm!
you also need to include the headinclude template ;)
mossyuk
02-02-2004, 09:22 AM
I'm still having fun with this. If I do the following:
$globaltemplates = array(
'navbar,headinclude'
);
// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");
// ## this calls to print out one main template ##
eval('print_output("' . fetch_template('navbar') . '");');
eval('print_output("' . fetch_template('headinclude') . '");');
I get a grey screen outputted.
If I do:
$globaltemplates = array(
'headinclude,navbar'
);
// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");
// ## this calls to print out one main template ##
eval('print_output("' . fetch_template('navbar') . '");');
eval('print_output("' . fetch_template('headinclude') . '");');
I get my nav bar outputted but without the formatting. Im very confused. I have looked in the vb3 index.php and cant find the section where it might call the navbar. Arghhhhhhhhhhh!!!
Zachery
02-02-2004, 09:25 AM
eval('print_output("' . fetch_template('navbar') . '");');
will just print out the whole template :) and we dont want that now do we?
you want to eval them :)
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$h_include = "' . fetch_template('headinclude') . '";');
:)
mossyuk
02-02-2004, 09:35 AM
what exactly is the 'eval' doing though? I have never worked that one out. Forgive my ignorance, I'm a n00b with PHP really - as though you couldnt have guessed.
This is what I have so far:
$globaltemplates = array(
'navbar,headinclude'
);
require_once("./global.php");
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$h_include = "' . fetch_template('headinclude') . '";');
That returns a grey screen - so although something is working, that something is not the something I want! :)
Thanks for your quick reply.
Zachery
02-02-2004, 09:38 AM
what exactly is the 'eval' doing though? I have never worked that one out. Forgive my ignorance, I'm a n00b with PHP really - as though you couldnt have guessed.
This is what I have so far:
$globaltemplates = array(
'navbar,headinclude'
);
require_once("./global.php");
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$h_include = "' . fetch_template('headinclude') . '";');
That returns a grey screen - so although something is working, that something is not the something I want! :)
Thanks for your quick reply.when you use print_output
that makes vB print out the whole template, making them varibles will allow you to use them in your code wherever
<html>
<head>
<title>test</title>
$h_include
</head>
<body>
This is a test
$navbar
end of the test
</body>
</html>
like so
mossyuk
02-02-2004, 10:03 AM
cheers, this is my code for any one else who wants it:
<?php
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./../vb303");
// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);
// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'headinclude',
'navbar',
'header'
);
// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");
// ## this calls to print out one main template ##
//eval('print_output("' . fetch_template('navbar') . '");');
//eval('print_output("' . fetch_template('headinclude') . '");');
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$h_include = "' . fetch_template('headinclude') . '";');
eval('$front_header = "' . fetch_template('header') . '";');
echo $navbar;
echo $h_include;
echo $front_header;
?>
It needs tweaking but I hope it helps someone.
Now to figure out why Im getting JScript errors! :(
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.