possible? <% if page="certainpage_1.asp" then %> - Posted (480 Views)
Junior Member
prescottw
Posts: 189
189
Does anyone have an idea what to do here? I have no idea what the attribute would be. Or if it is even defined as an attribute?
<% if page="certainpage_1.asp" then %>
<!-- #include file="meta1.asp" -->
<% end if %>

<% if page="certainpage_2.asp" then %>
<!-- #include file="meta_2.asp" -->
<% end if %>

and so on 3, 4, 5, 6, 7, 8, 9,

I'm looking to give inc_header a <meta name="keywords" content="more description, defined search results"> for certain added pages to my site.
Thank You,

-prescottw<
What day is it anyway?
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Forum Moderator
dayve
Posts: 5820
5820
You can not use conditional statements for INCLUDE files, also known as dynamic includes. What you can do and is a method I like is use Server.Execute. I have used it on a lot of the web sites I have developed that require dynamic pages to be called.
http://www.devguru.com/technologies/asp/9167.asp
<
Posted
Development Team Leader
Classicmotorcycling
Posts: 2085
2085
I just played with some code and got it to work the following way:
Code:
<% if Request.ServerVariables("URL") = "/certainpage_1.asp" then %>
<!--#INCLUDE FILE="meta_1.asp" -->
<% end if %>

<% if Request.ServerVariables("URL") = "/certainpage_2.asp" then %>
<!--#INCLUDE FILE="meta_2.asp" -->
<% end if %>
All you need to do is add the folders before the certianpage_(1 or 2).asp for it to work.
I hope this helps... <
Cheers,

David Greening
Posted
Junior Member
prescottw
Posts: 189
189
Thanks to You both.
I couldn't get either to call a different meta from my inc_header though. (It didn't call the file at all)....even though the file was not in the correct folder it did request the file. But after the file was positioned... the meta_1.asp did not open for inc_header. It asked for a statement.

I added the %> before and after <%

%>

<% if Request.ServerVariables("URL") = "certainpage_1.asp" then %>
<!--#INCLUDE FILE="metafiles/meta_1.asp" -->
<% end if %>

<% if Request.ServerVariables("URL") = "certainpage_2.asp" then %>
<!--#INCLUDE FILE="metafiles/meta_2.asp" -->
<% end if %>


<%



As I was able to learn from the replies. I may not have asked the question correctly.
I'm trying to let inc_header know that if it was called by certainpage1.asp then can it open metatag_1.asp

certainpage2.asp then inc_header will call metatag2.asp.

I want to replace

%>
<!--#INCLUDE FILE="metatag.asp" -->
<%

With options depending on which page is open.

I thank you both for this.
-prescottw<
What day is it anyway?
Posted
Junior Member
prescottw
Posts: 189
189
if Request.ServerVariables("URL") = "certainpage_1.asp" then
<!--#INCLUDE FILE="meta_1.asp" -->
end if

if Request.ServerVariables("URL") = "certainpage_2.asp" then
<!--#INCLUDE FILE="meta_2.asp" -->
end if

I tried this and didin't get an expected statement error. The meta_1.asp didn't call either.
Still trying

Thank You,

-prescottw<
What day is it anyway?
Posted
Junior Member
prescottw
Posts: 189
189
I'll try Response.Write and just add all of the text possibilites.
-prescottw<
What day is it anyway?
Posted
Junior Member
prescottw
Posts: 189
189
Nope... Once again I thank you both,

-prescottw<
What day is it anyway?
Posted
Forum Moderator
dayve
Posts: 5820
5820
You can not use conditional statements for INCLUDE files

what I meant to say with this statement is that you can not do something like this

<!--#INCLUDE FILE=strPage & ".asp" --><
Posted
Junior Member
prescottw
Posts: 189
189
I get an event that states this

The Path parameter must be specified for the MapPath method.
I'm sure that it is because I'm not understanding.

Select Case Request.ServerVariables("URL")
Case "does-anything-go-here/certainpage_1.asp"
strPage = metafiles/meta_1.asp
Case "does-anything-go-here/certainpage_2.asp"
strPage = metafiles/meta_2.asp
Case Else
'do nothing
End Select

Server.Execute(strPage)

I'm probably to deep into this but I appreciate the help.

THank You!
-prescottw<
What day is it anyway?
 
You Must enter a message