PDA

View Full Version : Problems integrating external PHP pages with VB4


razec
01-03-2010, 04:06 AM
I have some PHP-based forms that I would like to include with VB4. I want to make sure that the following applies:

1. The scripts interact with vBulletin's configuration (mainly to access the same database information, and to be able to determine if the user is logged in), and
2. they need to use the same styling and heading as the CMS.

I've installed VB4 in the root of my website, so going to http://www.mysite.com/, which is located at /home/content/myuser/html on my server. For starters, I just created a simple script to test this:

<?

define('CWD', '/home/content/myuser/html');

include(CWD . '/includes/init.php');
include(CWD. '/includes/class_dm.php');

global $db, $vbulletin;

echo '<p>Your user ID: ' . $vbulletin->userinfo['userid'] . '</p>';

?>

The browser output of this is:

VB_AREA and THIS_SCRIPT must be defined to continue


What am I doing wrong here? Also, since I'm planning ahead, how can I have my scripts build the standard page header used by the CMS/forums (the welcome/notifications/my profile/etc with the site logo)?

derfelix
01-03-2010, 04:43 AM
Try this... above your define('CWD', '/home/content/myuser/html');

add:
define('THIS_SCRIPT', 'test_script');
define('VB_AREA', 'test_area');
you might need
define('CMS_SCRIPT', true); but i dont know...

What I would do first, prior of doing anything like that..
READ: https://vborg.vbsupport.ru/showthread.php?t=228112
(excellent How to by Lynne)

F.

razec
01-03-2010, 04:54 AM
Adding the "THIS_SCRIPT" and "VB_AREA" defines worked. I didn't try it with the CMS_SCRIPT define.

Thanks for your help, and thanks for the link. I'll check it out and post again if I have any more questions.

sebz2009
01-03-2010, 04:54 AM
[HOW TO - vB4] Create a own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

[HOW TO - vB4] Rendering templates and registering variables - a short guide (https://vborg.vbsupport.ru/showthread.php?t=228078)

razec
01-03-2010, 05:31 PM
Okay, so I have my new external pages working and using new VB templates. What I can't do is figure out how to integrate PHP into the template. It's just ignored. I know how to do this with widgets but how does it work with VB4 templates?

--------------- Added 1262627841 at 1262627841 ---------------

Actually, nevermind that. I think I found a few ways I can approach it. Thanks.