The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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? |
#3
|
|||
|
|||
Quote:
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. |
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
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? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|