Bamarama Posted February 25, 2013 Share Posted February 25, 2013 Hello all. I am not sure if this is the correct forum for this question or not. If not, by all means steer me in the right direction please. I am making a variation on a game that uses PHP and tpl files. My question is this: How can I make my DB rows have 2 or more columns rather than the standard on the tpl page. Here is the code on the tpl page: {block name="title" prepend}{$LNG.lm_buildings}{/block} {block name="content"} {if !empty($Queue)} <div id="buildlist" class="buildlist"> <table style="width:760px"> {foreach $Queue as $List} {$ID = $List.element} <tr> <td style="width:70%;vertical-align:top;" class="left"> {$List@iteration}.: {if !($isBusy.research && ($ID == 6 || $ID == 31)) && !($isBusy.shipyard && ($ID == 15 || $ID == 21)) && $RoomIsOk && $CanBuildElement && $BuildInfoList[$ID].buyable} <form class="build_form" action="game.php?page=buildings" method="post"> <input type="hidden" name="cmd" value="insert"> <input type="hidden" name="building" value="{$ID}"> <button type="submit" class="build_submit onlist">{$LNG.tech.{$ID}} {$List.level}{if $List.destroy} {$LNG.bd_dismantle}{/if}</button> </form> {else}{$LNG.tech.{$ID}} {$List.level} {if $List.destroy}{$LNG.bd_dismantle}{/if}{/if} {if $List@first} <br><br><div id="progressbar" data-time="{$List.resttime}"></div> </td> <td> <div id="time" data-time="{$List.time}"><br></div> <form action="game.php?page=buildings" method="post" class="build_form"> <input type="hidden" name="cmd" value="cancel"> <button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button> </form> {else} </td> <td> <form action="game.php?page=buildings" method="post" class="build_form"> <input type="hidden" name="cmd" value="remove"> <input type="hidden" name="listid" value="{$List@iteration}"> <button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button> </form> {/if} <br><span style="color:lime" data-time="{$List.endtime}" class="timer">{$List.display}</span> </td> </tr> {/foreach} </table> </div> {/if} <table style="width:760px"> {foreach $BuildInfoList as $ID => $Element} <tr> <td rowspan="2" style="width:120px;"> <a href="#" onclick="return Dialog.info({$ID})"> <img src="{$dpath}gebaeude/{$ID}.gif" alt="{$LNG.tech.{$ID}}" width="120" height="120"> </a> </td> <th> <a href="#" onclick="return Dialog.info({$ID})">{$LNG.tech.{$ID}}</a>{if $Element.level > 0} ({$LNG.bd_lvl} {$Element.level}{if $Element.maxLevel != 255}/{$Element.maxLevel}{/if}){/if} </th> </tr> <tr> <td> <table style="width:100%"> <tr> <td class="transparent left" style="width:90%;padding:10px;"><p>{$LNG.shortDescription.{$ID}}</p> <p>{foreach $Element.costRessources as $RessID => $RessAmount} {$LNG.tech.{$RessID}}: <b><span style="color:{if $Element.costOverflow[$RessID] == 0}lime{else}red{/if}">{$RessAmount|number}</span></b> {/foreach}</p></td> <td class="transparent" style="vertical-align:middle;width:100px"> {if $Element.maxLevel == $Element.levelToBuild} <span style="color:red">{$LNG.bd_maxlevel}</span> {elseif ($isBusy.research && ($ID == 6 || $ID == 31)) || ($isBusy.shipyard && ($ID == 15 || $ID == 21))} <span style="color:red">{$LNG.bd_working}</span> {else} {if $RoomIsOk} {if $CanBuildElement && $Element.buyable} <form action="game.php?page=buildings" method="post" class="build_form"> <input type="hidden" name="cmd" value="insert"> <input type="hidden" name="building" value="{$ID}"> <button type="submit" class="build_submit">{if $Element.level == 0}{$LNG.bd_build}{else}{$LNG.bd_build_next_level}{$Element.levelToBuild + 1}{/if}</button> </form> {else} <span style="color:red">{if $Element.level == 0}{$LNG.bd_build}{else}{$LNG.bd_build_next_level}{$Element.levelToBuild + 1}{/if}</span> {/if} {else} <span style="color:red">{$LNG.bd_no_more_fields}</span> {/if} {/if} </td> </tr> </table> </td> </tr> <tr> <td colspan="2" style="margin-bottom:10px;"> <table style="width:100%"> <tr> <td class="transparent left"> {$LNG.bd_remaining}<br> {foreach $Element.costOverflow as $ResType => $ResCount} {$LNG.tech.{$ResType}}: <span style="font-weight:700">{$ResCount|number}</span><br> {/foreach} <br> </td> </tr> <tr> <td class="transparent left" style="width:68%"> {if !empty($Element.infoEnergy)} {$LNG.bd_next_level}<br> {$Element.infoEnergy}<br> {/if} {if $Element.level > 0} {if $ID == 43}<a href="#" onclick="return Dialog.info({$ID})">{$LNG.bd_jump_gate_action}</a>{/if} {if ($ID == 44 && !$HaveMissiles) || $ID != 44}<br><a class="tooltip_sticky" data-tooltip-content=" {* Start Destruction Popup *} <table style='width:300px'> <tr> <th colspan='2'>{$LNG.bd_price_for_destroy} {$LNG.tech.{$ID}} {$Element.level}</th> </tr> {foreach $Element.destroyRessources as $ResType => $ResCount} <tr> <td>{$LNG.tech.{$ResType}}</td> <td><span style='color:{if $Element.destroyOverflow[$RessID] == 0}lime{else}red{/if}'>{$ResCount|number}</span></td> </tr> {/foreach} <tr> <td>{$LNG.bd_destroy_time}</td> <td>{$Element.destroyTime|time}</td> </tr> <tr> <td colspan='2'> <form action='game.php?page=buildings' method='post' class='build_form'> <input type='hidden' name='cmd' value='destroy'> <input type='hidden' name='building' value='{$ID}'> <button type='submit' class='build_submit onlist'>{$LNG.bd_dismantle}</button> </form> </td> </tr> </table> {* End Destruction Popup *} ">{$LNG.bd_dismantle}</a>{/if} {else} {/if} </td> <td class="transparent right" style="white-space:nowrap;"> {$LNG.fgf_time}:<br>{$Element.elementTime|time} </td> </tr> </table> </td> </tr> {/foreach} </table> {/block} any help would be appreciated Link to comment https://forums.phpfreaks.com/topic/274939-multiple-columns-on-tpl-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.