[TYPO3] too much duplicated TS Code

Mario Sargac marrio at email.si
Sun Jan 15 02:28:44 CET 2006


Hello,

There's a problem I have with duplicated code all over the pages.
I have 5 pages on the same level and I'd like to use different 
background image for the GMENU on each of those pages.

Until now, I solved the problem by writing separate TS code for GMENU on 
each of them, but now I've realized there's a lot of duplicated code, 
because each page now contains the full TS code needed for gmenu. The 
only thing that is actually different in the code is the reference to 
the background image (I tried specifying only the different part, and it 
didn't work in any of those partial solutions.. it only worked fully 
when there was complete hmenu/gmenu code).

Here's the code for the different part, which is actually only the 
folder name, where the picture is stored, beside other material:
### on the 1st page ###
2 = IMAGE
2 {
	file = fileadmin/templates/res/page2/menu_bg.gif
	width = 500
}
### on the 2nd page ###
2 = IMAGE
2 {
	file = fileadmin/templates/res/page3/menu_bg.gif
	width = 500
}

I tried to solve that problem by writing the if condition in the root page:
2 = IMAGE
2 {
	file = fileadmin/templates/res/page2/menu_bg.gif
	width = 500
}
2.if {
	value = 12
	isInList.field = uid
}
3 = IMAGE
...

but off course, then each item had it own bg picture.. instead of having 
one for the whole menu...

I believe there is a way to compact the TS code and to put everything on 
one place (root page) or to specify only needed part on the separate 
pages, so any hint in the right direction would be greatly appreciated.

Cheers,
Mario



More information about the TYPO3-english mailing list