[TYPO3-dev] how to implement "no records found" with TS

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Jul 10 17:41:34 CEST 2006


Hi!

I tried to display a message if a CONTENT object didn't render any records. 
  I didn't want to use a further SELECT (eg via stdWrap.numRows) for 
performance reasons. I fiddled with cobj:parentRecordNumber with no success.

So I changed tlib_cObj:

function getData($string,$fieldArray)	{
...
	case 'cobj':
		switch((string)$key)	{
		case 'currentRecordTotal': // NEW feature
			$retVal = $this->currentRecordTotal;
		break;
		case 'parentRecordNumber':
			$retVal = $this->parentRecordNumber;
		break;
		}
...
}

Then I was able to use this in my TS:

subparts.colNormal < styles.content.get
subparts.colNormal.stdWrap.append = TEXT
subparts.colNormal.stdWrap.append.if.isFalse.data = cobj:currentRecordTotal
subparts.colNormal.stdWrap.append.value = <b>No records found</b>

Is this possible (without any additional SELECT!) without this hack?

If not, do you think 'currentRecordTotal' should be added to getData?

Masi




More information about the TYPO3-dev mailing list