[Typo3] contes in a table
ADavide
davide at bybit.it
Mon Jul 18 17:43:07 CEST 2005
Dear Bernhard,
thanks very much for your support.
I just tried your code and, voila, everything is working fine.
to complete my needs I used a php script, to format the subpage contents
(into a html 3 columns table).
I'll put here some information for any people need this (I'm using nested
html templates).
typoscript is
===================
...
temp.allCnts = CONTENT
temp.allCnts {
table = pages
select {
pidInList = 21
orderBy = sorting
andWhere = (hidden=0)
}
renderObj = CONTENT
renderObj {
table = tt_content
select {
# Use the uid of each previously selected page as pid for the
content elements
pidInList.field = uid
orderBy = sorting
}
# We render each content element with the default renderer
renderObj < tt_content
}
renderObj.stdWrap.wrap = |#@#
}
temp.cntTable = PHP_SCRIPT
temp.cntTable {
file = fileadmin/template/justMyFolder/script/threeColTable.inc
theCnt = CONTENT
theCnt < temp.allCnts
}
temp.contentTemplate = TEMPLATE
temp.contentTemplate {
template < plugin.tx_automaketemplate_pi1
marks.theCnts = CONTENT
marks.theCnts < temp.cntTable
}
...
===================
and the php code is
===================
...
<?
$GLOBALS["TSFE"]->set_no_cache();
$theCnt = $this->cObjGetSingle($conf["theCnt"],$conf["theCnt."]);
$theCnts = split("#@#", $theCnt);
$lastCellCase = 0;
$allCells = "";
for ($i=0; $i<count($theCnts) - 1; $i++) {
$lastItem = $i;
if (trim($theCnts[$i]) != "") {
switch($i % 3) {
case 0:
$allCells .= '<tr><td class="clmLeft" width="33%"><div id="p">' .
$theCnts[$i] . '</div><td>';
$lastCellCase = 0;
break;
case 1 :
$allCells .= '<td class="clmMid" width="34%"><div id="p">' .
$theCnts[$i] . '</div><td>';
$lastCellCase = 1;
break;
case 2:
$allCells .= '<td class="clmRight" width="33%"><div id="p">' .
$theCnts[$i] . '</div><td></tr>';
$lastCellCase = 2;
break;
}
} else {
switch($i % 3) {
case 0:
$allCells .= '<tr><td width="33%"><td>';
$lastCellCase = 0;
break;
case 1 :
$allCells .= '<td width="34%"><td>';
$lastCellCase = 1;
break;
case 2:
$allCells .= '<td width="33%"><td></tr>';
$lastCellCase = 2;
break;
}
}
}
switch ($lastCellCase) {
case 0:
$allCells .= '<td width="34%"></td><td width="33%"></td></tr>';
break;
case 1:
$allCells .= '<td width="33%" class="none"></td></tr>';
break;
}
$content = $allCells;
?>
...
===================
Thanks again,
cheers.
Davide
"Kraft Bernhard" <kraftb at gmx.net> ha scritto nel messaggio
news:mailman.1.1121676913.26980.typo3-english at lists.netfielders.de...
> ADavide wrote:
>
> You can retrieve all subpages of a page and then render the contents
> of the subpages with something like:
>
> In Constants:
> # Rootpage:
> lib.startpage = 123
>
>
> In Setup:
>
> temp.bigpage = CONTENT
> temp.bigpage {
> table = pages
> select {
> pidInList = {$lib.startpage}
> orderBy = sorting
> }
> renderObj = CONTENT
> renderObj {
> table = tt_content
> select {
> # Use the uid of each previously selected page as pid for the content
elements
> pidInList.field = uid
> orderBy = sorting
> }
> # We render each content element with the default renderer
> renderObj < tt_content
> }
> }
>
>
> greets,
> Bernhard
> --
> Kraft Bernhard
> MOKKA Medienagentur <http://www.mokka.at>
> T: +43 - 1 - 895 33 33 - 50
More information about the TYPO3-english
mailing list