-
☆ A M B ☆
- 24,524 Posts
make your summary template:
<tr>
<td>
[+element1+]
</td>
<td>
[+element2+]
</td>
<td>
[+element3]+
</td>
</tr>
Put the Ditto call inside the <table> </table> tags.
-
☆ A M B ☆
- 24,524 Posts
Isn’t that what you want to do with the table?
<table>
[[Ditto? &tpl=`myTpl`.... ]]
</table>
then the myTpl chunk would have the inner part:
<tr>
<td>
<a href="[~[+id+]~]">[+title+]</a>
</td>
<td>
<a href="[~[+id+]~]"><img src="[(base_url)]/[+tvproduct-image-thumb+]" /></a>
</td>
</tr>
The <tr> ... </tr> part gets repeated for each document being processed.
I believe he is talking about printing the whole ditto items in talbe cells three per row..
You can use the [+item[x]+] placeholder where x is a number of the ditto item
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Sorry, [+item[1]+] etc tags can’t be used in Ditto templates, only in document content outside Ditto call.. Here’s how this could be done in current Ditto version..
<?php
$modx->runSnippet("Ditto", array("sortBy"=>"editedon", "sortDir"=>"asc", "displayArchive"=>"0", "summarize"=>"all", "paginate"=>"1"));
$total = $modx->getPlaceholder("total");
$output="";
$count = 0;
for($i=0;$i<$total;$i++) {
if($count == 0) {
$output .= "<tr>";
}
$output .= "<td>".$modx->getPlaceholder("item[$i]")."</td>";
if($count == 2 || $i==($total-1)) {
$output .= "</tr>";
$count = -1;
}
$count++;
}
return $output;
?>
Ditto should get new parameter where you could use some [+item+] and Ditto should do that offset counting.. but until then, I think this is the only way without modifying Ditto..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."