[TYPO3-english] Assign dynamic value to a TypoScript int data type

Francois Suter fsuter at cobweb.ch
Mon Nov 3 13:41:30 CET 2008


Hi Valter,

> I tried to render this extension (pbimagegraph) using PHP to set up the 
> extension's TypoScript directly in php.

Hmm, I don't know this extension... but let's see.

> So I used this code (as described in Dmitry's Book)
>         $cObj = t3lib_div::makeInstance('tslib_cObj');
>         $cObj->start(array());
>         $conf=..........
>         $conf['includeLibs']=
>         'EXT:pbimagegraph/pi1/class.tx_pbimagegraph_pi1.php';
>         $html.=$cObj->cObjGetSingle('USER_INT',$conf);

Well, if it comes from Dmitry's book it's probably a good suggestion :-) 
but I wouldn't do it that way (there are generally several ways of doing 
things). My impression is that your generated TS configuration is 
incomplete.

Why not do something like that in your plugin's TS

plugin.tx_myplugin_pi1 {
	graph < plugin.tx_pbimagegraph_pi1
	graph {
		...
	}
}

Then in your code:

$html.=$cObj->cObjGetSingle($this->conf['graph'], $this->conf['graph.']);

By copying the complete tx_pbimagegraph_pi1 object you are sure not to 
forget anything.

> But unfortunately I got this error:
> Fatal error: Call to a member function _setParent() on a non-object in 
> ......... on line 203

The origin of the error is some object was not properly instantiated so 
that it's _setParent() method cannot be called. But that's probably 
interal to pbimagegraph and I can't help you there.

HTH

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-english mailing list