[TYPO3-dev] cHash: additional parameter that frontend user/group is logged in

Franz Holzinger franz at fholzinger.com
Tue May 9 08:12:31 CEST 2006


Bernhard Kraft a écrit :
> Jan-Hendrik Heuing [DD] wrote:
>>Cached content has got some "meta-data". Those contain type and page-id for 
>>example, those things which render diferent cache results WITHOUT using 
>>cHash. And as far as I remember, usergroups are part of it !
> 
> 
> It might sound like you would have to ask your local dealer :) But there is
> a method "getHash" in tslib_fe.php:
> 
> ---------
>   function getHash()  {
>     $this->hash_base = serialize(
>       array(
>         'all' => $this->all,
>         'id' => intval($this->id),
>         'type' => intval($this->type),
>         'gr_list' => (string)$this->gr_list,
>         'MP' => (string)$this->MP,
>         'cHash' => $this->cHash_array
>       )
>     );
> 
>     return md5($this->hash_base);
>   }
> -----------
> 
> The hash from this method get's used for storing page-relevant information like TSConfig,
> the cached page, etc. in the cache -tables ... and as you can see this->gr_list is part
> of it ...
> 
But here I cannot add additional parameters. E.g. for a list view I need
 the parameter begin_at to define on which position of the list the user
has browsed. Unfortunately the getHash function does not allow
additional parameters.

Maybe I can to do it by calling these function before to fill the
$this->cHash_array.

function mergingWithGetVars($GET_VARS)	{

/**
 * Calculates a hash string based on additional parameters in the url.
This is used to cache pages with more parameters than just id and type
 *
 * @return	void
 * @see reqCHash()
 */
function makeCacheHash()	{
	$GET = t3lib_div::_GET();
	if ($this->cHash && is_array($GET))	{
		$this->cHash_array =
t3lib_div::cHashParams(t3lib_div::implodeArrayForUrl('',$GET));
...
}

However I do not like to use mergingWithGetVars() inside of a normal
function which generates the 'begin_at=41' paremeter. This is because on
another position of the code the former begin_at might be needed and
read from the _GET() function.


Should the getHash() get an additional parameter?

Greets,

Franz









More information about the TYPO3-dev mailing list