我想让企业空间按找相应的行业分类在首页显示推荐的前五个.....
我用SQL写的标签 一个外循环 一个内循环
内循环的代码如下:
select top 5 KS_Blog.BlogName,KS_Blog.hits,KS_Blog.Logo,KS_Blog.Recommend,KS_Blog.Status,KS_Blog.UserID,KS_Enterprise.ClassID,KS_EnterPriseClass.ParentID,KS_EnterPriseClass.ClassName from KS_Blog,KS_Enterprise,KS_EnterPriseClass where KS_Blog.BlogName = KS_Enterprise.CompanyName and KS_Blog.Recommend=1 and KS_Blog.Status=1 and KS_EnterPriseClass.parentid={$Param(0)} and KS_Enterprise.ClassID={$Param(0)} order by KS_Blog.hits desc |
[loop=5]
<a href="/space/?{$Field(UserID,Num,0,2)}">
<img src="{$Field(Logo,Text,0,...,2,)}"/>
{$Field(BlogName,Text,15,...,2,该学校还没起名啊)}
</a>
[/loop] |
外循环的代码如下:
select KS_Blog.BlogName,KS_Blog.hits,KS_Blog.Logo,KS_Blog.Recommend,KS_Blog.Status,KS_Blog.UserID,KS_Enterprise.ClassID,KS_EnterPriseClass.ParentID,KS_EnterPriseClass.ClassName,KS_EnterPriseClass.ID,KS_EnterPriseClass.OrderID from KS_Blog,KS_Enterprise,KS_EnterPriseClass where KS_Blog.BlogName = KS_Enterprise.CompanyName and KS_Blog.Recommend=1 and KS_Blog.Status=1 and KS_EnterPriseClass.parentid=0 and KS_Enterprise.ClassID=KS_EnterPriseClass.ID order by KS_EnterPriseClass.OrderID,KS_EnterPriseClass.ID |
[loop=30]
<div style="height:20px;" class="classname"><span style="font-weight:bold"><img src="/images/arrow_r.gif"> <a href="/company/list.asp?pid={$Field(ID,GetInfoUrl,0,2)}">{$Field(ClassName,Text,0,...,0,)}</a></span>
</div>
<div style="height:50px;padding-left:12px">
{SQL_推荐企业({$Field(ID,GetInfoUrl,0,2)})}
</div>
[/loop] |
这样写好像不对 网官方给予帮助!!!