Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2004, 12:58 PM
Hillard Malkeme Hillard Malkeme is offline
 
Join Date: Dec 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Including files in the template code?

Just to let you know I'm new to vbulletin. They guy we had setting up our forums is no longer with us so I have to pick up the slack. Well I've built a site that uses it's own include files for header,Navigation and a few others. The problem is I can't use the code I wrote for the site in the template.

Here is my code for my site that I would like to add into my template.
PHP Code:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="">
<TITLE>Pride Web Talk</TITLE>
<link rel='stylesheet' href='/Skins/Default/Default.css' type='text/css' />
</HEAD>
<BODY>
<?php include("Header.php");?>
<TABLE WIDTH=100% HEIGHT=75% BORDER=0 CELLSPACING=3 CELLPADDING=3>
    <TR>
        <TD valign=top width=130>
            <?php include("./Nav.php");?><BR>
            <?php include("./SiteStats.php");?>
        </TD>
        <TD align=center valign=top class="MainBody">
How can I add this code in my template and get it to work? I've tried searching but didn't find what I was looking for. Again I'm new to vbulletin so I may have found it and didn't know it.. :devious:
Reply With Quote
  #2  
Old 10-06-2004, 01:03 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you

Thanks,
- Dean
Reply With Quote
  #3  
Old 10-06-2004, 01:18 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, first off, you won't be able to use php for sure in the templates.
The only templates that will parse php code are the phpinclude_start and _end templates.

I would check into replacing your templatecode with the html in the header and navbar template.
Reply With Quote
  #4  
Old 10-06-2004, 01:55 PM
Hillard Malkeme Hillard Malkeme is offline
 
Join Date: Dec 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Colin F
Well, first off, you won't be able to use php for sure in the templates.
The only templates that will parse php code are the phpinclude_start and _end templates.

I would check into replacing your templatecode with the html in the header and navbar template.
So you are saying if I build a page using php (or ASP) I can't use it as a template for the forums?

How about I build everything with functions to either echo or return my HTML code. Can I include that file to one of the vbulletin php pages (Like global.php) and call the functions from inside the template code?

So if I had this function
PHP Code:
function OnlineCount(){
    
$datecut=Time()-900//900 = last 15 minutes
    
$sql "SELECT COUNT(*) AS sessions FROM session WHERE lastactivity >$datecut";
    
$result mysql_query($sql);
    
$fieldvalue mysql_fetch_row($result);
    return 
number_format($fieldvalue[0], 0".",",");

Could I call the function from the template code to display my return?
Reply With Quote
  #5  
Old 10-06-2004, 02:00 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What you would have to do is call the function and save it to a variable, which you can then call from the template.

so, in the *.php:
$online = OnlineCount();

and in the template just use $online
Reply With Quote
  #6  
Old 10-06-2004, 02:04 PM
Hillard Malkeme Hillard Malkeme is offline
 
Join Date: Dec 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Colin F
What you would have to do is call the function and save it to a variable, which you can then call from the template.

so, in the *.php:
$online = OnlineCount();

and in the template just use $online
Ok I understand. Any suggestion on where I should include my php page with all my functions? Would global.php be my best bet?

And thank you for the help..
Reply With Quote
  #7  
Old 10-06-2004, 02:52 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

global.php as well as functions.php are both loaded on every page.

Either should work
Reply With Quote
  #8  
Old 10-06-2004, 03:04 PM
Hillard Malkeme Hillard Malkeme is offline
 
Join Date: Dec 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you Colin..
Reply With Quote
Reply


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 02:53 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.04279 seconds
  • Memory Usage 2,236KB
  • 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
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete