By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Using Same Template In All ASP Pages

P: n/a
Please have a look at the image at the URL given below:

http://rn5a.brinkster.net/Template.gif

I would like to use that image as a template for all the ASP pages in
a website. Note that though it looks like a frames page, it's actually
not a frames page. Using different images has made it look like a
frames page.

The "Your Site Name" header, the 5 links "Home", "About", "Forums",
"Downloads" & "Support" links & the different links on the left hand
side will be available in all the pages. In other words, the actual
contents of the different pages would be displayed where there's "TEXT
COMES HERE".

I am not very sure on how to go about it. Can someone please give some
idea?

What I was thinking of doing is encapsulating the entire template in
an INCLUDE file, say, Template.inc & then adding the following code in
Template.inc (note that the template not only uses images but also
HTML tables)

<%
Sub SetTemplate(strTitle,strBody)
'here comes the upper part of the template
'wherever the <titletags come, I will use the variable
strTitle
%>
<title><%= strTitle %></title>
<%
'here comes the left hand side of the template

'finally here comes the contents of the files that will use
this template

strBody
%>

For e.g. when the "Forums" link is clicked, users are first told to
login using their username & password. Assume that the page where
users login is named Login.asp. This will be the code in Login.asp:

<!-- #include file="Template.inc" -->

<%
Dim sBody

sBody="<form method=post action='CheckLogin.asp' onSubmit='return
check()'>" & vbCrLf
sBody=sBody & "<input type=text name='username'><br>" & vbCrLf
sBody=sBody & "<input type=password name='password'><br><br>" &
vbCrLf
sBody=sBody & "<input type=submit value='LOGIN'>" & vbCrLf
sBody=sBody & "</form>"

SetTemplate("Please Login",sBody)
%>

Is this the correct approach or can someone suggest me a better
workaround?

Thanks,

RON

May 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I would recommend to cut your image into 4( at least parts) . Use Adobe for
example
Each part you can load as background for every page
for 4 parts it can be top part, left part and main part.
create
- top.asp
- left.asp
- main.asp
- footer.asp

make part of your image as background of whole page.
you default page will looks like
include top.asp
include left.asp
include main.asp
include footer.asp

any other page will include
include top.asp
include left.asp
' -----------------
page content
' -----------------
include footer.asp



<rn**@rediffmail.comwrote in message
news:11**********************@r19g2000prf.googlegr oups.com...
Please have a look at the image at the URL given below:

http://rn5a.brinkster.net/Template.gif

I would like to use that image as a template for all the ASP pages in
a website. Note that though it looks like a frames page, it's actually
not a frames page. Using different images has made it look like a
frames page.

The "Your Site Name" header, the 5 links "Home", "About", "Forums",
"Downloads" & "Support" links & the different links on the left hand
side will be available in all the pages. In other words, the actual
contents of the different pages would be displayed where there's "TEXT
COMES HERE".

I am not very sure on how to go about it. Can someone please give some
idea?

What I was thinking of doing is encapsulating the entire template in
an INCLUDE file, say, Template.inc & then adding the following code in
Template.inc (note that the template not only uses images but also
HTML tables)

<%
Sub SetTemplate(strTitle,strBody)
'here comes the upper part of the template
'wherever the <titletags come, I will use the variable
strTitle
%>
<title><%= strTitle %></title>
<%
'here comes the left hand side of the template

'finally here comes the contents of the files that will use
this template

strBody
%>

For e.g. when the "Forums" link is clicked, users are first told to
login using their username & password. Assume that the page where
users login is named Login.asp. This will be the code in Login.asp:

<!-- #include file="Template.inc" -->

<%
Dim sBody

sBody="<form method=post action='CheckLogin.asp' onSubmit='return
check()'>" & vbCrLf
sBody=sBody & "<input type=text name='username'><br>" & vbCrLf
sBody=sBody & "<input type=password name='password'><br><br>" &
vbCrLf
sBody=sBody & "<input type=submit value='LOGIN'>" & vbCrLf
sBody=sBody & "</form>"

SetTemplate("Please Login",sBody)
%>

Is this the correct approach or can someone suggest me a better
workaround?

Thanks,

RON

May 24 '07 #2

P: n/a
Gazing into my crystal ball I observed rn**@rediffmail.com writing in
news:11**********************@r19g2000prf.googlegr oups.com:
Please have a look at the image at the URL given below:

http://rn5a.brinkster.net/Template.gif

I would like to use that image as a template for all the ASP pages in
a website. Note that though it looks like a frames page, it's actually
not a frames page. Using different images has made it look like a
frames page.

The "Your Site Name" header, the 5 links "Home", "About", "Forums",
"Downloads" & "Support" links & the different links on the left hand
side will be available in all the pages. In other words, the actual
contents of the different pages would be displayed where there's "TEXT
COMES HERE".

I am not very sure on how to go about it. Can someone please give some
idea?

What I was thinking of doing is encapsulating the entire template in
an INCLUDE file, say, Template.inc & then adding the following code in
Template.inc (note that the template not only uses images but also
HTML tables)
Please don't use HTML tables for anything but tabular data. Tables are
not for positioning elements. Please use CSS and don't use
presentational markup.

<% option explicit
thispage = "" 'the page title goes in title and h1 element
thisurl = "" 'the actual url, needed for navigation
%>
<!--#include file="linkrel.asp"-->
<%
'linkrel includes DTD, HTML and Head elements, including the link to the
'stylesheet and favicon. I usually include a file called
'masterfunctions.asp and conn_inc.asp in this file as well.
'The usage of thispage above is like so:
'<title><%=thispage%></title>
%>
</head>
<body>
<!--#include file="header_inc.asp"-->
<!--#include file="nav_inc.asp"-->
<!--#include file="leftlinks_inc.asp"-->
<div id="content">
</div>
<!--#include file="footer_inc.asp"-->
</body>
</html>

-- Nav_inc.asp --
pagearr = array("Home", "About", "Forums", "Downloads", "Support")
hrefarr = array("index.asp", "about.asp", "forum.asp", "downloads.asp",
"support.asp")

%>
<ul>
<li class="skipnav"><a href="#content">Skip Navigation</a></li>
<% for i = 0 to ubound(pagearr)
%>
<li><%=navlist(hrefarr(i),pagearr(i))%></li>
<%
next%>
</ul>

<%
'this function usually goes into the masterfunctions.asp page
function navlist(link,document)
if trim(thisurl) = trim(link) then
navlist = "<a class=" & chr(034) & "thispage" & chr(034) & "
href=" & chr(034)
navlist = navlist & chr(034) & ">" & document & "</a>"
else
navlist = "<a href=" & chr(034)
navlist = navlist & chr(034) & ">" & document & "</a>"
end if
end function
%>

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

May 25 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.