[TYPO3-english] IP-Filter for Content Elements

contact at intermediaware.com contact at intermediaware.com
Fri Feb 27 10:36:34 CET 2009

Thanks, but it even doesn't work with .andWhere. I have no solved it with an (dirty) hack.

I edited the typo3/sysext/cms/tslib/class.tslib_content.php-file and put the IP-Check in the content function (it skips rows, when my condition is not true). Probably not the best way - but it works.

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")
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de

More information about the TYPO3-english mailing list