View Full Version : How do I call this information on a non-vB page?
What do I need to do on a .php page that I have which is not in my forum dir, to get the following information...
I want to be able to use variables which will display certain things, like the minimum required post count to use a custom avatar...
Can I just include forum/global.php and have it work? Or do I need forum/admin/global.php?
I have no idea really, someone give me a clue :D.
Xenon
03-03-2003, 07:56 PM
require the forum/global.php that's enough to use those global vars :)
Well, it's more complicated than that for me actually...
My pages are mostly HTML...
I have a file, header.php, and a file, footer.php
I create my pages like this:
<?php include('header.php'); ?>
loads of html stuff here
sdfsdf
sdfsdf
sdfsdfsdf
<?php include('footer.php'); ?>
If I want to use these variables in the sdsdfsdflskjdflksjdf stuff in the middle, what can I do? Where do I require global.php? if I close a php tag, do I need to require global.php again when I reopen them?
Xenon
03-03-2003, 08:48 PM
require global.php in the first instance of <?php ?>
you don't have to rerequire it anywhere :)
i think there was a shortcut: <?=$blabla?> to show the content of a var in the html code :)
<?php
require("/****/*****/forum/global.php");
echo("blah: " .$avatarcustomposts);
?>
I just put this in its own .php file with nothing else, and it returns no results...what am I doing wrong?
Xenon
03-03-2003, 08:55 PM
remove the () around the string, echo don't needs em
ok another problem:
require('.forum/global.php');
This line seems to cut off all code below it (html)...
<?php
require('.forum/global.php');
?>
Anything below those 3 lines in a php file, say html, will not be shown...
Does that look right?
Xenon
03-03-2003, 09:03 PM
yes, it looks right, and the html below should show up....
It's not working...I've been working on this for hours now, and i'm really really annoyed. Everything looks right, but it won't work.
Here's a sample page I have:
<?php include("header.php"); ?>
<table><tr><td>
sdfsdfsdfsdfsdfsdf
</td></tr></table>
<?php
require('/***/***/***/forum/global.php');
echo $avatarcustomposts;
?>
<table><tr><td>
sdfsdfsdfsdfsdfsdf
</td></tr></table>
<?php include("footer.php"); ?>
I can't see *anything* wrong there. I've tried variations of everything, and still, no work...
I'm completely baffled...
Sebastian
03-04-2003, 06:21 AM
This should work:
<?php
chdir("/path/to/forums/");
require("./global.php");
include("/path/to/header.php"); ?>
<table><tr><td>
sdfsdfsdfsdfsdfsdf
</td></tr></table>
<?=$avatarcustomposts;?>
<table><tr><td>
sdfsdfsdfsdfsdfsdf
</td></tr></table>
<?php include("/path/to/footer.php"); ?>
you must use chdir() (change directory) otherwise you may get include errors with admin/functions.php, and the global.php include must be above your header, otherwise you will get send headers errors.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.