Comments/Troubleshooting
Using the Content Linking component is simple. Remember to separate each field in the Content Linking file with a tab character and each line with a single carriage return/linefeed combination.
One excellent use of the Content Linking component that I have seen is to dynamically generate a table of contents for your site. For example, the following code reads the Content Linking list called MyContentList.TXT and from it generates a table of contents. For more details about the methods used, see the following Methods reference.
<% ' Dimension local variables. Dim objNextLink Dim intTotalCount Dim intCounter ' Instantiate a NextLink object for this script. Set objNextLink = Server.CreateObject("MSWC.NextLink") ' Retrieve a total count of items in the Content Linking ' file. intTotalCount = _ objNextLink.GetListCount("/MyContentList.TXT") ' Iterate through all the items in the Content Linking ' list and generate an entry in an ordered list. %> <OL> <UL> <% For intCounter = 1 to intTotalCount strOutput = objNextLink.GetNthURL("/MyContentList.TXT", _ intCounter) %> <LI> <!-- Create a hyperlink to the URL for the current item --> <!-- in the list. --> <A HREF= "<%=strOutput%>"> <!-- Retrieve the text description for that URL. --> <%=objNextLink.GetNthDescription("/MyContentList.TXT", _ intCounter)%> %> </A></LI> <% Next %> </UL> </OL> <% ' Release the memory held for the NextLink object. Set objNextLink = Nothing %>
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.