473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using Same Template In All ASP Pages

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
2 2820
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JA | last post by:
Hi, I posted this somewhere else, but I don't think it was quite the right place, so I'll try here. I know a little about asp, but not much. This is on a FrontPage 2000 site. I have a...
2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
2
by: googley | last post by:
Hello... I have a site with about 50-100 pages. All the pages have the same layout. Just the text is different. My plan is to create "1" page and use it as a template for the rest...just filling...
3
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to...
4
by: Brian Barnes | last post by:
I am trying to create a template code behind file for a website which all pages should be inherited from. This base class however, when I try to view the aspx page in Visual studio .NET (2002), it...
3
by: MDS | last post by:
I have quite a few of web pages in my project which would have similar appearance (like header, some images, color, footer etc). How do i create one base template web page and have all other...
4
by: Per Bolmstedt | last post by:
(This question has been asked previously in this group, but I don't think it was ever really properly answered.) I want to use reflection - preferably - to find all Web Forms in my web site that...
0
by: Avi | last post by:
Hello, I am trying to generate a TOC using FOP. I have a XML file as follows: <?xml version="1.0" encoding="iso-8859-1"?> <FILE> <INTERFACE> <NAMEA_B </NAME> <MESSAGEMSG_1 </MESSAGE>...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.