[TYPO3-dev] how to select pages with correct language restriction with TS?

Franz Koch typo.removeformessage at fx-graefix.de
Fri Oct 26 18:53:30 CEST 2007


Hi again,

> Current situation:
> I use a TS setup to fetch the uids of all subpages of the current page 
> and hand it over to a extension like this:
> ---------
>     # my extension
>     50 < plugin.user_tabs_pi1
>     50 {
>         # the pids variable is parsed with stdWrap
>         pids.cObject = CONTENT
>         pids.cObject {
>             table = pages
>             select {
>                 pidInList = this
>                 andWhere = doktype != 5 AND nav_hide=0
>                 selectFields = uid
>                 #languageField = sys_language_uid
>             }
>             renderObj = TEXT
>             renderObj.field = uid
>             renderObj.wrap = |,
>         }
>         noPiVars = 1
>         stdWrap.required = 1
>     }
> ---------
> 
> This worked nicely so far, but now my customer is updating his website 
> to be multilingual. The problem now is, that the TS above doesn't care 
> about translation handling. As you see I tried the option 
> 'languageField', but it doesn't seem to work with the pages table, 
> because the table simply doesn't have any field that could be used for 
> this option (as far as I have seen).
> 
> Does anybody know a way how to get the page ids with correct 
> restrictions of the translation handling with TS? I'm not sure if it's 
> possible to rebuild the complex query by hand in TS.

Ok - found a solution/workaround now. I evaluated which TS objects 
respects all this stuff and came to the conclusion that HMENU does and 
that it probably could be misused for this. And that's the case. For 
anybody else who needs something similar - here my code:

---------
	pids.cObject = HMENU
	pids.cObject {
		special = directory
		special.value.data = page:uid
		1 = TMENU
		1 {
			NO = 1
			NO.doNotLinkIt = 1
			NO.stdWrap.field = uid
			NO.stdWrap.wrap = |,|*||,|*||
		}
	}
---------

but I'm not sure how much overhead this causes - probably this is even 
faster than using a CONTENT object and passing each result to it's own 
TS object for rendering.

--
Greetings,
Franz




More information about the TYPO3-dev mailing list