Print Page | Close Window

IF statement for different header?

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=12192
Printed Date: 30 March 2026 at 11:01pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: IF statement for different header?
Posted By: Lucent
Subject: IF statement for different header?
Date Posted: 15 October 2004 at 2:06pm

How do I write the coding for different header?

where if idcategory=1 then it will load <!--#include file="header1.asp"-->

where if idcategory=2 then it will load <!--#include file="header2.asp"-->




Replies:
Posted By: theSCIENTIST
Date Posted: 15 October 2004 at 2:30pm
Category? That will be in default.asp

-------------
:: http://www.mylittlehost.com/ - www.mylittlehost.com


Posted By: xeerex
Date Posted: 15 October 2004 at 3:31pm
Here we go with dynamic includes again...

Here's a [ http://forums.webwiz.net/search.asp?KW=dynamic+include&SM=1&SI=PT&FM=9&OB=1 - search ] to help you out.

In short, the includes are processed prior to other script so in theory it is impossible to make them dynamic. However, there are ways "around" it.


-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: Lucent
Date Posted: 15 October 2004 at 4:34pm

Sorry, may be I'm confusing everyone here.
Actually, I'm not talking about editing this forum.
So, the file is actually not in the "includes" folder.

I was just wonder how would I write the coding. Something like these? (this page is not in the includes folder)

If idCategory="1" then
   <!--#include file="header1.asp"-->
end if

If idCatgory="2" then
   <!--#include file="header2.asp"--> 
end if

 



Posted By: theSCIENTIST
Date Posted: 15 October 2004 at 5:10pm
You are not trying to edit the forums, but then you say you want to do that? Now I'm confused, so do you want or do you not want to edit the forums and make your (If Cat...) change?

Any way, if you want to make the change, the file you want to edit is default.asp in your root.

Your approach will not work, search these forums for dynamic includes and read a bit about it to find out why.

-------------
:: http://www.mylittlehost.com/ - www.mylittlehost.com


Posted By: Lucent
Date Posted: 15 October 2004 at 5:45pm

The files I'm trying to modify is actually from another asp software.
Sorry for the confusing.

May be I don't exactly know what I'm talking about.. but this is want I want to achieve.  See how every category has different header? that is what I want.
http://www.cb2.com/spill.aspx?c=540 - http://www.cb2.com/



Posted By: ljamal
Date Posted: 15 October 2004 at 6:10pm
<%
if CatID = 1 then
%>
<!--#include file="filename"-->
<%
elseif CatID = 1 then
%>
<!--#include file="filename"-->
<%
end if
%>

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: Lucent
Date Posted: 15 October 2004 at 6:45pm
nop.. didn't work..


Posted By: xeerex
Date Posted: 15 October 2004 at 9:12pm
For i = 1 to 1000000

Originally posted by xeerex from above xeerex from above wrote:

"In short, the includes are processed prior to other script so in theory it is impossible to make them dynamic. However, there are ways "around" it."

Here's a [ search.asp?KW=dynamic+include&SM=1&SI=PT&FM=9&OB=1 - search ] to help you out.

In short, the includes are processed prior to other script so in theory it is impossible to make them dynamic. However, there are ways "around" it.


Next i


-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: theSCIENTIST
Date Posted: 16 October 2004 at 5:31am
Right, so it's on another application you are working on?

As it was said before you can't just:

If someCondition Then
   SSInclude this
ElseIf otherCondition Then
   SSInclude that
End If

Well you can, if the 2 includes don't conflict with each other, but it's bad doing so anyway, I find the best way to do this, if they are small includes, is to use XML. In the XML file you'll have your code, then you need to read each line of XML into an ASP array, then discharge the array with (Response.Write aspArr(i)) inside your If conditions accordingly.

Nice one xeerex, loop through it 1 mil times, maybe he will do it.

-------------
:: http://www.mylittlehost.com/ - www.mylittlehost.com


Posted By: Lucent
Date Posted: 26 October 2004 at 1:00pm

I read a lot of article.. most of them said it is not possilble to do dynamic includes, but I can try to do server.execute, then I went on and read more about it.. I even found some example from http://asp-hosting.ca/faq/How-to-use-Server.Execute-method-in-ASP.htm - http://asp-hosting.ca/faq/How-to-use-Server.Execute-method-i n-ASP.htm  & http://support.microsoft.com/kb/q224363/ - http://support.microsoft.com/kb/q224363/ .. and And, when ever I try to excute the page it always says
HTTP/1.1 404 Object Not Found

I have windows 2000 server with SII 5.0. Can anyone tell me what can possilible go wrong?



Posted By: dpyers
Date Posted: 27 October 2004 at 4:02pm
  1. Looks like your include is putting full html head and foot tags in the pafe. If do a view source. You can only have 1 set of head, body tags. If you're going to include content on the execute.asp from the other asp pages based up0on an if statement, just include the content portions of a page, the head and foot tags are already taken care of by execute.asp.
  2. Your form action is on another site. It has to be on your site. Use the form to get the relevant drop-down info, and the form handler specified by the form action should then craft the url and use Server.XMLHTTP to do a get/post to the other site.


-------------

Lead me not into temptation... I know the short cut, follow me.



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