[TYPO3-core] RFC: Bug #2666: Preview from searchresult shows rootpage only

Franz Holzinger franz at fholzinger.com
Fri Mar 24 11:58:37 CET 2006


Hello Michael,

>>>Solution:
>>>Change $this->id after for each loop when in search mode.
>>>
>>>function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)	{
>>>		$iOut = '';
>>>
>>>+		if (strlen($this->searchString))	{	// If in search mode, make sure the
>>>preview will show the correct page +			$this->id = $row['pid'];
>>>+		}
>>>      
>>>
>>I do not like this that a render function changes an internal member
>>variable without any warning and just because of another member
>>variable. Form the interface of this function you cannot see that it
>>changes the $this->id.
>>
>>This can have side effects to other functions where $this->id is needed.
>>
>>I suggest to introduce an additional $pid paramater to the functions
>>which are needed in this context.
>>    
>>
>
>I don't expect that it will have any additional side-effects since this mode 
>is very special anyway ($this->id would be empty normally).
>
>What I can/will do is to set it back to 0 again once the loop is finished.
>
>
>  
>
Ok, this is a quick hack to reset. However do reset it to the former
value it had and not to 0 or anything else.

I still suggest to improve this later and introduce a parameter $pid in
the future.

+1 if you reset $this->id at the end of the function to the value of
$this->id it had in the beginning of the function renderListRow.


- Franz








More information about the TYPO3-team-core mailing list