vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How would I call functions from forumhome in other templates? (https://vborg.vbsupport.ru/showthread.php?t=47405)

dgmayor 01-05-2003 06:53 PM

How would I call functions from forumhome in other templates?
 
I was looking over the template forumhome, and I found the various calls to functions such as $pminfo, $numbermembers, $totalthreads, etc. I was wondering what I had to do to incorporate some of these into the template forumdisplay, or possibly a different one.

I tried the obvious and just called the function from these templates, but they had 0 output, which leads me to believe that they're either contained within the forumhome php file or are called there and I need to include a call somewhere in forumdisplay.

I'm new to PHP but I ran a UBB board for over a year and did a lot of modifications with it and what not. Usually I figure these things out myself, but I'm stumped on this one, since it's a new language to me.

I see a lot of the things I want to do are in 3.0, but well, I'm rather impatient.

Any help would be great!

NTLDR 01-05-2003 07:20 PM

The variables in the forum home templates are assigned by the code in forum/index.php :)

Take a look in there for the code for them.

Chris M 01-05-2003 07:32 PM

Globalise the variables;)

Satan

NTLDR 01-05-2003 07:38 PM

Quote:

Originally posted by hellsatan
Globalise the variables;)
Thats not going to help, unless every file includes every other one etc etc.

Declaring the global variables allows you to use them outside of there scope, eg using them within functions.

dgmayor 01-05-2003 08:38 PM

I see the functions, but not quite sure what I need to do. Is there a way to have the forumdisplay templates call those funtions from index.php, or do I need to copy the functions over? Seems a bit redundant to me to do it that way, but I'm unfamiliar with the way things work (been looking at the code for about a day, so I'm still figuring out how things work together).

NTLDR 01-05-2003 09:09 PM

There not fuctions, the only function in index.php is the one to make the forum bits.

Yes you would need to copy the code from index.php to forumdisplay.php and add the variables like $totalthreads in the templates where you want them.

Boofo 01-05-2003 09:12 PM

Couldn't you put the code for what you want in the phpinclude template and use it globally from there, too?

NTLDR 01-05-2003 09:14 PM

You could indeed, however I'd not suggest the phpinclude method unless its used on every page, its gonna add maybe 4 queries per page, which is very wastefull, especially if the info isn't been used on 90% of the site ;). I also wouldn't suggest adding it to forumdisplay, but thats just me.

dgmayor 01-06-2003 12:26 PM

I can't see it being that big of a deal to add the queries if Vbul 3.0 beta is doing the same thing. Granted I don't know how they have it coded.

Btw, I got it to do what I wanted, so I appreciate the help, even if you don't condone it ;)

konstance 03-14-2003 05:51 PM

ok, this is a totally stupid question, but where do you define your global variables? I added a new table to my database and i would like to be able to refer to one of the fields in it from 2 different files.... thanks in advance for help.


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00966 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete