Step 3 - Layout
July 10, 2000
By now you should have one or more pages with properly formatted HTML
(with all extraneous tags removed). All pages should have an entry in
tblPages, with a many-to-one relationship to tblFiles (ie there will be
many entries in tblPages that will correspond to one entry in tblFiles).
Now we must apply the format and layout of the existing site to the new
content.
Choose or create a template that will be the basis of the new content.
Separate out the content that will remain static (things that won't
change from article to article) and the content that will change every
time.
Read here for a good short tutorial on templates. You can either
store the static portions in a database, or in a file. Just make sure
you know where the dynamic content goes - the title goes in the title
section, the content goes in the body section, etc.
Now to extract out the portion of the new content that you need, after
all, you don't want another set of <HTML> and <HEAD> tags,
since that part should already be in the static template. You can use
the following function to extract the necessary HTML from the document:
Function GetHTML(strContent, strStartTag, strEndTag)
' This procedure returns the portion of the HTML in strContent
' beginning with the HTML tag in the strStartTag variable and
' ending with the HTML tag in the strEndTag variable, not including the
' start and end HTML tags
' First get all of the HTML in the document.
strText = strContent
intStart = instr(1, strText, left(strStartTag,len(strStartTag)-1), vbtextcompare)
if intStart <> 0 then
intStart = instr(intStart+1, strText, right(strStartTag,1), vbtextcompare)
intEnd = InStr(intStart, strText, strEndTag, vbtextcompare)
GetHTML = Mid(strText, intStart + 1, intEnd - intStart - 1)
else
GetHTML = " "
end if
End Function
For instance, you'll want to put the title of the HTML document into
the database, so you'd simply make a call to this function:
temp = GetHTML(strContent, <title>, </title>)
and store the value of temp in the database. Then, you can insert the
proper portions of HTML into the template where it belongs, write the
file, and voila, you have your generated HTML page.
What about multiple pages?
If you have multiple pages in your document, you can do this for each
page. Since you stored the number of pages in each document in tblFiles,
you can just loop through the appropriate number and write each file
this way. Be sure to add in links on each page to the others, so users
can find their way around. For an example of what the finished
multi-page product looks like, check out any article on
Enfused.com, like
this one for example.
Another feature you could add would be an email notifier - whenever a
new article gets submitted (ie whenever someone completes the
submission process) send out an email to the editor in charge. Saves a
lot of time going back and forth. Go
here
for a short tutorial on using CDO to send such email notices.
You could also use the FSO to move, rename, and delete files. For
instance, the writers would upload all their documents into one
directory, and then once the file is properly formatted, you could push
the finished files to the appropriate directories, ie in a reviews
directory, and rename it to something more appropriate.
Step 2 (cont.) - Multiple pages
Content Management Made Easy with ASP
What about images?
|