vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How to include vbulletin EXTERNALLY? (https://vborg.vbsupport.ru/showthread.php?t=230771)

jacksony 12-22-2009 04:21 AM

How to include vbulletin EXTERNALLY?
 
I know it has been discussed, however I am still quite doubtful about this.. How do I correctly include a vbulletin into an external php page?

I tried adding this in the external script:

chdir ('/var/www/vhosts/*******.com/httpdocs/forums');
require_once('./global.php');
include('./index.php');

But it is just showing a white screen, with error:
<b>Fatal error</b>: Cannot redeclare class vB_Bootstrap_Forum in <b>/var/www/vhosts/nanzinc.com/httpdocs/forums/includes/class_bootstrap.php</b> on line <b>1443</b><br />

Even if i remove global.php line, it don't shows :(

Pls advise! Thanks!

ExTincTi0N 12-22-2009 05:17 AM

So are you trying to make a page thats run off of vbulletin?

Vaupell 12-22-2009 06:41 AM

create a php page

myphppage.php
Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'test');
define('CSRF_PROTECTION', true); 
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('MYTEMPLATE',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = construct_navbits(array('' => 'MYTEMPLATE'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'MYTITLE';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('MYTEMPLATE');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());

?>


Upload and go into admincp > styles &.....> Add new template
call it MYTEMPLATE

write your page, html, head, body, content. and save it..

then www.yoursite.link/myphppage.php
will show and run the content of your template, and include vb around it.

same as usual.

almost a direct copy of the article on it. :D

jacksony 12-22-2009 06:44 AM

yes i am trying to have a page to run vbulletin off it.

Thanks Vau I will try it now. I tried the article ones, but it showed a blank page :(

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

"include vb around it."

what do you mean by above? what is the line that includes VBulletin into the php page? I can't seem to locate it.

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

thanks I finally got it to work.

However the link i am using is a wordpress permlink: http://***.com/forum/

What do I define for define('THIS_SCRIPT', 'test');?


All times are GMT. The time now is 09:56 AM.

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.01110 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete