Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include pages and variables

Status
Not open for further replies.

waynea

Programmer
Jul 11, 2000
41
0
0
US
Is it possible to use variables to set an include page? For instance, if an alpha character passed through the URL is used to build a filename so that any one of several pages could be included in one basic header page, is there a way to use this variable in the include function? So far, I'm having no luck making it work. Here's a sample of the code I have so far:

<script language=&quot;VBScript&quot;>
dim strAlpha
dim strFileName
dim strHTML
With document.location
strAlpha = mid(.search,8,1)
strFileName = &quot;Data/tbAuthors_&quot; & strAlpha & &quot;.htm&quot;
strHTML = &quot;<!--webbot bot=&quot; & chr(34) &quot;Include&quot; & chr(34) & &quot; U-Include=&quot; & chr(34) & strFileName & chr(34) & &quot; TAG=&quot; & chr(34) & &quot;BODY&quot; & chr(34) & &quot; -->&quot;
document.write strHTML
end with
</SCRIPT>
 
I'm pretty sure that webbot code is processed server-side by DLLs installed with FrontPage Server Extensions.

I doubt these will work client-side.

We thrashed with a client-side include mechanism in thread329-518641 but remember it only works on IE 4.x and later.


Anybody else have some input?
 
Thanks, I'll give that a shot and see what happens.
 
In the process, I came across something else that works for me, at least so far: <IFRAME>

I can retrieve the parameter from the URL, use it to build the filename to be included, then concatenate an HTML string and use document.write to write the HTML.

<script language=&quot;VBScript&quot;>
dim strAlpha
dim strFileName
dim strHTML
With document.location
strAlpha = mid(.search,8,1)
strFileName = &quot;Data/tbAuthors_&quot; & strAlpha & &quot;.htm&quot;
strHTML = &quot;<IFRAME SRC='&quot; & strFileName & &quot;' FRAMEBORDER=0 SCROLLING='auto' NAME='extra' WIDTH='540' HEIGHT='415' ></IFRAME>&quot;
document.write strHTML
end with
</SCRIPT>

So far, that's working and looks like it'll do what I need.

Until the next thing pops up ... :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top