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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-23-2012, 10:43 AM
hoosierdoc hoosierdoc is offline
 
Join Date: Aug 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default how to use php/mysql in a custom page?

I am a complete novice with this and I'm guessing I'm attempting to do something that is either difficult or not possible.

I have pages from an existing non-Vbulletin site that I want to pull into the vbulletin site but they use ASP and mysql database calls. I can convert that to PHP, but I can't get the scripting to run on my vbulletin pages.

http://emcram.com/images.asp

This is an example of what I want to bring into the fold. Here's what I have so far which is basically the HTML portion of it.

http://emcram.com/forum/misc.php?do=page&template=image

I've been trying to use a test.php file to make a custom page which displays, but it won't use the PHP code that I am putting in (hello world). It does standard HTML fine. I set that up using a template in style manager per prior posts.

Basically I want some of my existing site pages to have the vbulletin nav and standard look but function as independent database calls. Any help is appreciated! I haven't found a good solution in searching the forum yet, but again I admit my ignorance to vbulletin.
Reply With Quote
  #2  
Old 08-23-2012, 11:49 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First, there's this article: https://vborg.vbsupport.ru/showthread.php?t=228112 . But I see you've manage to use some vb code, so maybe you either found that article already or you figured it out by looking at existing vb files.

So do I understand correctly, have you put some of your code in templates but can't get the php code to run? You can't put php code in a vb template - maybe that's the problem you're having?
Reply With Quote
  #3  
Old 08-23-2012, 12:33 PM
hoosierdoc hoosierdoc is offline
 
Join Date: Aug 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
So do I understand correctly, have you put some of your code in templates but can't get the php code to run? You can't put php code in a vb template - maybe that's the problem you're having?
Correct. If it's not possible, then that's my problem. I read that thread posted above and that's one of the two ways I'm displaying a custom page. It's curious that a PHP-based product disallows PHP. Is this to protect the software functionality and stop us from screwing it up?

Is it then possible to simulate what I'm trying to do using vb language? I have a database of ekgs and images listed with several columns of info for each item. It does a search for items in a certain category and displays them, then when you click on it it does another search query to grab the info and display on the page.
Reply With Quote
  #4  
Old 08-23-2012, 12:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know exactly why it was done that way. It does have the benefit of being able to allow someone to work on the style of the site without being able to anything dangerous, but I don't know if that was the motivation behind it. In any case, I think it just takes a little bit of thinking in a different way about creating a page.

The existing vb scripts, in a nutshell, build a big string representing the html document to be returned, then output it at the end. Again I don't know why that was done, but it does solve one problem - if you reach a point in the code where you want to redirect the user to a different page, if you haven't created any output yet you can do it by setting a header. So anyway, you could probably convert your code by saving any html bits into a string instead of echoing them (or instead of outputting it by putting it between ?> and <?php). You could do that by putting any html in a template and rendering it, or you could just write php to assign it to a string. Then at the end, render a "big" template (one that represents an entire html document), and include any "bits" as variables.

I guess there's really no reason you couldn't output html directly and not use templates at all - that's how the admincp code works. It's just not the way most of the existing vb code works.
Reply With Quote
  #5  
Old 08-23-2012, 01:47 PM
hoosierdoc hoosierdoc is offline
 
Join Date: Aug 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, thanks so much. I found some examples of doing the db calls and should be able to get it done with a bit of trial and error.

Hrm... been doing some looking and I don't see any examples of someone using a page with a vbulletin header/footer that calls their own mysql database.

I want to use my existing database and access it through custom pages as described above. Is this even possible?

--------------- Added [DATE]1345746364[/DATE] at [TIME]1345746364[/TIME] ---------------

The more I search the more depressed I get. Is it possible to use vbulletin to access non-vb MySQL databases?
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 08:50 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.04916 seconds
  • Memory Usage 2,198KB
  • 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
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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