开发者

Draw td by Smarty Templates?

i have categories and subs and i want draw every category with sub in td. i write this code but it draw all category with sub in one td. what is the problem? thank you

{section name=catsubs loop=$arrClientsCategorySub}
<td width="28" height="26" align="center" style="background-image:url(images/categorycolor.png); background-repeat:no-repeat; background-color:{$arrClientsCategorySub[catsubs].color}">
{section name=catsub2 loop=$arrClientsCategorySub[catsubs].arrsubCompanies}
<a id="ict-font-inner5sub" href="categorie开发者_开发知识库scompanies.php?categoryid={$arrClientsCategorySub[catsubs].arrsubCompanies[catsub2].catsubid}">{$arrClientsCategorySub[catsubs].arrsubCompanies[catsub2].catsubnumber}</a>
{/section}
</td>
<td width="5"></td>
{/section}


I think your <td> code needs to go one {section} deeper to go around every subcateogry. Try this:

{section name=catsubs loop=$arrClientsCategorySub} 
  {section name=catsub2 loop=$arrClientsCategorySub[catsubs].arrsubCompanies}
    <td width="28" height="26" align="center" style="background-image:url(images/categorycolor.png); background-repeat:no-repeat; background-color:{$arrClientsCategorySub[catsubs].color}">
      <a id="ict-font-inner5sub" href="categoriescompanies.php?categoryid={$arrClientsCategorySub[catsubs].arrsubCompanies[catsub2].catsubid}">{$arrClientsCategorySub[catsubs].arrsubCompanies[catsub2].catsubnumber}</a> 
    </td>
  {/section}
  <td width="5"></td> 
{/section} 

Also, your code will be a lot more efficient and lightweight if your <td> was assigned a styled class instead of all that code in the long style tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜