在ASP中打印大块HTML [英] printing large blocks of HTML in ASP

查看:55
本文介绍了在ASP中打印大块HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站,我正在使用ASP,因为它具有模板化的

功能。我的页脚是一个包含文件,原因很明显。我的b $ b不能使用包含文件作为标题,因为,虽然页面的顶部将是90%相似的页面,但它们会有不同的标题,页面

标题和左侧导航菜单。我可以写一个函数,这样可以插入这些

变量,除了我不想要70行

Response.Write(foo)(那里)是每页

的适量格式)。 ASP是否具有打印在这里。像Perl那样的功能

打印出大块的HTML并插入变量?


print<<< ;;

< html>

< head>< title> strPageTitle< / title>

< meta description ="这个网站是所有感兴趣的人的网站

in ..">

< / head>

< body bgcolor =" wheat" LEFTMARGIN = QUOT; 0"链接= QUOT;蓝色" vlink =" blue">

< center>

< table width =" 600" bgcolor =" white">

< tr>< td colspan =" 3" height =" 10"& nbsp;< / td>< / tr>

< tr>

< td valign =" top" ;>

strMainLeftNav

< / td>

< td width =" 10">& nbsp;< / td>

< td>< center> strPAgeTitle< / center>

< p>

< table>< tr>< td>

<< <

I am making a web site and I am using ASP because of its templating
capabilities. My footer is an include file, for obvious reasons. I
can''t use an include file for the header, because, while the top of
the page will be 90% similar, they will have different titles, page
titles, and left nav menus. I could write a function so that these
vars can be interpolated, except I don''t want 70 lines of
Response.Write("foo") (there is a moderate amount of formatting on
each page). Does ASP have a "print HERE" function like Perl that
prints out large blocks of HTML and interpolates variables?

print <<<;
<html>
<head><title> strPageTitle </title>
<meta description="This site is an online for all those interested
in..">
</head>
<body bgcolor="wheat" leftmargin="0" link="blue" vlink="blue">
<center>
<table width="600" bgcolor="white">
<tr><td colspan="3" height="10">&nbsp;</td></tr>
<tr>
<td valign="top">
strMainLeftNav
</td>
<td width="10">&nbsp;</td>
<td><center> strPAgeTitle </center>
<p>
<table><tr><td>
<<<

推荐答案

ASP可以这种方式使用....


<%if a = 1然后%>

问候世界,我们安息吧。

<%else%>

问候世界,我们来征服。

<%end if if%>


ASP块之间的任何内容都将按原样发送给客户端。我认为这就是你要找的东西。


David H.

(一直在考虑&# V&'和'V-The Final Battle'最近)


Andrew写道:
ASP can be used in this manner....

<% if a=1 then %>
Greetings World, we come in peace.
<% else %>
Greetings World, we come to conquer.
<% end if %>

Anything between the ASP blocks would be sent to the client as is. I
think that this is what you''re looking for.

David H.
(Been thinking about "V" and "V-The Final Battle" recently)

Andrew wrote:
我正在建立一个网站,我正在使用ASP因为它的模板化的能力。我的页脚是一个包含文件,原因很明显。我不能使用包含文件作为标题,因为,虽然页面的顶部将是90%相似,但它们将具有不同的标题,页面标题,并且左侧导航菜单。我可以写一个函数,这样可以插入这些变量,除了我不想要70行的Response.Write(foo)(在<上有适量的格式化
每页)。 ASP是否具有打印在这里。像Perl这样的函数可以打印出大块的HTML并插入变量吗?

print<<< ;;
< html>
< head> <标题> strPageTitle< / title>
< meta description ="这个网站是所有感兴趣的人在网上
在&...>
< / head>
< body bgcolor ="小麦" LEFTMARGIN = QUOT; 0"链接= QUOT;蓝色" vlink =" blue">
< center>
< table width =" 600" bgcolor =" white">
< tr>< td colspan =" 3" height =" 10"& nbsp;< / td>< / tr>
< tr>
< td valign =" top">
strMainLeftNav
< / td>
< td width =" 10">& nbsp;< / td>
< td>< center> strPAgeTitle< / center>
< p>
< table>< tr>< td>
<<<
I am making a web site and I am using ASP because of its templating
capabilities. My footer is an include file, for obvious reasons. I
can''t use an include file for the header, because, while the top of
the page will be 90% similar, they will have different titles, page
titles, and left nav menus. I could write a function so that these
vars can be interpolated, except I don''t want 70 lines of
Response.Write("foo") (there is a moderate amount of formatting on
each page). Does ASP have a "print HERE" function like Perl that
prints out large blocks of HTML and interpolates variables?

print <<<;
<html>
<head><title> strPageTitle </title>
<meta description="This site is an online for all those interested
in..">
</head>
<body bgcolor="wheat" leftmargin="0" link="blue" vlink="blue">
<center>
<table width="600" bgcolor="white">
<tr><td colspan="3" height="10">&nbsp;</td></tr>
<tr>
<td valign="top">
strMainLeftNav
</td>
<td width="10">&nbsp;</td>
<td><center> strPAgeTitle </center>
<p>
<table><tr><td>
<<<






我刚算过,我的网页顶部是169行HTML和

DHTML。


我的问题是关于在ASP中清楚地/有效地打印大块的HTML

(不使用Response.Write(")169次),而不是

关于根据x或y打印不同的东西。


-AK
I just counted, and the top of my web page is 169 lines of HTML and
DHTML.

My question was really about printing out large blocks of HTML in ASP
clearly/efficiently (without using Response.Write("") 169 times), not
about printing different things depending on x or y.

-AK


" Andrew" < AK **** @ web4000.com>在消息中写道

news:42 ************************** @ posting.google.c om ...
"Andrew" <ak****@web4000.com> wrote in message
news:42**************************@posting.google.c om...
我刚算过,我的网页顶部是169行HTML和
DHTML。

我的问题是关于打印大块HTML在ASP中清楚/有效(不使用Response.Write(")169次),而不是根据x或y打印不同的东西。
I just counted, and the top of my web page is 169 lines of HTML and
DHTML.

My question was really about printing out large blocks of HTML in ASP
clearly/efficiently (without using Response.Write("") 169 times), not
about printing different things depending on x or y.




安德鲁,你写道:

"我可以写一个函数,这样这些变量可以插值,除了我

不要70 Response.Write(" foo")的行。"


您假设您需要70行Response.Write(foo)是

错了。您只需关闭ASP并打印常规HTML,仅使用ASP

作为动态部分。例如,这可能会包含在您的包含文件中:


<%

函数printHeader(标题)

%>

< head>

< title><%= title%>< / title>

< script type = "文本/ JavaScript的" src =" foo.js">< / script>

< / head>

<%

结束功能

%>


然后,您只需在

页面中使用您选择的标题调用printHeader。不需要一堆Response.Write语句。

希望这会有所帮助。

Peter Foti



Andrew, you wrote:
"I could write a function so that these vars can be interpolated, except I
don''t want 70 lines of Response.Write("foo")."

Your assumption that you WOULD need 70 lines of Response.Write("foo") is
wrong. You simply close your ASP and print out regular HTML, using ASP only
for the dynamic pieces. For example, this might go in your include file:

<%
Function printHeader(title)
%>
<head>
<title><%=title%></title>
<script type="text/javascript" src="foo.js"></script>
</head>
<%
End Function
%>

Then you simply call printHeader with the title of your choice from the
page. There is no need for bunch of Response.Write statements.
Hope this helps.
Peter Foti


这篇关于在ASP中打印大块HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆