[TYPO3-templavoila] Automatic hiding of unused content area...

Jan Bednarik info at bednarik.org
Mon Apr 27 20:58:22 CEST 2009


Hi,

I used your code and it worked fine until ...

I have 3 columns layout where the left column is loaded using 
kb_tv_cont_slide and the page structure is

Root
-- shortcut to root
-- page 1
... etc

When the left column (slide) was empty, the code worked. But as soon as 
I inserted some content to the Root page it stopped working.

Debugging of the class.tslib_content.php revealed that register is 
filled OK, but then for some reason it's flushed and then restored 
without restoring the rightContentEmpty value.

I don't know why, but I found a solution. See, when you LOAD_REGISTER, 
it first stores current value to registerStack and then adds new one to 
register. When RESTORE_REGISTER is called, register is replaced with 
registerStack value. But that means that latest value pushed to the 
register is not restored.

So the solution is in using this TS:

	10= RECORDS
	10.source.current=1
	10.tables = tt_content
	10.stdWrap.ifEmpty {
         	cObject = COA
         	cObject.10 = LOAD_REGISTER
         	cObject.10.rightContentEmpty = 1
         	cObject.20 = LOAD_REGISTER
         	cObject.20.hack = 1
     	}
     	10.stdWrap {
         	required = 1
         	wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
     	}

The second LOAD_REGISTER pushes rightContentEmpty to the registerStack 
so it can be restored later.

There's a bug somewhere, I guess, but I cannot tell where.

-- 
Jan Bednarik
www.bednarik.org - web about Typo3 in czech


More information about the TYPO3-project-templavoila mailing list