Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 03-03-2003, 07:23 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 .
Reply With Quote
  #2  
Old 03-03-2003, 07:56 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

require the forum/global.php that's enough to use those global vars
Reply With Quote
  #3  
Old 03-03-2003, 08:42 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 03-03-2003, 08:48 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 03-03-2003, 08:51 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<?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?
Reply With Quote
  #6  
Old 03-03-2003, 08:55 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

remove the () around the string, echo don't needs em
Reply With Quote
  #7  
Old 03-03-2003, 08:59 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #8  
Old 03-03-2003, 09:03 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, it looks right, and the html below should show up....
Reply With Quote
  #9  
Old 03-03-2003, 09:06 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #10  
Old 03-04-2003, 06:21 AM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should work:

PHP Code:
<?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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:01 PM.


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.02470 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete