Solved

Dynamic Include Navigation with ASP

Posted on 2006-06-29
8
776 Views
Last Modified: 2013-11-18
I see that NAVECHA has answered a query on this one but I got a little lost.

I have a simple navigation include file - ET2Nav.asp
Quote
<A href="et2Ware.asp">Warehousing & Storage </A>:
 <A href="et2vip.asp">VIP customers : </A>
 <A href="et2trans.asp">Transport Broking:</A>
  <A href="et2contact.asp">contact us</A>
Unquote
and what I am trying to do is ensure that when the Warehousing & Storage page - et2Ware.asp - opens up, the link to Warehousing and Storage does not show onthe nav bar.
Is that possible, or can it be highlighted?

kind regards

Misafi
0
Comment
Question by:Misafi
  • 4
  • 2
  • 2
8 Comments
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 17011608
Here is one method you mayb have to modify it but this should get you started.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
      
<%

Function adjMenu(strLink)

If strLink = request.servervariables("url") Then
      response.write("style='visibility: hidden;'")
End If

End Function


%>
      
</head>

<body >

<A href="et2Ware.asp" <%adjMenu("/et2Ware.asp")%>>Warehousing & Storage </A>:
 <A href="et2vip.asp" <%adjMenu("/et2vip.asp")%>>VIP customers : </A>
 <A href="et2trans.asp" <%adjMenu("/et2trans.asp")%>>Transport Broking:</A>
  <A href="et2contact.asp" <%adjMenu("/et2contact.asp")%>>contact us</A>


</body>
</html>
0
 

Author Comment

by:Misafi
ID: 17012321
Thanks dukestaTAI
The links work but they still all show up - so ther is no difference from the original script.

rgds

Misafi
0
 
LVL 4

Expert Comment

by:dukestaTAI
ID: 17012356
Run this page and tell me what it says for URL: on the page.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
     
<%

Function adjMenu(strLink)

If strLink = request.servervariables("url") Then
     response.write("style='visibility: hidden;'")
End If

End Function


%>
     
</head>

<body >

<h1>URL:</h1><%=request.servervariables("url")%>

<A href="et2Ware.asp" <%adjMenu("/et2Ware.asp")%>>Warehousing & Storage </A>:
 <A href="et2vip.asp" <%adjMenu("/et2vip.asp")%>>VIP customers : </A>
 <A href="et2trans.asp" <%adjMenu("/et2trans.asp")%>>Transport Broking:</A>
  <A href="et2contact.asp" <%adjMenu("/et2contact.asp")%>>contact us</A>


</body>
</html>
0
 

Author Comment

by:Misafi
ID: 17012442
This is what it came up with - Ensign is the project name
URL:
/Ensign/url.asp Warehousing & Storage : VIP customers : Transport Broking: contact us

rgds
Misafi
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:Misafi
ID: 17035019
What happens now? I am not sure whether this question has been abandoned on not.
0
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 250 total points
ID: 17047356
>What I am trying to do is ensure that when the Warehousing & Storage page - et2Ware.asp - opens up, the link to Warehousing and Storage does not show onthe nav bar.

Since you are working with ASP, I would suggest an ASP solution.

In the menu include file, you may determine which page is loaded using the server variable, "SCRIPT_NAME" You can then test for the current page and not write it's menu link (or highlight it, etc.)

See my live example at http://www.rodsdot.com/ee/aspConditionalMenuLinks1.asp

ASP code for an example menu include file.

<%
' a variable to hold the currently loaded ASP page name.
Dim pageName

' get the page name from the server
pageName = Request.ServerVariables("SCRIPT_NAME")

' remove any preceding path
pageName = Mid(pageName, InStrRev(pageName,"/")+1)

' write a link only if it is NOT to this page.
if pageName <> "aspConditionalMenuLinks1.asp" then
      response.write "<a title=""ASP Conditional Menu Links Example Page 1"" href=""aspConditionalMenuLinks1.asp"">ASP Conditional Menu Links 1</a>&nbsp;|&nbsp;"
end if
if pageName <> "aspConditionalMenuLinks2.asp" then      
      response.write "<a title=""ASP Conditional Menu Links Example Page 2"" href=""aspConditionalMenuLinks2.asp"">ASP Conditional Menu Links 2</a>&nbsp;|&nbsp;"
end if
if pageName <> "aspConditionalMenuLinks3.asp" then      
      response.write "<a title=""ASP Conditional Menu Links Example Page 3"" href=""aspConditionalMenuLinks3.asp"">ASP Conditional Menu Links 3</a>"
end if
%>

You can improve on my code, but this should show you what is possible.

Regards,
Rod
0
 

Author Comment

by:Misafi
ID: 17048411
Perfect ! - thank you very much

Regards

Misafi
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 17050884
Glad to help. Good luck!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now