移動公告的實現方法,可設定多條顯示

來源:互聯網
上載者:User
http://bbs.dvbbs.net/dispbbs.asp?BoardID=134&ID=1138809&replyID=&skin=1
http://www.hscripts.com/tutorials/html/marquee1.php(關於使用Marquee很好的文章)

進入後台----------風格介面模板總管理----------分頁面模板(page_index)------template.html(3)

1、移動1條公告方法

a、尋找代碼:

<xsl:variable name="marquee" select="0"/>

把上面紅色的0改為1

b、尋找代碼:

<xsl:variable name="maxposition" select="5"/>

把上面紅色的5改為1

2、移動多條公告方法

a、尋找代碼:

<xsl:variable name="marquee" select="0"/>

把上面紅色的0改為1

b、尋找代碼:

<xsl:variable name="maxposition" select="5"/>

把上面紅色的5改為你要的條數就行了

========================================
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" omit-xml-declaration = "yes" indent="yes" version="4.0"/>
 <!--
 Copyright (C) 2003-2005 AspSky.Net. All rights reserved.
 Written by Sinobankers.com CHEN Yong
 Web: http://www.sinobankers.com/
 Email: eway@aspsky.net
 論壇公告模板
 -->
<xsl:variable name="marquee" select="1"/><!--設定為1則移動公告-->
<xsl:variable name="maxposition" select="5"/><!--移動公告最多顯示多少條-->
<xsl:variable name="show" select="1"/><!--方便不想顯示公告的傢伙,這裡做了開關,設定為0則不顯示公告-->
<xsl:template  match="/">
<xsl:if test="$show=1">
<xsl:variable name="boardid" select="xml/@boardid"/>
<div class="itableborder">
<xsl:choose>
  <xsl:when test="xml/news[@boardid=$boardid]">
  <xsl:choose>
  <xsl:when test="$marquee=1">
  <div style="width:80%;">
  <marquee scrolldelay="150" bgcolor="yellow" scrollamount="4" onmouseout="if (document.all!=null)this.start()" onmouseover="if (document.all!=null)this.stop()">
  公告:<xsl:for-each select="xml/news[@boardid=$boardid][position() &lt; ($maxposition+1)]"> <a href="javascript:openScript('announcements.asp?boardid={$boardid}',500,400)"><b><xsl:value-of select="@title" disable-output-escaping="yes"/></b></a>(<xsl:value-of select="translate(@addtime,'T',' ')" />) </xsl:for-each>
  </marquee>
  </div>
  </xsl:when>
  <xsl:otherwise>
  <xsl:if test="xml/news[@boardid=$boardid]/@bgs and xml/news[@boardid=$boardid]/@bgs !=''"><bgsound  src="{xml/news[@boardid=$boardid]/@bgs}"/><img src="Skins/Default/filetype/mid.gif" border="0" alt="" /> </xsl:if><a href="javascript:openScript('announcements.asp?action=showone&amp;boardid={$boardid}',500,400)"><b><xsl:value-of select="xml/news[@boardid=$boardid]/@title" disable-output-escaping="yes"/></b></a>(<xsl:value-of select="translate(xml/news[@boardid=$boardid]/@addtime,'T',' ')" />)</xsl:otherwise>
   </xsl:choose>
  </xsl:when>
  <xsl:otherwise>
  <a href="javascript:openScript('announcements.asp?action=showone&amp;boardid={$boardid}',500,400)"><b>當前還未有公告</b></a>()
  </xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

改為如下格式:
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" omit-xml-declaration = "yes" indent="yes" version="4.0"/>
 <!--
 Copyright (C) 2004,2005 AspSky.Net. All rights reserved.
 Written by dvbbs.net Lao Mi
 Web: http://www.aspsky.net/,http://www.dvbbs.net/
 Email: eway@aspsky.net
 論壇公告模板
 -->
<xsl:variable name="marquee" select="1"/><!--設定為1則移動公告-->
<xsl:variable name="maxposition" select="5"/><!--移動公告最多顯示多少條-->
<xsl:variable name="show" select="1"/><!--方便不想顯示公告的傢伙,這裡做了開關,設定為0則不顯示公告-->
<xsl:template  match="/">
<xsl:if test="$show=1">
<xsl:variable name="boardid" select="xml/@boardid"/>
<div class="itableborder">
<xsl:choose>
  <xsl:when test="xml/news[@boardid=$boardid]">
  <xsl:choose>
  <xsl:when test="$marquee=1">
  <div style="width:100%;">
  <marquee scrolldelay="150" bgcolor="yellow" scrollamount="3" onmouseout="if (document.all!=null)this.start()" onmouseover="if (document.all!=null)this.stop()">
  公告:<xsl:for-each select="xml/news[@boardid=$boardid][position() &lt; ($maxposition+1)]"> <a href="javascript:openScript('announcements.asp?boardid={$boardid}',500,400)"><b><xsl:value-of select="@title" disable-output-escaping="yes"/></b></a>(<xsl:value-of select="translate(@addtime,'T',' ')" />) </xsl:for-each>
  </marquee>
  </div>
  </xsl:when>
  <xsl:otherwise>
  <xsl:if test="xml/news[@boardid=$boardid]/@bgs and xml/news[@boardid=$boardid]/@bgs !=''"><bgsound  src="{xml/news[@boardid=$boardid]/@bgs}"/><img src="Skins/Default/filetype/mid.gif" border="0" alt="" /> </xsl:if><a href="javascript:openScript('announcements.asp?action=showone&amp;boardid={$boardid}',500,400)"><b><xsl:value-of select="xml/news[@boardid=$boardid]/@title" disable-output-escaping="yes"/></b></a>(<xsl:value-of select="translate(xml/news[@boardid=$boardid]/@addtime,'T',' ')" />)</xsl:otherwise>
   </xsl:choose>
  </xsl:when>
  <xsl:otherwise>
  <a href="javascript:openScript('announcements.asp?action=showone&amp;boardid={$boardid}',500,400)"><b>當前還未有公告</b></a>()
  </xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.