|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
只要实现最基本的功能就可以了 就是可以添加留言 然后可以显示留言,然后加入管理功能xml|法式 利用时需求加载XSLT模块,法式下载地址:http://xiaocon.51.net/tree/tree.zip
演示地址:
http://xiaocon.51.net/tree/tree.htm
" target=_blank>
http://xiaocon.51.net/tree/tree.htm
或
http://xiaocon.51.net/tree/navi.xml
" target=_blank>
http://xiaocon.51.net/tree/navi.xml
51.net上不撑持xslt :(
法式文件:
===========================================================
<?php
$xslstring = implode('',file("navigator.xsl"));
$xmlstring = implode('',file("navi.xml"));
$arguments = array(
'/_xml' => $xmlstring,
'/_xsl' => $xslstring
);
$xh = xslt_create();
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($result) {
print $result;
}
else {
print "Err";
}
xslt_free($xh);
?>
xml文件
===========================================================
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet type="text/xsl" href="navigator.xsl" ?>
<Navigation>
<Navigator ID="1" AncestorID="1" Layer="0" Title="花圃首页" Childs="0" Url="default.asp&" Image="images/dc.gif"/>
<Navigator ID="2" AncestorID="2" Layer="0" Title="我的花圃" Childs="4" Url="#" Image="default"/>
<Navigator ID="3" AncestorID="2" Layer="1" Title="保藏夹" Childs="4" Url="#" Image="default"/>
<Navigator ID="21" AncestorID="3" Layer="2" Title="我办理的花坛" Childs="0" Url="mybbs.asp?cat=g" Image="images/dc-new.gif"/>
<Navigator ID="22" AncestorID="3" Layer="2" Title="我种下的种子" Childs="0" Url="mybbs.asp?cat=t" Image="images/dc-new.gif"/>
<Navigator ID="23" AncestorID="3" Layer="2" Title="我喜好的花圃" Childs="0" Url="myfavorite.asp?cat=g&s=test" Image="images/dc-new.gif"/>
<Navigator ID="24" AncestorID="3" Layer="2" Title="我保藏的文章" Childs="0" Url="myfavorite.asp?cat=t" Image="images/dc-new.gif"/>
<Navigator ID="4" AncestorID="2" Layer="1" Title="团体东西箱" Childs="2" Url="#" Image="default"/>
<Navigator ID="25" AncestorID="4" Layer="2" Title="设置装备摆设和办理" Childs="0" Url="personal.asp" Image="images/dc-config.gif"/>
<Navigator ID="26" AncestorID="4" Layer="2" Title="花瓣兑换点" Childs="0" Url="apetal.asp" Image="images/dc-config.gif"/>
<Navigator ID="27" AncestorID="2" Layer="1" Title="我的日志本" Childs="0" Url="mydiary.asp" Image="images/dc-diary.gif"/>
<Navigator ID="6" AncestorID="2" Layer="1" Title="密友和短讯" Childs="0" Url="myfriend.asp" Image="images/dc-friends.gif"/>
<Navigator ID="7" AncestorID="7" Layer="0" Title="盘算机手艺" Childs="2" Url="#" Image="default"/>
<Navigator ID="8" AncestorID="7" Layer="1" Title="DHTML,JScript" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="9" AncestorID="7" Layer="1" Title=".NET,ASP+切磋" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="10" AncestorID="7" Layer="1" Title="ASP合作" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="11" AncestorID="11" Layer="0" Title="箐箐校园" Childs="2" Url="#" Image="default"/>
<Navigator ID="12" AncestorID="11" Layer="1" Title="南京大学" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="13" AncestorID="11" Layer="1" Title="西北大学" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="14" AncestorID="14" Layer="0" Title="花圃・有个广场" Childs="2" Url="#" Image="default"/>
<Navigator ID="15" AncestorID="14" Layer="1" Title="定见箱" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="16" AncestorID="14" Layer="1" Title="花圃・人物故事" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="17" AncestorID="17" Layer="0" Title="花匠办公室" Childs="0" Url="bbsgroup.asp" Image="images/dc-key.gif"/>
<Navigator ID="18" AncestorID="18" Layer="0" Title="青青芳草地" Childs="0" Url="bbsgroup.asp" Image="images/dc.gif"/>
<Navigator ID="19" AncestorID="19" Layer="0" Title="统计信息" Childs="0" Url="viewlog.asp" Image="images/dc-chart.gif"/>
<Navigator ID="20" AncestorID="20" Layer="0" Title="ActiveCard" Childs="0" Url="activecard?fromgarden" Image="images/dc-card.gif"/>
</Navigation>
XSLT文件
============================================================
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method ="html" version="1.0" encoding="GB2312" indent="yes"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>XSLT树形导航栏</TITLE>
<LINK rel="stylesheet" type="text/CSS" href="navigator.css"/>
<SCRIPT src="toggle.js"></SCRIPT>
</HEAD>
<BODY>
<DIV >
<TABLE>
<TR>
<TD><DIV noWrap="true" STYLE="padding-left:0em;">有座花圃分类目次</DIV></TD>
</TR>
<xsl:for-each select="Navigation/Navigator">
<TR>
<xsl:attribute name="TITLE"><xsl:value-of select="@Title" /></xsl:attribute>
<xsl:attribute name="Class">Navigator<xsl:if test="@Layer[.>0]">-Hidden</xsl:if></xsl:attribute>
<xsl:attribute name="ID"><xsl:value-of select="@ID"/></xsl:attribute>
<xsl:attribute name="AncestorID"><xsl:value-of select="@AncestorID"/></xsl:attribute>
<xsl:attribute name="Depth"><xsl:value-of select="@Layer"/></xsl:attribute>
<xsl:if test="@Childs[.>0]">
<xsl:attribute name="Expanded">no</xsl:attribute>
</xsl:if>
<TD STYLE="cursor:hand">
<DIV noWrap="true"><xsl:attribute name="STYLE">padding-left:<xsl:value-of select="@Layer"/>em;</xsl:attribute>
<xsl:choose>
<xsl:when test="@Childs[.>0]"><IMG src=http://www.163design.net/p/b/"images/bs.gif"><xsl:attribute name="onclick">toggle('<xsl:value-of select="@ID" />')</xsl:attribute></IMG></xsl:when>
<xsl:otherwise><IMG><xsl:attribute name="src"><xsl:value-of select="@Image" /></xsl:attribute></IMG></xsl:otherwise>
</xsl:choose>
<A><xsl:if test="@Childs[.>0]"><xsl:attribute name="onclick">toggle('<xsl:value-of select="@ID" />')</xsl:attribute></xsl:if><xsl:attribute name="href"><xsl:value-of select="@Url" /></xsl:attribute><xsl:value-of select="@Title" /></A></DIV></TD>
</TR>
</xsl:for-each>
</TABLE>
</DIV>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
虽说不上很好,但至少一般的数据操作,再在原有的SQL语言的基础上,用得还是可以的。 |
|