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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie'squestions

Status
Not open for further replies.

yuli1104

Programmer
Feb 20, 2002
60
CA
Hello,

we have a intranet wich are static html pages. Now the supervisor asked me to use simple asp (no xml, no xsl) to replace those html pages. the supervisor said "just use Reponse.write ... "

My first question is:
I tried to convert by just change the file name from default.htm to default.asp. It works fine. Should I still use Response.write ? IS the processing the same ? I mean the server needs to process the page and then send to the client side. since the page is static page with lots of tables, Isn't it better to just change the name ?

Second question:
I am going to use include file for header and footer. But the header needs a little bit change based on different includer page. for example, when department1.asp has the include file header.inc, the header.inc should show company logo + department1 name. if department2.asp, then company logo + department2 name. ... My question is can I pass variables between the includer and includee asp to conditionally control the department name ??

Thanks a lot
 
First question:

The way ASP works is it processes all the server-side script and sends it back to the client ... then it processes the client-side script ... i'm not sure why your supervisor wants you to convert everything to response.write ... in the end more stress gets put on the server ... there's no need to if everything is static ... changing the extension from .html to .asp doesn't matter if you don't add any ASP script in there.

Second question:

Yes, you can pass variables between the includer and includee asp to conditionally control the department name. Including a file is like directly copying the script into one page. Just declare the variable and set its value before including the page.

Ex.
.. in the main file
Dim departmentName
departmentName = "COMPANY"

<!--#include file=&quot;..PATH&quot;-->

.. in your header file you could have
<% response.write departmentName %>

and so on and so forth...

Hope this helps

Kevin
 
Yes. If you place your standard header ion an include file you could then put it into a function with a single required argument, like so:
Code:
Function ShowHeader(deptname)
   %>
   <div>
   <img src=&quot;mylogo.gif&quot;>
   This is my header!<br>
   Welcome to the <%=deptName%> Department!<br>
   </div>
   <%
End Function

Then anytime you wanted to use the header you could simply include that include file and call the header function:
Code:
<!--#include file=&quot;myheader.inc&quot;-->
<%
'do some processing

'do whatever

'time to output the header!
ShowHeader &quot;Accounting&quot;
%>

What I prefer to do is create one include file that will hold both the header and the footer inside functions. Then I can include that file at the top of my page and simply call the two functions when I want to display the header and footer.

As far as outputting the html as asp, you could simply leave it as static HTML. Since there is no real processing going on beyond the header and the footer, you shouldn't see a noticeable difference between the time it takes to load the file if it is all in HTML or all in Response.Write's

-Tarwn

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
minilogo.gif alt=tiernok.com
The never-completed website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top