Customizing SMF > Portals, Bridges, and Integrations

Try to write a bride for CMS Made Simple but get an error in Subs-Db-mysql.php

(1/1)

pmw:
I try to write a bridge for CMS Made Simple and SMF 2 but I have already problems to include the index.php of SMF2.


--- Code: ---include(cms_join_path(dirname(__FILE__), 'smf', 'index.php'))
--- End code ---

Leads to a fatal error:


--- Quote ---Fatal error: Unsupported operand types in smf/Sources/Subs-Db-mysql.php on line 53
--- End quote ---

I have compared my code with the bridge for Mambo and SMF 2. But this bridge does quite the same as I do (it uses require() instead of include() but this is not the cause for the fatal error).

Update 1:

If I make the variable "$smcFunc" global in the index.php of SMF 2, this error will be fixed but a few methods later I will get a similar fatal error. There I must declare "$sourcedir" as global and so on. Has anyone an idea what my CMS could make wrong with global variables? Is there a php setting I have to change?

Update 2:

The cause for the problem is that CMS Made Simple is object-oriented. I have create two little php scripts (without any dependency on CMS Made Simple) to reproduce the problem.

This one is working:


--- Code: ---<?php
include(dirname(__FILE__) . '/smf/index.php');
?>
--- End code ---

But this one will fail:


--- Code: ---<?php
class MyClass
{
public function show()
{
include(dirname(__FILE__) . '/smf/index.php');
}
}
$clazz = new MyClass();
$clazz->show();
?>
--- End code ---

How can include the index.php of SMF 2 in a method of a class?

Navigation

[0] Message Index

Go to full version