ASP Content Linking 컴포넌트
- 이전 페이지 ASP BrowserCap
- 다음 페이지 ASP ContentRotator
예제
- Content Linking 컴포넌트
- 이 예제에서는 내용 목록을 구축합니다.
- Content Linking 컴포넌트 2
- 이 예제에서는 Content Linking 컴포넌트를 사용하여 텍스트 파일에 나열된 페이지 간의 탐색을 수행합니다.
ASP Content Linking 컴포넌트
ASP Content Linking 컴포넌트는 빠르고 편리한 탐색 시스템을 생성하는 데 사용됩니다.
Content Linking 컴포넌트는 Nextlink 객체를 반환하며, 이 객체는 이동해야 할 웹 페이지의 목록을 포함합니다.
문법
<% Set nl=Server.CreateObject( "MSWC.NextLink" ) %>
먼저, 우리는 텍스트 파일 - "links.txt"를 생성합니다. 이 파일은 이동해야 할 페이지의 관련 정보를 포함하고 있습니다. 페이지의 배열 순서는 표시 순서와 같아야하며, 각 파일에 대한 설명(파일 이름과 설명 정보를 탭으로 구분)을 포함해야 합니다.
주석:리스트에 파일 정보를 추가하거나 목록에 있는 페이지 순서를 변경하려면,해야 할 모든 일은 단순히 이 텍스트 파일을 수정하는 것뿐입니다! 그런 다음 탐색 시스템이 자동으로 업데이트됩니다!
"links.txt":
asp_intro.asp ASP 소개 asp_syntax.asp ASP 문법 asp_variables.asp ASP 변수 asp_procedures.asp ASP 프로그램
위에 나열된 페이지에 다음 코드를 배치하세요:<!-- #include file="nlcode.inc"--> 이 코드는 "links.txt"에서 각 페이지에 아래 코드를 참조하여 나열되면 탐색이 작동합니다。
"nlcode.inc":
<% "Use the Content Linking Component "to navigate between the pages listed "in links.txt 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("'>이전 페이지</a>") end if Response.Write("<a href='" & nl.GetNextURL("links.txt")) Response.Write("'>다음 페이지</a>") %>
ASP 내용 링크 컴포넌트 메서드
GetListCount 메서드
내용 링크 목록 파일에 나열된 항목 수를 반환합니다:
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetListCount("links.txt") Response.Write("현재 ") Response.Write(c) Response.Write(" 목록에 항목 ") %>
출력:}}
리스트에 4 개의 항목이 있습니다
GetListIndex 메서드
현재 파일의 인덱스 번호를 내용 링크 목록 파일에서 반환합니다. 첫 번째 항목의 인덱스 번호는 1입니다. 현재 페이지가 목록 파일에 없다면 0을 반환합니다。
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetListIndex("links.txt") Response.Write("아이템 번호 ") Response.Write(c) %>
출력:}}
항목 번호 3
GetNextDescription 메서드
콘텐츠 링크 목록 파일에 나열된 다음 항목의 텍스트 설명을 반환합니다. 현재 파일이 목록 파일에서 찾지 못되면, 목록 중 마지막 페이지의 텍스트 설명입니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNextDescription("links.txt") Response.Write("다음 ") Response.Write("설명은: ") Response.Write(c) %>
출력: 다음 설명은: ASP 변수
GetNextURL 메서드
콘텐츠 링크 목록 파일에 나열된 다음 항목의 URL을 반환합니다. 현재 파일이 목록 파일에서 찾지 못되면, 목록 중 마지막 페이지의 URL입니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNextURL("links.txt") Response.Write("다음 ") Response.Write("URL은: ") Response.Write(c) %>
출력: 다음 URL은: asp_variables.asp
GetNthDescription 메서드
콘텐츠 링크 목록 파일에 나열된 N 번째 페이지의 설명 정보를 반환합니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNthDescription("links.txt",3) Response.Write("세 번째 ") Response.Write("설명은: ") Response.Write(c) %>
출력: 세 번째 설명은: ASP 변수
GetNthURL 메서드
콘텐츠 링크 목록 파일에 나열된 N 번째 페이지의 URL을 반환합니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetNthURL("links.txt",3) Response.Write("세 번째 ") Response.Write("URL은: ") Response.Write(c) %>
출력: 세 번째 URL은: asp_variables.asp
GetPreviousDescription 메서드
콘텐츠 링크 목록 파일에 나열된 이전 항목의 텍스트 설명을 반환합니다. 현재 파일이 목록 파일에서 찾지 못되면, 목록 중 첫 번째 페이지의 텍스트 설명입니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetPreviousDescription("links.txt") Response.Write("이전 ") Response.Write("설명은: ") Response.Write(c) %>
출력: 이전 설명은: ASP 변수
GetPreviousURL 메서드
콘텐츠 링크 목록 파일에 나열된 이전 항목의 URL을 반환합니다. 현재 파일이 목록 파일에서 찾지 못되면, 목록 중 첫 번째 페이지의 URL입니다.
예제
<% dim nl,c Set nl=Server.CreateObject("MSWC.NextLink") c=nl.GetPreviousURL("links.txt") Response.Write("이전 ") Response.Write("URL은: ") Response.Write(c) %>
출력: 이전 URL은: asp_variables.asp입니다
- 이전 페이지 ASP BrowserCap
- 다음 페이지 ASP ContentRotator