vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to integrate vbulletin into phpMVC framework? (https://vborg.vbsupport.ru/showthread.php?t=183034)

SeV3n 06-20-2008 07:57 AM

How to integrate vbulletin into phpMVC framework?
 
Hi, I would like to integrate some vbulletin features into a website based upon a php framework. I've already managed to do it with a simple website but now I would like to reach the same goal with an OOP and MVC structure.

I'm trying to create a main class (to be extended by the controllers) to initialize the vbulletin registry object in order to integrate vbulletin login and to use the bb code parser class.
Here is the issue: including the global.php inside the class constructor I got a fatal error on a method that use the $vbulletin object.
Code:

Call to a member function query_write() on a non-object in forum/includes/functions.php on line 5226.
The $vbulletin object seems not to be correctly initialized since I checked the content of the object with vardump. It sounds like a scoping problem but I'm quite new to OOP php programming and I would like to know if anybody already tried this way.

Thanks in advance.

Dismounted 06-20-2008 10:04 AM

You probably need to include global.php outside the class, as any variables (such as $vbulletin) initialised inside the class will be in the local scope - not what you want.

SeV3n 06-20-2008 04:20 PM

:\ No other way then?

Dismounted 06-21-2008 03:36 AM

Not really, no.

SeV3n 07-15-2008 08:59 AM

Well the thing works fine into a stand alone class but I get the same error (Call to a member function query_write() on a non-object) whenever I try to use it inside a PHP framework (i tried CodeIgniter and Kohanaphp).


All times are GMT. The time now is 01:05 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.00996 seconds
  • Memory Usage 1,711KB
  • 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
  • (5)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