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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2006, 08:13 PM
afullcup afullcup is offline
 
Join Date: Jul 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Where in the PHP file can I put my database code?

Feeling pretty silly here - I feel like I am a pretty decent coder and database developer, but I am new to the vbulletin world and the marriage of php and mysql and can't seem to get it going!

I seem to be unable to execute PHP code if that makes any sense. I have tried putting something as simple as this in my template:

PHP Code:
<?php
print("in php");
?>
but it doesn't print. I tried putting the same code into a .php file on the server and used $filename.php to include it in the template and it doesn't print.

I searched all other templates on my site for "<?php" and there doesn't appear to be anywhere that uses it, so I don't have anything to copy.

I am wondering if there is some sort of configuration file that allows/disallows the use of PHP in a template?? If so, is there a reason that it isn't used more? How on earth do I get my php to run?! Pulling my hair out here!

Any help is much appreciated!!
Reply With Quote
  #2  
Old 07-22-2006, 09:17 PM
Guest190829
Guest
 
Posts: n/a
Default

vBulletin prevents php from being executed directly in the templates for a number of reason. One of the main reason for this is to allow a seperation of html and php code.

This tutorial should help you:

https://vborg.vbsupport.ru/showthread.php?t=98009

Reply With Quote
  #3  
Old 07-22-2006, 09:32 PM
afullcup afullcup is offline
 
Join Date: Jul 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a million!!

OK - So I got a new page going using the examples in that tutorial. But I'm kind of back to the same issue of not knowing where to put my code so that it displays on my page!

I basically want to grab data out of a table and display it on my page. These are the last 3 lines of my php file:
PHP Code:
print("testing6\n");
eval(
'print_output("' fetch_template('test_page') . '");'); 
print(
"testing7\n"); 
testing6 is printed at the very top of my page and testing7 isn't printed at all (which I'm sure is no surprise to you). I just don't understand where it is I'm supposed to put the database coding in order to have it displayed on my page below my header given that it is PHP code and isn't allowed in the template.

I hope that makes sense and I hope someone is around and willing to answer a silly question again.

anyone around to help me out? pretty please!
Reply With Quote
  #4  
Old 07-26-2006, 01:11 AM
afullcup afullcup is offline
 
Join Date: Jul 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone??
Reply With Quote
  #5  
Old 07-26-2006, 02:57 AM
markp_2000 markp_2000 is offline
 
Join Date: Jul 2006
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had the same issues. I jotted down how I got it to work in this post. You are going through the same stuff I did, so I think it will work for you as well

https://vborg.vbsupport.ru/showthread.php?t=121361

I also wrote some database code to see how it works as well. Very similar to the above. I can post it as well if needed.

Mark
Reply With Quote
  #6  
Old 07-26-2006, 03:25 PM
afullcup afullcup is offline
 
Join Date: Jul 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you Mark! I would love to see the database code as well.
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 09:37 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.03605 seconds
  • Memory Usage 2,206KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (5)postbit_onlinestatus
  • (6)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