PC Review


Reply
Thread Tools Rate Thread

complicated include?

 
 
chris leeds
Guest
Posts: n/a
 
      31st Mar 2004
I'm going to be using some pages as server side includes (ASP) but I can't
be confident that the user who will be editing these will be reliable enough
to make sure there is no head+body tags.

does anyone know of an example or article on how I might make the include
only take the stuff between the <body> tags? kind of like an fp include but
in real time?

TIA

--
The email address on this posting is a "black hole". I got tired of all the
spam.
Please feel free to contact me here:
http://nedp.net/contact/
--




 
Reply With Quote
 
 
 
 
Thomas A. Rowe
Guest
Posts: n/a
 
      31st Mar 2004
Use the FP Include to include the content that will be updated by the client. Use the ASP include
for content that is loaded before the <HTML> tag

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"chris leeds" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> I'm going to be using some pages as server side includes (ASP) but I can't
> be confident that the user who will be editing these will be reliable enough
> to make sure there is no head+body tags.
>
> does anyone know of an example or article on how I might make the include
> only take the stuff between the <body> tags? kind of like an fp include but
> in real time?
>
> TIA
>
> --
> The email address on this posting is a "black hole". I got tired of all the
> spam.
> Please feel free to contact me here:
> http://nedp.net/contact/
> --
>
>
>
>



 
Reply With Quote
 
chris leeds
Guest
Posts: n/a
 
      31st Mar 2004
but I'm spanning subwebs (to keep the client out of the main web).
I'm looking for something that'll read what's between the <body> tags and
include it real time. like a FrontPage include only "run time".

--
The email address on this posting is a "black hole". I got tired of all the
spam.
Please feel free to contact me here:
http://nedp.net/contact/
--


"Thomas A. Rowe" <(E-Mail Removed)> wrote in message
news:O$(E-Mail Removed)...
> Use the FP Include to include the content that will be updated by the

client. Use the ASP include
> for content that is loaded before the <HTML> tag
>
> --
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "chris leeds" <(E-Mail Removed)> wrote in message

news:(E-Mail Removed)...
> > I'm going to be using some pages as server side includes (ASP) but I

can't
> > be confident that the user who will be editing these will be reliable

enough
> > to make sure there is no head+body tags.
> >
> > does anyone know of an example or article on how I might make the

include
> > only take the stuff between the <body> tags? kind of like an fp include

but
> > in real time?
> >
> > TIA
> >
> > --
> > The email address on this posting is a "black hole". I got tired of all

the
> > spam.
> > Please feel free to contact me here:
> > http://nedp.net/contact/
> > --
> >
> >
> >
> >

>
>



 
Reply With Quote
 
Jim Buyens
Guest
Posts: n/a
 
      31st Mar 2004
Write an ASP page that reads a given HTML file into a
variable.

Next, find the string "<body" and then the next ">".
Delete everything up to that point.

intBodBeg = InStr(lcase(strPage), "<body")
if intBodBeg >0 then
intBodEnd = instr(intBodBeg, strPage, ">")
if intBodEnd > 0 then
strPage = mid(strPage, intBodEnd + 1)
end if
end if

Next, find the string "</body" and discard everything from
that point onward.

intBodEnd = instr(lcase(strPage), "</body")
if intBodEnd > 0 then
strPage = left(strPage, intBodEnd - 1)
end if

Then write whatever is left into the response stream.

response.write strPage

Please note, however, that if you accept the filename from
a form field or query string, an unscrupulous visitor
could feed in odd filenames and browse data from all over
your server. So, make sure you edit the file name and
verify it contains no slashes, backslashes, ..'s and so
forth.

This approach has the added advantage that you ASP pages,
containing program code, can be in a different subweb than
the pages that the users update.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------




>-----Original Message-----
>I'm going to be using some pages as server side includes
>(ASP) but I can't be confident that the user who will be
>editing these will be reliable enough to make sure there
>is no head+body tags.
>
>does anyone know of an example or article on how I might
>make the include only take the stuff between the <body>
>tags? kind of like an fp include but in real time?
>
>TIA
>
>--
>The email address on this posting is a "black hole". I

got tired of all the
>spam.
>Please feel free to contact me here:
>http://nedp.net/contact/
>--
>
>
>
>
>.
>

 
Reply With Quote
 
chris leeds
Guest
Posts: n/a
 
      31st Mar 2004
Thanks Jim,
this is pretty much what I was looking for.
If you, or anyone else, knows of a resource (tutorial or example) that goes
into the detail about what and how each of these lines works I'd appreciate
it.

I can "sort of" understand what you've written but I lack enough underlying
skill to put it into action with any kind of confidence.

--
The email address on this posting is a "black hole". I got tired of all the
spam.
Please feel free to contact me here:
http://nedp.net/contact/
--


"Jim Buyens" <(E-Mail Removed)> wrote in message
news:16c5901c4175a$94f3aef0$(E-Mail Removed)...
> Write an ASP page that reads a given HTML file into a
> variable.
>
> Next, find the string "<body" and then the next ">".
> Delete everything up to that point.
>
> intBodBeg = InStr(lcase(strPage), "<body")
> if intBodBeg >0 then
> intBodEnd = instr(intBodBeg, strPage, ">")
> if intBodEnd > 0 then
> strPage = mid(strPage, intBodEnd + 1)
> end if
> end if
>
> Next, find the string "</body" and discard everything from
> that point onward.
>
> intBodEnd = instr(lcase(strPage), "</body")
> if intBodEnd > 0 then
> strPage = left(strPage, intBodEnd - 1)
> end if
>
> Then write whatever is left into the response stream.
>
> response.write strPage
>
> Please note, however, that if you accept the filename from
> a form field or query string, an unscrupulous visitor
> could feed in odd filenames and browse data from all over
> your server. So, make sure you edit the file name and
> verify it contains no slashes, backslashes, ..'s and so
> forth.
>
> This approach has the added advantage that you ASP pages,
> containing program code, can be in a different subweb than
> the pages that the users update.
>
> Jim Buyens
> Microsoft FrontPage MVP
> http://www.interlacken.com
> Author of:
> *----------------------------------------------------
> |\---------------------------------------------------
> || Microsoft Office FrontPage 2003 Inside Out
> ||---------------------------------------------------
> || Web Database Development Step by Step .NET Edition
> || Microsoft FrontPage Version 2002 Inside Out
> || Faster Smarter Beginning Programming
> || (All from Microsoft Press)
> |/---------------------------------------------------
> *----------------------------------------------------
>
>
>
>
> >-----Original Message-----
> >I'm going to be using some pages as server side includes
> >(ASP) but I can't be confident that the user who will be
> >editing these will be reliable enough to make sure there
> >is no head+body tags.
> >
> >does anyone know of an example or article on how I might
> >make the include only take the stuff between the <body>
> >tags? kind of like an fp include but in real time?
> >
> >TIA
> >
> >--
> >The email address on this posting is a "black hole". I

> got tired of all the
> >spam.
> >Please feel free to contact me here:
> >http://nedp.net/contact/
> >--
> >
> >
> >
> >
> >.
> >



 
Reply With Quote
 
Jim Buyens
Guest
Posts: n/a
 
      1st Apr 2004
"chris leeds" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Thanks Jim,
> this is pretty much what I was looking for.
> If you, or anyone else, knows of a resource (tutorial or example) that goes
> into the detail about what and how each of these lines works I'd appreciate
> it.
>
> I can "sort of" understand what you've written but I lack enough underlying
> skill to put it into action with any kind of confidence.


Oh, all right, just because someone else recently asked the same
question.

Here's a complete page that does the job. If you save this page as
includebody.asp and then browse

includebody.asp?inc=content.htm

it will display the body section of content/content.htm whereever the

<%IncludeBody(request("inc"))%>

tag appears.

To modify the path from the page that contains the IncludeBody
subroutine to the page whose body section you want to include, modify
this statement.

const IncludePath = "content/"

<%option explicit%>
<html>
<head>
<title>Include Body Example</title>
</head>
<body>
<%
Sub IncludeBody(aUrl)
const ForReading = 1
const FormatAscii = 0
const IncludePath = "content/"
Dim regEx
Dim bodyUrl
Dim fso
Dim physFile
Dim tsPage
Dim strPage
Dim intBodBeg
Dim intBodEnd

bodyUrl = trim(aUrl)
If bodyUrl = "" Then
response.write "No file specified."
Exit Sub
End If

' Verify syntax of include URL is alphanumeric.alphanumeric
' (To avoid file system exploits.)
Set regEx = New RegExp
regEx.Pattern = "^[a-zA-Z0-9]+\x2e[a-zA-Z0-9]+$"
If Not regEx.Test(bodyUrl) Then
response.write "Illegal file name."
Exit Sub
End If

' Translate include URL to physical path and verify it exists.
set fso = server.createobject("scripting.filesystemobject")
physFile = server.mappath(IncludePath & bodyUrl)
If Not fso.FileExists(physfile) Then
response.write "File not found."
Exit Sub
End If

' Copy physical file into strPage variable.
set tsPage = fso.OpenTextFile(physFile, ForReading, False,
FormatAscii)
strPage = tsPage.ReadAll
tsPage.close

' Chop off everything up to and including the <body> tag.
intBodBeg = InStr(lcase(strPage), "<body")
If intBodBeg > 0 Then
intBodEnd = instr(intBodBeg, strPage, ">")
If intBodEnd > 0 Then
strPage = mid(strPage, intBodEnd + 1)
End If
End If

' Chop off the </body> tag and anything that follows.
intBodEnd = instr(lcase(strPage), "</body")
If intBodEnd > 0 Then
strPage = left(strPage, intBodEnd - 1)
End If

' Send whatever remains to the visitor.
response.write strPage
End Sub
%>
<h1 align=center>Include Body Example</h1>
<%IncludeBody(request("inc"))%>
<hr>
<p>Page Footer</p>
</body>
</html>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very complicated report to go with a very complicated query....HEL ReportTrouble Microsoft Access Reports 1 14th Apr 2009 02:02 PM
webbot include working in Firefox but not in IE 7 (include pagejavascript problem) RC Microsoft Frontpage 3 27th Apr 2008 10:23 AM
What are the rules IE6 uses to include or not to include a URL into the drop-down list in the aldress box? aa Windows XP Internet Explorer 2 15th Sep 2006 05:26 PM
Include a button on toolbar to include/exclude original text when. =?Utf-8?B?bW9vbjE5NTE=?= Microsoft Outlook 0 29th Mar 2005 07:47 PM
Parent paths.....#include file / #include virtual =?Utf-8?B?QmVu?= Microsoft Frontpage 2 16th Mar 2005 12:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 PM.