Fantasic. That's cured it - thanks very much.
Incidentally, you maybe interested in seeing the finished (badly written) code. Basically, it will export all of my forum threads to asp files, but with correct TITLE and META tags. The idea for this, is that I use the site search script (from Bruce), and now my site users can search my site pages and my forum threads at the same time - as they have been exported! Works a treat and my users (and hopeful Google) love it!
www.agni.gr
thanks again for your help. Beers are on me if you happen to pop by.
Nathan
<!--#include file="common.asp" -->
<!--#include file="date_time_functions.inc" -->
<!--#include file="langauge_file.inc" -->
<!--#include file="forum_permissions.inc" -->
<%
Response.Buffer = True
'Dimension variables
Dim rsForum 'Holds the Database Recordset Variable for the topic details
Dim rsThread 'Holds the database recordset variable for the thread
Dim intForumID 'Holds the forum ID number
Dim strForumName 'Holds the forum name
'Dim lngTopicID 'Holds the topic number
Dim strSubject 'Holds the topic subject
Dim strUsername 'Holds the Username of the thread
Dim lngUserID 'Holds the ID number of the user
Dim dtmTopicDate 'Holds the date the thread was made
Dim strMessage 'Holds the message body of the thread
Dim lngMessageID 'Holds the message ID number
Dim strAuthorHomepage 'Holds the homepage of the Username if it is given
Dim strAuthorLocation 'Holds the location of the user if given
Dim strAuthorAvatar 'Holds the authors avatar
Dim strAuthorSignature 'Holds the authors signature
Dim lngAuthorNumOfPosts 'Holds the number of posts the user has made to the forum
Dim dtmAuthorRegistration 'Holds the registration date of the user
Dim lngNumberOfViews 'Holds the number of times the topic has been viewed to save back to the database
Dim intStatus 'Holds the users interger status
Dim strStatus 'Holds the users status
Dim strMode 'Holds the mode of the page that is being passed
Dim intTopicPageNumber 'Holds the topic page position to link back to
Dim blnNoThread 'Set to true if there is no thread to view
Dim blnIsModerator 'Set to true if the user who posted the message is a forum moderator
Dim blnForumLocked 'Set to true if the forum is locked
Dim blnTopicLocked 'set to true if the topic is locked
Dim intThreadNo 'Holds the number of threads in the topic
Dim intPriority 'Holds the priority level of the topic
Dim strPostPage 'Holds the page the form is posted to
Dim intRecordPositionPageNum 'Holds the recorset page number to show the Threads for
Dim intTotalNumOfPages 'Holds the number of pages
Dim intRecordLoopCounter 'Holds the loop counter numeber
Dim intThreadPageLoopCounter 'Loop counter for other thread page link
Dim intTotalNumOfThreads 'Holds the total number of therads in this topic
Dim strAuthorIP 'Holds the authors IP
Dim strSearchKeywords 'Holds the keywords to search for
Dim sarySearchWord 'Array to hold the search words
Dim intHighlightLoopCounter 'Loop counter to loop through words and hightlight them
Dim poststext
Const fsoForWriting = 2
dim path
dim body, head
dim textformat
Dim title
for lngTopicID = 2000 to 2121
'Get the threads from the database
'Create a record set object to the Threads held in the database
Set rsThread = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database get the thread details
strSQL = "EXECUTE wwfSpThreadDetails @lngTopicID = " & lngTopicID
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsThread.CursorType = 1
'Query the database
rsThread.Open strSQL, strCon
'If there is no topic in the database then display the appropraite mesasage
If rsThread.EOF Then
'If there are no thread's to display then display the appropriate error message
strSubject = strTxtNoThreads
'Else there are records returned by the database
Else
'Read in the thread subject forum ID and where the topic is locked
strSubject = rsThread("Subject")
End If
if not strSubject = strTxtNoThreads then
Response.Write strSubject
Response.Write "<BR>"
Dim objFSO
Dim objTextStream
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strsubject = Replace(strsubject, "?", " ", 1, -1, 1)
strsubject = Replace(strsubject, ",", " ", 1, -1, 1)
strsubject = Replace(strsubject, "\", " ", 1, -1, 1)
strsubject = Replace(strsubject, "/", " ", 1, -1, 1)
strsubject = Replace(strsubject, "'", " ", 1, -1, 1)
strsubject = Replace(strsubject, ":", " ", 1, -1, 1)
strsubject = Replace(strsubject, "o", "o", 1, -1, 1)
strsubject = Replace(strsubject, "’", "", 1, -1, 1)
strsubject = Replace(strsubject, "O", "o", 1, -1, 1)
path = server.MapPath("posts/"& strsubject &" - Corfu Post.asp")
path = Replace(path, " ", "_", 1, -1, 1)
Response.Write lngTopicID & " "
Response.Write path
Response.Write "<BR>"
Response.Write "<BR>"
Set objTextStream = objFSO.OpenTextFile(path, fsoForWriting, True)
head = "<" & "%" & "Option Explicit" & "%" & ">"
title = strSubject & " Corfu Travel Guide Discussion Forum"
title = Replace(title, " ", ",", 1, -1, 1)
body="<!--#include virtual=" & "/message_boards/display_topic_threads2.asp" & " -->"
'Display the contents of the text file
objTextStream.WriteLine head
objTextStream.WriteLine "<" & "%"
objTextStream.WriteLine
objTextStream.WriteLine "Dim lngTopicID"
objTextStream.WriteLine "lngTopicID = " & lngTopicID
objTextStream.WriteLine "%" & ">"
objTextStream.WriteLine
objTextStream.WriteLine "<html>"
objTextStream.WriteLine "<head>"
objTextStream.WriteLine "<title>" & strSubject & " - Corfu Travel Guide Discussion Forum </title>"
objTextStream.WriteLine "<meta name=""keywords"" content=""" & title & """>"
objTextStream.WriteLine "<meta name=""description"" content=""Corfu Forum Post - " & strSubject & """>"
objTextStream.WriteLine "<meta http-equiv=""Cache-Control"" content=""no-cache"">"
objTextStream.WriteLine "<meta name=""generator"" content=""Taverna Agni and Agni Travel - Corfu"">"
objTextStream.WriteLine "<meta name=""revisit-after"" content=""3