[TYPO3-english] COA inside another COA - is it a wise thing?

bernd wilke t3ng at pi-phi.tk
Sun May 16 22:21:40 CEST 2010


Am Tue, 11 May 2010 08:50:56 +0300 schrieb Dmitry Dulepov:

> Hi!
> 
> Riccardo De Contardi wrote:
>> A little "odd" question about typoscript:
>> 
>> Is it "wise" to have a COA inside another COA? I mean Something like:
> 
> Several reasons against it:
> - it takes more memory to hold of these objects - it takes more stack
> - it takes longer to parse
> - it looks less structured
> - it is harder to understand
> 
> I would avoid using COAs if I can.


I admit I use COAs for a clean construct of a website.
My earlier tries were based on HTML-templates with subparts and markers, 
but my experience shows less flexibility.
using only COAs enables more changes for single pages/subtrees.

her an example with a very simple layout. If you put this all together in 
one single TS you will get a lot of COAs nested in each other.
and then imagine you have 
* more contentparts (news-teasers in right column, dynamic advertisement 
outside class 'allcontent'
* different layouts ( like http://www.pi-phi.de/191.html )

10 = COA
10 {
	10 < temp.header
	20 < temp.middle
	30 < temp.footer
	wrap = <div class="allcontent">|</div>
}


temp.header = COA
temp.header {
	10 = IMAGE
	10 {
		file {
          		import = uploads/media/
          		import.data = levelmedia:-1, slide
		:
		wrap = <div class="logo">|</div>
	}
	20 = TEXT
	20.value.data = page:title
	20.wrap = <div class="">|<div>

	30 = HMENU
	30 {
		:
		wrap = <div class="mainmenu">|</div>
	}
	wrap = <div class="header">|</div>
}

temp.middle = COA
temp.middle {
	10 = COA
	10 {
		10 = HMENU
		10 {
			:
			wrap = <div class="submenu">|</div>
		}
		20 < styles.content.getLeft
		20.wrap = <div class="leftcontent">|</div>

		wrap = <div class="left">|</div>
	}
	20 < styles.content.getRight
	20.wrap = <div class="right">|</div>

	30 < styles.content.get
	30.wrap = <div class="content">|</div>

	wrap = <div class="middle">|</div>
}

temp.footer = COA
temp.footer {
	10 = HMENU
	10 {
		special = directory
		special.value = 123
		:
	}

	20 = TEXT
	20.value = &copy; 2009-
	20.noTrimWrap = | ||
    
	30 = TEXT
	30.data = date:U
	30.date = Y    
    
	40 = TEXT
	40.value = by Pi-Phi-Productions
	40.noTrimWrap = | ||

    	wrap = <div class="footer">|</div>
}

you may 'optimize' the TS by splitting my wraps into different TEXT but 
that will lead to chaos on dynamic (or later permanent) changes, where 
you easily get lost of correct pairing.

BTW: using this kind of TS I was able to build all sites without use of 
TV and/or templateAnalyzer and till now everyone new to one of this 
installations get comfortable with it in no time.

And as Joey remarked: is it really neccessary to get the fastest page but 
afterwards noone will be able to manage this page? not even yourself 
after a year? 

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list