Print Page | Close Window

Using multiple headers in asp

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=24100
Printed Date: 29 March 2026 at 2:58pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Using multiple headers in asp
Posted By: zeddy
Subject: Using multiple headers in asp
Date Posted: 07 August 2007 at 5:16pm

Hello there,

I am not sure if anyone can help me. I have inherited a bespoke shopping cart website which sells lots of different products. There are many different header files which have already been built. The problem is that I can only change which header the home page includes.

The website has main and sub categories which contain the products but I can't see how to specify which header file is included on these pages.

I would be extremly grateful for your help.

Many thanks in advance Cry

Steve




Replies:
Posted By: Scotty32
Date Posted: 07 August 2007 at 8:25pm
could you explain WHY your using multiple headers?

I assume you mean you have made a few header files to be included eg "header1.asp", "header2.asp" and so on.

Couldnt you have one header file and use ASP to process the header the way you want it, eg

if you have categories for each product range maybe like "Electronics | Books | Gifts"
and each had a different colour scheme you could maybe have a different CSS file for each and have at the top of every page

intCategoryID = *id*


and the id would repersent the product categories like so:

1 - electronics
2 - books
3 - gifts

so you do

<link href="style_<%=intCategoryID%>.css" rel="stylesheet" type="text/css" />


and your colour scheme changes depending on the ID in the top of the page.

aswell as CSS you could have images eg
<img src="logo_<%=intCategoryID%>.gif">
and so on
if how ever the reason is alot more complex i would suggest using one include that selects the required include. eg:

<%
   select case intCategoryID
      case 1
%><!--#include file="header1.asp"--><%
      case 2
%><!--#include file="header2.asp"--><%
      case 3
%><!--#include file="header3.asp"--><%
      case else
%><!--#include file="header-else.asp"--><%
  end select
%>



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: zeddy
Date Posted: 08 August 2007 at 10:50am

Hello there thanks for your response.  The reason why I have different headers is because the website sells all different products.

The idea is that for each category the site should include a different header file with relevent keywords and description for that page.

Each of the categories already have an id for example http://www.leisurefurniture.co.uk/category.asp?catId=709 - www.leisurefurniture.co.uk/category.asp?catId=709  as I mentioned the problem is that no matter what category the user selects it always includes the same header file.
 
Looking at your solution is there a way I can specify a different header file for each category id?
 
Many thanks in advance
 
Steve 


Posted By: Scotty32
Date Posted: 08 August 2007 at 6:24pm
if all you want different headers for is to change the Meta tags, i would suggest you add fields to your category table in the database for what you want to change, then when you get the category details get the meta tags and in your header have

<meta name="description" content="<%=strMetaDescription%>">

it would be far better than a different header file


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net