Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2003, 06:53 PM
dgmayor dgmayor is offline
 
Join Date: Sep 2002
Location: Cary, NC
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 01-05-2003, 07:20 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 01-05-2003, 07:32 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Globalise the variables

Satan
Reply With Quote
  #4  
Old 01-05-2003, 07:38 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 01-05-2003, 08:38 PM
dgmayor dgmayor is offline
 
Join Date: Sep 2002
Location: Cary, NC
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #6  
Old 01-05-2003, 09:09 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 01-05-2003, 09:12 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Couldn't you put the code for what you want in the phpinclude template and use it globally from there, too?
Reply With Quote
  #8  
Old 01-05-2003, 09:14 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 01-06-2003, 12:26 PM
dgmayor dgmayor is offline
 
Join Date: Sep 2002
Location: Cary, NC
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 03-14-2003, 05:51 PM
konstance's Avatar
konstance konstance is offline
 
Join Date: Dec 2002
Location: oklahoma
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
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 05:25 AM.


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.04498 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
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_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete