Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-27-2005, 02:56 PM
agiacosa agiacosa is offline
 
Join Date: Dec 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Use of php within template?

Anyone figure out how to use PHP within a template other than phpinclude?
Reply With Quote
  #2  
Old 02-27-2005, 03:18 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's not reccomended, and theres no need for it really
Reply With Quote
  #3  
Old 02-27-2005, 03:28 PM
agiacosa agiacosa is offline
 
Join Date: Dec 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is. I am doing a custom page that needs to pull information from MySQL database and then echo out.
Reply With Quote
  #4  
Old 02-27-2005, 03:38 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then do so within the custom page There's no need at all to put anything other than the odd if conditional and html in a template.
Reply With Quote
  #5  
Old 02-27-2005, 03:55 PM
agiacosa agiacosa is offline
 
Join Date: Dec 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need to have the same header and footer and sessions that I get when doing a custom page using Gary's or Logician's templating system.
Reply With Quote
  #6  
Old 02-27-2005, 03:56 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I fail to see how having PHP in the template is going to benefit you here. If you're using vB's template system you can put $header, $footer in your custom template. Also you instantly have access to everything you would on a normal vB page.
Reply With Quote
  #7  
Old 02-27-2005, 04:10 PM
agiacosa agiacosa is offline
 
Join Date: Dec 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dean,

I am not getting my question across well.

I have a script that is built using php (index.php). It includes a database config file (db.php) makes selection queries from a database, presents selection options to the user and then displays the result of that query. Basically, it is the user interface for an aquarium plant database for our members. I want to have this interface within vB so that members stay logged in, I can see they are there in WOL, use user permissions and just have the same look of the site.

My understanding is that I can't do this within a template. How else can I do this?
Reply With Quote
  #8  
Old 02-27-2005, 08:39 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by agiacosa
Dean,

I am not getting my question across well.

I have a script that is built using php (index.php). It includes a database config file (db.php) makes selection queries from a database, presents selection options to the user and then displays the result of that query. Basically, it is the user interface for an aquarium plant database for our members. I want to have this interface within vB so that members stay logged in, I can see they are there in WOL, use user permissions and just have the same look of the site.

My understanding is that I can't do this within a template. How else can I do this?
Put your custom script in PHP and send it's output to a variable. Do this in the following manner:

PHP Code:
ob_start();
include(
'yourheader.html');
$your_code ob_get_contents();
ob_end_clean(); 
Then place $your_code in the header or footer template.
Reply With Quote
  #9  
Old 02-27-2005, 11:19 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by agiacosa
Dean,

I am not getting my question across well.

I have a script that is built using php (index.php). It includes a database config file (db.php) makes selection queries from a database, presents selection options to the user and then displays the result of that query. Basically, it is the user interface for an aquarium plant database for our members. I want to have this interface within vB so that members stay logged in, I can see they are there in WOL, use user permissions and just have the same look of the site.

My understanding is that I can't do this within a template. How else can I do this?
Yes you can still throw all the code into a php file like Dean mentioned, and output the output by calling a template to show the page.
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 08:07 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.05294 seconds
  • Memory Usage 2,236KB
  • 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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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