[TYPO3-english] IP-Filter for Content Elements

Dmitry Dulepov dmitry at typo3.org
Wed Feb 25 20:21:33 CET 2009


contact at intermediaware.com wrote:
> I now tried to add the functionality using Typoscript in my template, but it doesn't work: Here ist my TypoScript-Code:
> subparts.CONTENT = CONTENT
> subparts.CONTENT {		
> 	table = tt_content
> 	select.orderBy = sorting
> 	select.where = tx_ipadress_ipadress = getenv:REMOTE_ADDR
> }
> It works fine if I replace "getevn:REMOT_ADDR" with a "static" IP - but of course, this is not what I want to achieve.
> Do you have any idea how this can be solved?

Well, TypoScript has a certain syntax, which has to be followed if you want to get results.

If you look to the type of "where", you will see that it is a string. So you can not insert any dynamic data there. You need stdWrap for such task. If you look to andWhere property, you will see that it is a stdWrap. Next you need to find how to put dynamic data to stdWrap. If you look to stdWrap, you will find a "dataWrap" property there. "dataWrap" is of type "getData". Looking to "getData" gives you the answer to your question:

select.andWhere = tx_ipadress_ipadress = '{getenv:REMOTE_ADDR}'

or something like that.

Dmitry Dulepov
TYPO3 core team
"Sometimes they go bad. No one knows why" (Cameron, TSCC, "Dungeons&Dragons")

More information about the TYPO3-english mailing list