开发者

Smarty Tag help

I am using an engine, where for forums Vbulletin is used and for Other thiiings social engine 3 is used, This was done by some professionals In one of the page I am having popular tags(In Social Engine) Its too long I want shortened it, How can I do it? here is my code

{* SHOW POPULAR TAGS START *}
                <tr>
                  <td align="left" valign="top"><img src="images/spacer.gif" alt="" width="1" height="10" /></td>
                </tr>
                <tr>
                  <td align="left" valign="top"><table width="220" border="0" align="left" cellpadding="0" cellspacing="0">
                     <tr>
                        <td width="12" align="left" valign="top"><img src="images/blog_belowtl.jpg" alt="" width="12" height="10" /></td>
                        <td width="196" align="left" valign="top" background="images/blog_belowtbg.jpg"><img src="images/spacer.gif" width="1" height="10" /></td>
                        <td width="12" align="right" valign="top"><img src="images/blog_belowtr.jpg" alt="" width="12" height="10" /></td>
                     </tr>
                     <tr>
                        <td align="left" valign="top" background="images/blog_belowlbg.jpg" style="background-repeat: repeat-y;">&nbsp;</td>
                        <td align="left" valign="top"><table width="196" border="0" align="left" cellpadding="0" cellspacing="0">
                          <tr>
                             <td align="left" valign="top" >
                                {*<div class="articletags" >
                                {foreach from=$popular_tags item=poptag}
                                    <a class="tag{$poptag.class}" href="articles.php?tag={$poptag.name}">{$poptag.name}</a>
                                {/foreach}
                                </div>*}
                                {foreach from=$popular_tags item=poptag}
                                    {if $poptag.count == '1' }
                                        {assign var=cssClass value='tahoma15_cloud'}
                                    {elseif $poptag.count == '2' }
                                        {assign var=cssClass value='tahoma12bold_cloud'}
                                    {elseif $poptag.count == '3'}
                                        {assign var=cssClass value='tahoma13bold_cloud'}
                                    {elseif $poptag.count == '4'}
                                        {assign var=cssClass value='tahoma14bold_cloud'}
                                    {elseif $poptag.count == '5'}
                                        {assign var=cssClass value='tahoma15_cloud'}
                                    {else}
                                        {assign var=cssClass value='tahoma18bold_cloud'}
                                    {/if}
                                    <span class="{$cssClass}"><a href="articles.php?tag={$poptag.name}" class="{$cssClass}">{$poptag.name}</a></span>
                                {/foreach}
                             </td>
                          </tr>
                        </table></td>
                        <td align="left" valign="top" background="images/blog_belowrbg.jpg" style="background-repeat: repeat-y;">&nbsp;</td>
                     </tr>
                     <tr>
                        <td align="left" valign="top"><img src="images/blog_belowbl.jpg" alt="" width="12" height="10" /></td>
                        <td align="left" valign="top" background="images/blog_belowbbg.jpg"><img src="images/spacer.gif" alt="" width="1" height="10" /></td>
                        <td align="right" valign="top"><img src="images/blog_belowbr.jpg" alt="" width="12" height="10" /></td>
                     </tr>
                  </table></td>
                </tr>
                {* SHOW POPULAR TAGS END *}

You can check the lenght of this tag, on this link http://www.managementparadise.com/articles.php

Currently it is displaying very long on the widget area I am new on this, so any help will be appreciated

:)

OK I ed开发者_如何转开发ited

{section name=poptag loop=$popular_tags max=20}
                                    {if $poptag.count == '1' }
                                        {assign var=cssClass value='tahoma15_cloud'}
                                    {elseif $poptag.count == '2' }
                                        {assign var=cssClass value='tahoma12bold_cloud'}
                                    {elseif $poptag.count == '3'}
                                        {assign var=cssClass value='tahoma13bold_cloud'}
                                    {elseif $poptag.count == '4'}
                                        {assign var=cssClass value='tahoma14bold_cloud'}
                                    {elseif $poptag.count == '5'}
                                        {assign var=cssClass value='tahoma15_cloud'}
                                    {else}
                                        {assign var=cssClass value='tahoma18bold_cloud'}
                                    {/if}
                                    <span class="{$cssClass}"><a href="articles.php?tag={$poptag.name}" class="{$cssClass}">{$poptag.name}</a></span>

                                {/section}


You should replace the {foreach} template tag with a {section} tag and set the max attribute on it to limit the times it is executed.

http://www.smarty.net/docsv2/en/language.function.section.tpl

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜