1
Hi all
I have a class:
## file class/my_class.php
class myClass
{
var $data;
function myClass()
{
$data = "this is data";
}
function oneMethod()
{
echo ("result");
}
}
## file index.php
include "header.php";
$xoopsOption['template_main'] = 'controlcenter.tpl';
if($xoopsConfig['startpage'] == "controlcenter"){
$xoopsOption['show_rblock'] =1;
include XOOPS_ROOT_PATH."/header.php";
make_cblock();
}else{
$xoopsOption['show_rblock'] =0;
include XOOPS_ROOT_PATH."/header.php";
}
$myObject = new myClass();
$xoopsTpl->assign( 'object', $myObject );
include XOOPS_ROOT_PATH."/footer.php";
?>
... of course, header.php includes class definition ...
Then, I have a template
If I put
<{$object->data}>
It installs and runs perfectly ... So I see "this is data"
so smarty knows myClass object definition ...
But my problem is when I write:
<{$object->oneMethod()}>
Then I can't update module so It says:
Fatal error: Call to a member function on a non-object in bla bla bla
I've tried smarty with PHP out of XOOPS and I do can do what I want ...
Any one can help me ??? how can I call object method from xoops/smarty ???
Thanx is advance !!!