[TYPO3-english] IP-Filter for Content Elements

Peter Russ peter.russ at 4many.net
Fri Feb 27 11:00:53 CET 2009


--- Original Nachricht ---
Absender:   contact at intermediaware.com
Datum:       27.02.2009 10:36:
> 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.

As Dimitry mentioned: 'something like that'. If you use correct 
Typoscript it will work with .andWhere

andWhere.cObject=TEXT
andWhere.cObject.data=getenv:REMOTE_ADDR
andWhere.cObject.wrap=tx_ipadress_ipadress ="|"

or simpler

andWhere.dataWrap = tx_ipadress_ipadress={getenv:REMOTE_ADDR}

Regs.


-- 
Fiat lux!
Docendo discimus.
_____________________________
4Many� Services
XING:	https://www.xing.com/go/invita/360052
	http://www.xing.com/go/privatemessage/Peter_Russ


More information about the TYPO3-english mailing list