Solved

Dynamic Include Navigation with ASP

Posted on 2006-06-29
8
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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
 

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

737 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