h.team Posted April 16, 2009 Report Share Posted April 16, 2009 Hallo. Ich möchte gerne, dass die News in chronologischer von links nach rechts angezeigt werden. Dazu hab ich zwei Tabellen und Spalten definiert. Die Anzeige funktioniert schon soweit, leider zeigt er mir links und rechts den gleichen Content an. Siehe Bild im Anhang. Anbei mal der Code von box_news.html {config_load file="$language/lang_$language.conf" section="boxes"} <table width="648px" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" style="padding-top:15px;"> <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> {foreach name=aussen item=box_data from=$box_content} <tr> <td align="left" width="45%" class="boxText" style="padding-top:5px;"> <table width="90%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="main" style="border-bottom: 1px solid; border-color: #cccccc; padding-bottom:5px;" align="left"> {php} $show = show_content_date($this->_tpl_vars['box_data']['content_time']); echo $show;{/php} </td> </tr> <tr> <td class="news_head" align="left" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_head">{$box_data.content_heading}</a> </td> </tr> <tr> <td class="news_desc" align="left" style="padding-top:5px;"> {$box_data.content_text|truncate:1750:" ...":true} </td> </tr> <tr> <td class="news_link" align="right" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_link">{#text_more#}</a> </td> </tr> </table> </td> <td align="right" width="45%" class="boxText" style="padding-top:5px;"> <table width="90%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="main" style="border-bottom: 1px solid; border-color: #cccccc; padding-bottom:5px;" align="left"> {php} $show = show_content_date($this->_tpl_vars['box_data']['content_time']); echo $show;{/php} </td> </tr> <tr> <td class="news_head" align="left" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_head">{$box_data.content_heading}</a> </td> </tr> <tr> <td class="news_desc" align="left" style="padding-top:5px;"> {$box_data.content_text|truncate:1750:" ...":true} </td> </tr> <tr> <td class="news_link" align="right" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_link">{#text_more#}</a> </td> </tr> </table> </td> </tr> {/foreach} <tr> <td class="news_link" align="left"> <a href="shop_content.php?coID=21" class="news_link">{#text_old_news#}</a> </td> </tr> </table> </td> </tr> </table> [/PHP] Ich hab schon mal die Möglichkeit mit Sections probiert, aber leider funktioniert dass auch nicht so ganz. Gibt es eine Möglichkeit, mit der man den Index während dem Schleifendurchlauf hochzählen kann. Wie geht das? Damit wäre vermutlich schon das Problem gelöst. Link to comment Share on other sites More sharing options...
h.team Posted April 16, 2009 Author Report Share Posted April 16, 2009 schon selbst gelöst: {config_load file="$language/lang_$language.conf" section="boxes"} <table width="648px" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" style="padding-top:15px;"> <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> <tr> {foreach name=aussen item=box_data from=$box_content} {php} $col++; {/php} <td width="45%" class="boxText" style="padding-top:5px;"> <table width="90%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="main" style="border-bottom: 1px solid; border-color: #cccccc; padding-bottom:5px;" align="left"> {php} $show = show_content_date($this->_tpl_vars['box_data']['content_time']); echo $show;{/php} </td> </tr> <tr> <td class="news_head" align="left" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_head">{$box_data.content_heading}</a> </td> </tr> <tr> <td class="news_desc" align="left" style="padding-top:5px;"> {$box_data.content_text|truncate:1500:" ...":true} </td> </tr> <tr> <td class="news_link" align="right" style="padding-top:5px;"> <a href="shop_content.php?coID={$box_data.content_group}" class="news_link">{#text_more#}</a> </td> </tr> </table> </td> {php} if ($col>=2) { $col=0; echo '</tr><tr>'; } {/php} {/foreach} </tr> <tr> <td class="news_link" align="left"> <a href="shop_content.php?coID=21" class="news_link">{#text_old_news#}</a> </td> </tr> </table> </td> </tr> </table>[/PHP] Hab einfach das berühmte: {php} $col++; {/php} und {php} if ($col>=2) { $col=0; echo '</tr><tr>'; } {/php} an die richtige Stelle gesetzt und schon funzt es. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.