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!

passing values in and including HTML

Status
Not open for further replies.

furan

Programmer
Aug 17, 2001
17
0
0
GB
Ok, I've not really used asp before but i think it might have the ability to solve a problem I'm having at the moment.

I'm trying to create a single page to replace the 50 or so I have at present... here's the situation, I have a bundle of HTML pages which contain diagrams. When the user presses the custom print button, it goes and prints the page for that diagram... the thing is that a lot of the content from the 50 odd diagrams is repetitive. The page it prints is just a series of <!--#include statements which bring in all of the HMTL associated with that diagram ....whew!

Question is, Is is possible to submit an array of values to an asp page, have it build up the <!--#include statements and print off the new page.

This would get rid of the 50 text pages that accompany the diagrams and replace it with one asp page.... but I don't know, is it possible to do this with asp? The way I've been trying at the momenent of just getting the asp to response.write the include statements doesn't work...?

????confused???

Stuart
 
Furan,

Yes you can do that. When you say submit an array of values and get a specific result, do you mean collect some information from the visitor and submit that to an ASP page that will look at it and return something specific ?

You can just write the include statement outside of your ASP tags. Alot of ASP beginners get the impression that everything in an ASP page has to be inside ASP tags, forcing them to use Response.Write for everything. That's not true.

One Method
Code:
<%dim myName%>
<%myName = &quot;Todd&quot;%>
<%Response.Write &quot;<html><head></head>&quot;%>
<%Response.Write &quot;<body><font face=&quot;&quot;Arial&quot;&quot; size=&quot;&quot;2&quot;&quot;>&quot;%>
<%Response.Write myName & &quot;</font></body></html>&quot;%>
Another Method
Code:
<%
dim myName
myName = &quot;Todd&quot;
%>
<html>
<head>
</head>
<body>
<font face=&quot;Arial&quot; size=&quot;2&quot;><%=myName%></font>
</body>
</html>
Both produce the identical results. Well almost identical, when you view source, the first one looks a little ugly, because it writes everything on a single line. The second method formats the HTML exactly as you see it here.

Which one looks easier to work with to you ??

At any rate, to answer your question about the include, you just write that outside of your ASP tags. Like this.
Code:
<%
dim myName
myName = &quot;Todd&quot;

IF myName = &quot;Todd&quot; THEN
%>

<!-- #include file=&quot;incfolder/toddinfo.inc&quot; -->

<%
ELSEIF myName = &quot;Jane&quot; THEN
%>

<!-- #include file=&quot;incfolder/janeinfo.inc&quot; -->

<%
END IF
%>
Not many people agree with the way I tag my ASP. Alot of people will use a method like this.
Code:
<%dim myName
myName = &quot;Todd&quot;
IF myName = &quot;Todd&quot; THEN%>
<!-- #include file=&quot;faccinc/toddinfo.inc&quot; -->
<%ELSEIF myName = &quot;Jane&quot; THEN%>
<!-- #include file=&quot;faccinc/janeinfo.inc&quot; -->
<%END IF%>
The choice is yours. I like my tags to be as close to the first character in a line as possible so I know where to find them at all times. I also like to spread my page out a little, seperating ASP code and HTML code with at least one line break.

ToddWW
 
ok, got that... can anyone help further
I now have an HTML page which calls my asp page like so:
href=&quot;PrintRequest.asp?var1=tp1700&var2=tp1701
and I'm trying to include these files in the asp page and then print them... trouble is I can't get the include statement to loop... is it possible to do something like so in asp:

<% For i=0 to lengthofQueryString %>
<!--#include file'info/&quot;<% Request.QueryString(&quot;var&quot;&i) %>'>
<% Next %>

...

I realise what I've written is most likely complete gobbledigook in asp but it was the best I could do with my background...
If anyone can make sense of what i'm trying to do and point me in the right direction it'd be much appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top