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

Johannes Künsebeck kuensebeck at gmx.net
Tue Jun 5 21:28:15 CEST 2007


Hi Jason,

The content element needs to come from the DB, else you wont be able to
fill the data-fields of it. In Thorstens example the magic happens
inside styles.content.get:

>From EXT:css_styled_content/static/ :

styles.content.get = CONTENT
styles.content.get {
  table = tt_content
  select.orderBy = sorting
  select.where = colPos=0
  select.languageField = sys_language_uid
}

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.

Regarding the CASE: I think it's not necessary, if you know you have
only this one content element (plugin.my_extension) on that page, but
with it you have the possibility to put later more and other CEs on that
page. But this should work for a single CE, too

xmlPage.10 < styles.content.get
xmlPage.10.renderObj < plugin.tx_myextension_pi1

the way you called your plugin was kind of "static", while the other way
first the cObj is constructed with the data from the select (that you
want to acces) and then the main method is called.

Sorry for being so detailed, I kind of explained it to myself too,
because i had a similar problem once and solved it rather bad with
global vars and ... lets not talk about it.

cheers, johannes




Jason Lefkowitz wrote:
> Thorsten,
> 
> thanks for your response.  After reading your explanation, I understand
> conceptually why the plugin needs to be 'bound' to a content object.
> 
> But knowing that, I don't follow the example code you gave.  Why do you
> need the CASE statement in there?
> 
> If it's a matter of specifying a content object I had thought this
> approach might work, but it doesn't:
> 
> includeLibs.my_extension =
> EXT:my_extension/pi1/class.tx_myextension_pi1.php
> 
> plugin.my_extension = USER
> plugin.my_extension {
> 
>     userFunc = my_extension -> main
> 
> }
> 
> xmlPage = PAGE
> xmlPage.pageNum = 9999
> xmlPage.config.disableAllHeaderCode = 1
> xmlPage.config.additionalHeaders = Content-type: application/xml
> xmlPage.10 < plugin.my_extension
> 
> What do you think?
> 
> -- Jason
> 
> Thorsten Kahler wrote:
> 
>> if you render the document like that the plugin doesn't belong to any
>> content element. "Normal" document rendering selects content elements
>> (table
>> tt_content) from the current page (field pid). The renderObj defines
>> how the
>> datasets should be rendered in detail (e.g. as PI tx_myextension_pi1).
> 
> ...
> 
>> You have to bind your plugin to a content element else the array
>> $this->cObj->data (which contains the dataset) is empty.
>>
>>> The same thing happens with the Flexform I set up to allow configuration
>>> of the plugin output.  None of the settings come through in
>>> $this->cObj->data['pi_flexform'] when using the pageNum, even though I
>>> have "$this->pi_initPIflexForm();" in my script.
>>>
>> Same here.
>>
>>> Is there some special thing I have to do to get access to plugin
>>> configuration data like the starting point when using non-standard page
>>> types?
>>>
>>
>> A small change in your TS setup should do (untested):
>>
>> ####
>>
>> xmlPage = PAGE
>> xmlPage.pageNum = 9999
>> xmlPage.config.disableAllHeaderCode = 1
>> xmlPage.config.additionalHeaders = Content-type: application/xml
>> # select datasets from current page
>> xmlPage.10 < styles.content.get
>> xmlPage.10 {
>>     renderObj = CASE
>>     renderObj {
>>         key = CType
>> # restrict to CType "list" (i.e. plugins)
>>         list = COA
>>         list {
>> # restrict to plugin my_extension_pi1
>>             if.value = my_extension_pi1
>>             if.equals.field = list_type
>> # render dataset
>>             10 < plugin.tx_myextension_pi1
>>         }
>> /* alternative
>> # you have to check field list_type in PHP
>> # e.g: if ($this->cObj->data['list_type'=='my_extension_pi1')
>>         list < plugin.tx_myextension_pi1
>>
>> */
>>     }
>> }
>>




More information about the TYPO3-dev mailing list