[TYPO3-dev] non-standard page types and extension configuration info?

Johannes Künsebeck kuensebeck at gmx.net
Thu Jun 7 18:47:07 CEST 2007


Jason Lefkowitz wrote:
> Hi Johannes... let me see if I understand:
> 
> Johannes Künsebeck wrote:
>> So there is the select that fetches rows of data. *Foreach* row this
>> data is passed to whatever there is to render it (in the property
>> .renderObj or by default the toplevel object with the same name as the
>> table, thus tt_content))
>> But you want your own renderObj, so you have to provide it yourself.
> 
> Here's where I am confused.  Right now I have my SELECT statements in my
> extension's main PHP-script (through TYPO3's DB API).  But if I am
> reading you correctly, I should be choosing WHAT records to display
> using Typoscript, and only using the PHP to specify HOW to display those
> records.

Hi Jason
,
There are several ways to do it.

1. One would be to insert a plugin as a Content Element on the xml-page.
I thought this is the way you wanted to do it, because you said you
wanted to set the startingpoint there. Then you have to write some TS
how the contents of this page (->your plugin) should be displayed (->
your plugin). For this you can use the TS by Thorsten (or mine). The CE
data will get fetched (like startingpoint, flexform, ...) and passed to
your PHP plugin, where it is available as $this->cObj->data[...] .
So you can do something like this:

class tx_myextension_pi1 {
 	...
	function main($content,$conf) {
		return "<startingpoint>{$this->cObj->data['pages']}</startingpoint>";
	}
}

Or what you probably want to do is to use some data from another table
in the DB (->DB-API):

class tx_myextension_pi1 {
 	...
	function main($content,$conf) {
		$pids = $this->pi_getPidList($this->cObj->data['pages'],$recursive);
		$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','my_table','pid IN
('.$pids.')');
		while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
			... output some xml here ...
		}
	}
}

2. The other way would be to call your plugin "statically" without
inserting a CE, but then you would not be able to configure your plugin
with Page/List-Module or you would have to fetch the config data
yourself with sth. like SELECT * FROM tt_content WHERE (...find my
plugin...) . But this stuff you better let do TYPO3.


3. Maybe it would even be possible to write the whole Stuff in TS with 2
nested selects, but that is something for TS-Gurus (not for me)

> 
> Is that right?  If so, what are the circumstances where you're supposed
> to use the DB API?

commonly it's used like in the second example.
> 
> Thanks for all your help!!
> 
> - Jason

Its fun ,Johannes




More information about the TYPO3-dev mailing list