看到一篇文章后发现:额,zblog+ytcms真的是无所不能...
本文转载自ytcms作者“瑜廷”的官方网站,用zblog做的贴吧额,牛X啊,感兴趣的可以围观下:http://d.pugu.biz。
内容如下:
遍历所有分类集合:
<!--{foreach Category Categorys}-->
<!--{if isObject(Category)}-->
<!--{if Category.ID<>0}-->
<li><a href="{$Category.Url}">{$Category.Name}</a></li>
<!--{/if}-->
<!--{/if}-->
<!--{/next}-->
获取分类ID为5的子分类:
<!--{eval ID = 5}-->
<!--{foreach Category Categorys}-->
<!--{if isObject(Category)}-->
<!--{if Category.ParentID = ID}-->
<li><a href="{$Category.Url}">{$Category.Name}</a></li>
<!--{/if}-->
<!--{/if}-->
<!--{/next}-->
通用header获取关键字描述(注:需Meta插件,需要在YTCMS创建模块名称为:keywords,description):
<!--{eval isSingle = isNumeric("<#article/id#>")}-->
<!--{eval isCatalog = isNumeric("<#articlelist/category/id#>")}-->
<!--{if isSingle}-->
<!--{YT:Article DataSource="GetArticleModel('<#article/id#>')" Name="a"}-->
<!--{eval meta_keywords = a.Meta.GetValue("keywords")}-->
<!--{eval meta_description = a.Meta.GetValue("description")}-->
<!--{if len(meta_keywords) = 0}-->
<!--{eval meta_keywords = a.TagToName}-->
<!--{/if}-->
<!--{if len(meta_description) = 0}-->
<!--{eval meta_description = left(TransferHTML(a.Content,"[nohtml][html-format]"),75)}-->
<!--{/if}-->
<!--{/YT:Article}-->
<!--{elseif isCatalog}-->
<!--{if isObject(Categorys("<#articlelist/category/id#>"))}-->
<!--{eval meta_keywords = Categorys("<#articlelist/category/id#>").Meta.GetValue("keywords")}-->
<!--{eval meta_description = Categorys("<#articlelist/category/id#>").Meta.GetValue("description")}-->
<!--{if len(meta_keywords) = 0}-->
<!--{eval meta_keywords = Categorys("<#articlelist/category/id#>").Name}-->
<!--{/if}-->
<!--{if len(meta_description) = 0}-->
<!--{eval meta_description = Categorys("<#articlelist/category/id#>").Name}-->
<!--{/if}-->
<!--{/if}-->
<!--{else}-->
<!--{eval meta_keywords = LoadFromFile(BlogPath&"zb_users/include/keywords.asp","utf-8")}-->
<!--{eval meta_keywords = TransferHTML(meta_keywords,"[nohtml][html-format]")}-->
<!--{eval meta_keywords = replace(replace(meta_keywords,chr(10),""),chr(13),"")}-->
<!--{eval meta_description = LoadFromFile(BlogPath&"zb_users/include/description.asp","utf-8")}-->
<!--{eval meta_description = TransferHTML(meta_description,"[nohtml][html-format]")}-->
<!--{eval meta_description = replace(replace(meta_description,chr(10),""),chr(13),"")}-->
<!--{/if}-->
<meta name="description" content="{$meta_description}" />
<meta name="keywords" content="{$meta_keywords}" />
保存YTCMS循环出来的数据生成XML文件:
<?xml version="1.0" encoding="gb2312"?>
<player showDisplay="yes" showPlaylist="no" autoStart="no">
<!--{YT:Article DataSource="GetArticleCategorys(5,'12')"}-->
<song path="{$BlogHost&url}" title="{$Article.Title}"/>
<!--{/YT:Article}-->
</player>
<%
htm = replace(htm,"{::vbcrlf}",vbcrlf)
htm = replace(htm,"{::vblf}",vblf)
htm = replace(htm,"{::vbcr}",vbcr)
htm = TransferHTML(htm,"[html-japan]")
Call SaveToFile(BlogPath&"mp3.xml",htm,"gb2312",False)
%>
获取每个分类下的5篇文章:
<!--{foreach Category Categorys}-->
<!--{if Category.ID<>0}-->
{YT:Article DataSource="GetArticleCategorys(5,Category.ID)"}
[<a href="{$Category.Url}">{$Category.Name}</a>]<a href="{$Article.Url}">{$Article.Title}</a>
{/YT:Article}
<!--{/if}-->
<!--{/next}-->
再感叹一句:真是炸裂...