|
File navigation bars
This example shows how to use text files to create
navigation on your web pages , using this you can add this script
to your pages and you would only have to alter the links in
the file . First create a file called demonav.txt in notepad
, in this file enter some links like this
<a href="index.php">home</a><br>
<a href="categorised.php">sample code</a><br>
<a href="componentsindex.php">components </a><br>
<a href="books.php">books </a><br>
<a href="tutorials.php">tutorials </a><br>
Of course these are links for this site but you
get the idea .
Now for the script
<%
'file navigation bars
Dim objFSO , objFile , strURL
'create an instance of the file system object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'open our navigation file which is called demonav.txt
Set objFile = objFSO.OpenTextFile(Server.MapPath("demonav.txt"))
'while we are not at the end of the file
While Not objFile.AtEndOfLine
strURL = objFile.ReadLine
'display the navigation bars
response.write("<a href=' " & strURL &
" '>" & strURL & "</a>")
Wend
'close the file
objFile.Close
'destroy the objects
Set objFile = nothing
Set objFSO = Nothing
%>
|