Tutoriais ASP

ASP HOME

Tutorial WP

Introdução às páginas da Web Navalha de páginas da Web Layout de páginas da Web Pastas de páginas da Web Páginas da Web globais Formulários de páginas da Web Objetos de páginas da Web Arquivos de páginas da Web Bancos de dados de páginas da Web Assistentes de páginas da Web Páginas da Web WebGrid Gráficos de páginas da Web E-mail de páginas da Web Segurança de páginas da Web Publicação de páginas da Web Exemplos de páginas da Web Aulas de páginas da Web

Máquina de barbear ASP.NET

Introdução à navalha Sintaxe Razor Variáveis ​​Razor C# Loops Razor C# Razor C# Logic Variáveis ​​Razor VB Loops Razor VB Lógica do Razor VB

ASP Clássico

Introdução ASP Sintaxe ASP Variáveis ​​ASP Procedimentos ASP Condicionais ASP Loop ASP Formulários ASP Cookies ASP Sessão ASP Aplicativo ASP ASP #incluir ASP Global.asa ASP AJAX e-mail ASP Exemplos ASP

Referência ASP

Funções ASP VB Palavras-chave ASP VB Resposta ASP Solicitação ASP Aplicativo ASP Sessão ASP Servidor ASP Erro ASP Sistema de arquivos ASP Fluxo de texto ASP Unidade ASP Arquivo ASP Pasta ASP Dicionário ASP ASP AdRotator ASP BrowserCap Vinculação de conteúdo ASP Rotador de conteúdo ASP Referência Rápida ASP

Tutorial ADO

Introdução ao ADO ADO Connect Conjunto de registros ADO Exibição ADO Consulta ADO ADO Sort Adicionar ADO Atualização ADO Excluir ADO Demonstração ADO Aceleração ADO

Objetos ADO

Comando ADO Conexão ADO Erro ADO Campo ADO Parâmetro ADO Propriedade ADO Registro ADO Conjunto de registros ADO Fluxo ADO Tipos de dados ADO

Componente de Vinculação de Conteúdo ASP


Mais exemplos


de conteúdo Crie um índice.


Use o Componente de Link de Conteúdo para navegar entre as páginas em um arquivo de texto.


Componente de Vinculação de Conteúdo ASP

O componente ASP Content Linking é usado para criar um sistema de navegação rápido e fácil!

O componente Content Linking retorna um objeto Nextlink que é usado para manter uma lista de páginas da Web a serem navegadas.

Sintaxe

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

Exemplo de link de conteúdo ASP

Primeiro criamos um arquivo de texto - "links.txt":

asp_intro.asp ASP Intro
asp_syntax.asp ASP Syntax
asp_variables.asp ASP Variables
asp_procedures.asp ASP Procedures

O arquivo de texto acima contém as páginas a serem navegadas. As páginas devem ser listadas na mesma ordem em que você deseja que sejam exibidas e também deve conter uma descrição para cada nome de arquivo (use a tecla tab para separar o nome do arquivo da descrição).

Nota: Se você deseja adicionar uma página ou alterar a ordem das páginas na lista; você só precisa modificar o arquivo de texto! A navegação será corrigida automaticamente!

Em seguida, criamos um arquivo de inclusão, "nlcode.inc". O arquivo .inc cria um objeto NextLink para navegar entre as páginas listadas em "links.txt".

"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>")
%>

Em cada uma das páginas .asp listadas no arquivo de texto "links.txt", coloque uma linha de código: <!-- #include file="nlcode.inc"--> . Esta linha incluirá o código em "nlcode.inc" em todas as páginas listadas em "links.txt" e a navegação funcionará.



Métodos do ASP Content Linking Component

Method Description Example
GetListCount Returns the number of items listed in the Content Linking List file <%
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")
%>

Output:

There are 4 items in the list

GetListIndex Returns the index number of the current item in the Content Linking List file. The index number of the first item is 1. 0 is returned if the current page is not in the Content Linking List file <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

Output:

Item number 3

GetNextDescription Returns the text description of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the last page on the list <%
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 Returns the URL of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the last page on the list <%
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 Returns the description of the Nth page listed in the Content Linking List file <%
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 Returns the URL of the Nth page listed in the Content Linking List file <%
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 Returns the text description of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the first page on the list <%
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 Returns the URL of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the first page on the list <%
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