Author |
Topic  |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 11:44:03
|
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? |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 22 January 2006 : 12:25:26
|
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 < |
|
 |
|
Classicmotorcycling
Development Team Leader
    
Australia
2085 Posts |
Posted - 22 January 2006 : 13:09:20
|
I just played with some code and got it to work the following way:<% 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 |
 |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 14:22:13
|
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? |
 |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 14:35:34
|
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? |
 |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 14:38:09
|
I'll try Response.Write and just add all of the text possibilites.
-prescottw< |
What day is it anyway? |
 |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 14:53:52
|
Nope... Once again I thank you both,
-prescottw< |
What day is it anyway? |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 22 January 2006 : 15:19:26
|
quote: Originally posted by Classicmotorcycling
I just played with some code and got it to work the following way:<% 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...
the problem with this method is that all INCLUDE files are still loaded up and then the conditional statement displays the segment you want. this incurs additional load times and conflicting variables at times. the method I would go about using the Server.Execute method is:
Select Case Request.ServerVariables("URL")
Case "/certainpage_1.asp"
strPage = meta_1.asp
Case "/certainpage_2.asp"
strPage = meta_2.asp
Case Else
'do nothing
End Select
Server.Execute(strPage)
quote: 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" -->< |
Edited by - dayve on 22 January 2006 15:20:58 |
 |
|
prescottw
Junior Member
 
189 Posts |
Posted - 22 January 2006 : 22:02:49
|
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? |
Edited by - prescottw on 22 January 2006 22:03:53 |
 |
|
|
Topic  |
|