[Typo3] building teaser using only TypoScript
Krystian Szymukowicz
t33k.RE.MO.VE at RE.MO.VE.prolabium.com
Wed Sep 21 19:10:06 CEST 2005
hi all
i want to do some kind of teaser using only TS.
I got following structure
Page1
|____Subpage 1
|____Subpage 2
|____Subpage 3
|____Subpage 4
Every Subpage has 4 tt_content elements
1. header1
2. header2
3. image
4. table
What I want to do is to show at Page1 following content in the table:
<table>
<tr><td> header2 of subpage1 </td></tr>
<tr><td> image of subpage1 </td></tr>
<tr><td> header2 of subpage2 </td></tr>
<tr><td> image of subpage2 </td></tr>
<tr><td> header2 of subpage3 </td></tr>
<tr><td> image of subpage3 </td></tr>
<tr><td> header2 of subpage4 </td></tr>
<tr><td> image of subpage4 </td></tr>
</table>
I have spend 2 days digging into TS and finally done something like that:
lib.a = CONTENT
lib.a {
table= pages
select {
#pid of Page1
pidInList = 3
selectFields = uid
orderBy = title
}
renderObj = CONTENT
renderObj {
table = tt_content
select {
pidInList.field = uid
where = sys_language_uid = 0
#get only "header2" and "image"
begin =1
max = 2
orderBy = sorting
}
renderObj = COA
renderObj {
#try to remember header value to use it later
5 = LOAD_REGISTER
5.my_header.cObject = TEXT
5.my_header.cObject.data = field:header
5.my_header.cObject.if.isTrue.field = header
10 = COA
10.wrap = <table width="250">|</table>
10 {
if {
#dont do table if its content/render loop
#with "header" tt_content
isFalse.field = header
}
10 = TEXT
10.value=<tr><td width="250">
20 = TEXT
20.wrap = <a href="|">
20.typolink.parameter.field = pid
20.typolink.returnLast=url
25 = IMAGE
25.file.import = uploads/pics/
25.file.import.field = image
25.file.width = 100
30 = TEXT
30.value=</a></td></tr>
40 = TEXT
40.wrap = <tr><td>|</td></tr>
#try to use remembered header value here - DOES NOT WORK
40.data = register:my_header
}
}
}
}
Well - it almost work :) all images are displayed but I can't figure out
how to display header together with images and I must ask you to help me
here :)
The code I think is bad here is:
5 = LOAD_REGISTER
5.my_header.cObject = TEXT
5.my_header.cObject.data = field:header
5.my_header.cObject.if.isTrue.field = header
Here in the first loop of content/render when I have "header" tt_content
I am trying to remember header value (sorry if it is funny but this is
how I imagine it works).
Then in the second loop of content/render when I have "image" tt_content
I want to use this value from first loop but IT DOES NOT work :(
40 = TEXT
40.wrap = <tr><td>|</td></tr>
40.data = register:my_header
I know that in the second loop register will be done again but I hope
that line
5.my_header.cObject.if.isTrue.field = header
can be understand as following condition "if header is empty do not do
anything with register:my_header" so I hope the previous value of
register:my_header is remembered. Maybe I am wrong here.
I am quite sure it can not be the right way of doing teaser with
TypoScript as it would be complicated if I would like to use more
tt_content.
Could you be so kind to share your knowledge and show me the right
direction of doing such teaser?
I know there are some extention but I would like to do it with TS only
as it is more flexible solution.
thank you very much
--
grtz
Krystian Szymukowicz
More information about the TYPO3-english
mailing list