[Typo3-dev] pi_USER_INT_obj

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Sun Nov 20 20:42:15 CET 2005


Dmitry Dulepov wrote:
> Hi!
> 
> Elmar Hinz wrote:
> 
>>what exactly is the use of pi_USER_INT_obj?
> 
> 
> It affects how pi_base class creates typolinks. Nothing more. Search
> newsgroupp archives or take a look to pi_base for more information		
> 
> Dmitry.

Hi Dmitry.
	
Blindness came over me today. The prefix pi_ directly hints to that class.

For those who may be intested I resume the result.

The answer is given in this lines:

function pi_linkTP($str,$urlParameters=array(),$cache=0,$altPageId=0) {
  $conf=array();
  $conf['useCacheHash'] = $this->pi_USER_INT_obj ? 0 : $cache;
  $conf['no_cache'] = $this->pi_USER_INT_obj ? 0 : !$cache;

....


That has historical reasons and means the following:

If you don't want to cache, you keep the default settings $cache=0.

As result $conf['no_cache'] will be set to true. As effect the no_cache 
parameter will be present in the links and the whole page will not be 
cached and not be indexed.  That is the old fashoned way to have dynamic 
output of plugins.

The modern way is to make it a USER_INT. Then only the plugin itself 
isn't cached. Now setting $cache to 0 would cause a problem as you don't 
want to set $conf['no_cache'] to true. Also setting $cache to 1 would 
cause a problem, because it initiates $conf['useCacheHash'] and with 
this the cacheHash parameter in links.

The solution is to set $this->pi_USER_INT_obj = 1. This setting 
overwrites the settings of $cache exactly in the way you need it.

This seems to be userfull for a trick: Simply allways set $cache to 1 as 
needed for a cached USER Object. If you prefer to use it as a USER_INT 
in the end you simply set $this->pi_USER_INT_obj = 1 and all pi_ 
functions still work fine. Make sure that include it as USER or USER_INT 
as you need it.

Elmar





















-- 
Climate change 2005: Mexico, Guatemala, New Orleans, Sahel, Bangladesh,
Spain, Portugal, Austria, Swiss, France, ...
Production of CO2 is killing people.
Production of CO2 just for fun is killing people just for fun.




More information about the TYPO3-dev mailing list