Latest web development tutorials

ASPコンテンツリンク

例

試してみてください - 例

コンテンツリンクコンポーネント
この場合、コンテンツのテーブルを構築します。

コンポーネント2コンテンツリンク
この例では、移動するためのテキストファイル内のページ間のコンポーネントをコンテンツリンクを使用しています。


ASPコンテンツリンクコンポーネント

迅速かつ容易なナビゲーションシステムを作成するためのコンポーネントをリンクASPコンテンツ!

コンポーネントをコンテンツリンクは、必要なナビゲーション・ページのリストを保持するために使用されるNextlinkオブジェクトを返します。

文法

<%
Set nl=Server.CreateObject("MSWC.NextLink")
%>


ASPコンテンツリンクの例

:「links.txt」 - まず、テキストファイルを作成します

asp_intro.asp ASP 简介
asp_syntax.asp ASP 语法
asp_variables.asp ASP 变量
asp_procedures.asp ASP 程序

必要なナビゲーション・ページが含まれている上記のテキストファイル。 ページの順序はそれらが同じ順序で表示され、(ファイルの名前と説明を区切るためにタブを使用)、各ファイル名の記述が含まれていなければなりません。

注:リストにページを追加したり、リスト内のページ順を変更したい場合は、テキストがそれをファイルを変更されて行う必要があります!ナビゲーションが自動的に更新されます!

私たちは、その後、参照ファイル、「nlcode.inc」を作成します。 ページ間の.incファイルは、ナビゲーションの「links.txt」に記載されているNextLinkオブジェクトを作成します。

「Nlcode.inc」:

<%
dim nl
Set nl=Server.CreateObject("MSWC.NextLink")
if (nl.GetListIndex("links.txt")>1) then
Response.Write("<a href='" & nl.GetPreviousURL("links.txt"))
Response.Write("'>Previous Page</a>")
end if
Response.Write("<a href='" & nl.GetNextURL("links.txt"))
Response.Write("'>Next Page</a>")
%>

< -の#includeファイル= "nlcode.inc:コードの行にリストされた各.aspページテキストファイル" links.txt」に置かれてください!」 - >。ナビゲーションの "links.txt」に記載されているすべてのページ上のコードの参照」nlcode.inc」このコード行は動作します。


ASPコンテンツリンクコンポーネントのメソッド

方法 描述 实例
GetListCount 返回内容链接列表文件中所列项目的数量。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListCount("links.txt")
Response.Write("There are ")
Response.Write(c)
Response.Write(" items in the list")
%>

输出:

There are 4 items in the list

GetListIndex 返回在内容链接列表文件中当前条目的索引号。第一个条目的索引号是 1。如果当前页面不在内容链接列表文件中,则返回 0。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

输出:

Item number 3

GetNextDescription 返回在内容链接列表文件中所列的下一个条目的文本描述。如果在列表文件中没有找到当前文件,则返回列表中最后一个页面的文本描述。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextDescription("links.txt")
Response.Write("Next ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Next description is: ASP Variables

GetNextURL 返回在内容链接列表文件中所列的下一个条目的 URL。如果在列表文件中没有找到当前文件,则返回列表中最后一个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextURL("links.txt")
Response.Write("Next ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Next URL is: asp_variables.asp

GetNthDescription 返在内容链接列表文件中所列的第 N 个页面的描述信息。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthDescription("links.txt",3)
Response.Write("Third ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Third description is: ASP Variables

GetNthURL 返回在内容链接列表文件中所列的第 N 个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthURL("links.txt",3)
Response.Write("Third ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Third URL is: asp_variables.asp

GetPreviousDescription 返回在内容链接列表文件中所列的前一个条目的文本描述。如果在列表文件中没有找到当前文件,则返回列表中第一个页面的文本描述。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousDescription("links.txt")
Response.Write("Previous ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Previous description is: ASP Variables

GetPreviousURL 返回在内容链接列表文件中所列的前一个条目的 URL。如果在列表文件中没有找到当前文件,则返回列表中第一个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousURL("links.txt")
Response.Write("Previous ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Previous URL is: asp_variables.asp