Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 keeping navigation current with ASP
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

mykel_suthertun
Junior Member

USA
227 Posts

Posted - 31 January 2005 :  23:24:40  Show Profile  Visit mykel_suthertun's Homepage
An article over at A List Apart explains how to automatically manage your links with PHP so that the current page link can be styled differently. I would love to do this, but I can only run ASP on my server. Is it possible to do this with ASP?

Mike Southerton
Webmaster | Don'tSayDie.com | DriveThe.com

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 01 February 2005 :  02:29:38  Show Profile
I do this with ASP. You mean if a user is viewing a page then the Menu item is highlighted for that page, yer? If it is, It is simple to do in ASP and can send you some stuff to do it with if you like.

Mind you I wish I had of known about that page when I had to do a PHP site and they wanted the same thing, but I had to write it from scratch.


Cheers,

David Greening
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 01 February 2005 :  02:33:22  Show Profile
I forgot to add the sites I have done it with:

www.pivotdancestudio.com.au (ASP text)
www.waratahbaycp.com.au (ASP text & graphics)
www.royalenfieldaustralia.com (PHP text)

Just to give you some samples.

Cheers,

David Greening

Edited by - Classicmotorcycling on 01 February 2005 02:36:29
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 01 February 2005 :  17:13:54  Show Profile
You can use the server variables.
Here's a simple menu.
<%
strScriptName = split(request.servervariables("script_name"),".")
strFileName = Replace(strScriptName(0),"/","")

Response.Write  "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN""" & vbNewLine & _
                """http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"" >" & vbNewLine & _
                "<html>" & vbNewLine & _

                "<head>" & vbNewLine & _
                "<style type=""text/css"">" & vbNewLine & _
		"<!--" & vbNewLine & _
                "ul.menu_a {width:60px; list-style-type:none;}" & vbNewLine & _
                "ul.menu_a a {display:block; text-align:center; text-decoration:none; color:#000000; background-color:#cccccc; border-left:1px solid #999999; font:weight:normal;}" & vbNewLine & _
                "li.menu_b a {margin-left:-2px; border-left:5px solid #000000; background-color:#eeeeee; font-weight:bold;}" & vbNewLine & _
		"-->" & vbNewLine & _
		"</style>" & vbNewLine & _
                "</head>" & vbNewLine & _

                "<body>" & vbNewLine & _
                " <ul class=""menu_a"">" & vbNewLine & _
                "   <li "
if strFileName = "top" then Response.Write  "class=""menu_b"""
Response.Write  "><a href=""top.asp"">Top</a></li>" & vbNewLine & _
                "   <li "
if strFileName = "left" then Response.Write  "class=""menu_b"""
Response.Write  "><a href=""left.asp"">Left</a></li>" & vbNewLine & _ 
                "   <li "
if strFileName = "right" then Response.Write  "class=""menu_b"""
Response.Write  "><a href=""right.asp"">Right</a></li>" & vbNewLine & _
                "   <li "
if strFileName = "bottom" then Response.Write  "class=""menu_b"""
Response.Write  "><a href=""bottom.asp"">Bottom</a></li>" & vbNewLine & _
                "  </ul>" & vbNewLine & _
                "</body>" & vbNewLine & _

                "</html>"
              
%>


Here's the html output
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html>
<head>
<style type="text/css">
<!--
ul.menu_a {width:60px; list-style-type:none;}
ul.menu_a a {display:block; text-align:center; text-decoration:none; color:#000000; background-color:#cccccc; border-left:1px solid #999999; font:weight:normal;}
li.menu_b a {margin-left:-2px; border-left:5px solid #000000; background-color:#eeeeee; font-weight:bold;}
-->
</style>
</head>
<body>
 <ul class="menu_a">
   <li ><a href="top.asp">Top</a></li>
   <li ><a href="left.asp">Left</a></li>
   <li class="menu_b"><a href="right.asp">Right</a></li>

   <li ><a href="bottom.asp">Bottom</a></li>
  </ul>
</body>
</html>

    _-/Cripto9t\-_
Go to Top of Page

mykel_suthertun
Junior Member

USA
227 Posts

Posted - 02 February 2005 :  19:38:42  Show Profile  Visit mykel_suthertun's Homepage
Thank you both for your help!! That's definately going to save me a lot of hours...

I did a quick test of cripto's script on my server and it works perfect. I'll post back with results or if I run into any problems, but I think I can handle it. Thanks again!

Mike Southerton
Webmaster | Don'tSayDie.com | DriveThe.com
Go to Top of Page

sr_erick
Senior Member

USA
1318 Posts

Posted - 02 February 2005 :  20:12:35  Show Profile  Visit sr_erick's Homepage  Send sr_erick a Yahoo! Message
I used a combination of some asp arrays with CSS and a simple variable for the page name and the page sub-name if it was a page under a certain area. Go to my forum, www.snowmobilefanatics.com to see what I mean. Click on the forum, then a link from there.




Erick
Snowmobile Fanatics

Go to Top of Page

mykel_suthertun
Junior Member

USA
227 Posts

Posted - 02 February 2005 :  21:44:27  Show Profile  Visit mykel_suthertun's Homepage
Problem...
I removed all tags before and after the <ul> so that I could add the menu to any page via SSI. This works fine for all pages at the root directory of my server. However, if I have a page in rootdirectory/somefolder/ and I want to include the menu, it doesn't work. It includes the entire <ul> fine, but it can't determine what page it's viewing (in other words, it assumes the page that was loaded isn't in my <ul> link list).
Is there any way around this? Thanks again,

Mike Southerton
Webmaster | Don'tSayDie.com | DriveThe.com
Go to Top of Page

mykel_suthertun
Junior Member

USA
227 Posts

Posted - 02 February 2005 :  21:48:10  Show Profile  Visit mykel_suthertun's Homepage
Oops, I posted that last one before I saw sr_erick's response.

That sounds like what I want to do, but I don't know ASP well enough to know what you're talking about without an example. Can you post anything?

Mike Southerton
Webmaster | Don'tSayDie.com | DriveThe.com
Go to Top of Page

sr_erick
Senior Member

USA
1318 Posts

Posted - 02 February 2005 :  22:52:54  Show Profile  Visit sr_erick's Homepage  Send sr_erick a Yahoo! Message
The code on a particular page for its title looks like so...

CurrentMenuSection = "Media Gallery"
CurrentSubMenuSection = "View By Member"



'##### General Menu
dim GeneralMenuArray(7,1)
GeneralMenuArray(0,0) = "Home"
GeneralMenuArray(1,0) = "Media Gallery"
GeneralMenuArray(2,0) = "Forum"
GeneralMenuArray(3,0) = "Links Directory"
GeneralMenuArray(4,0) = "Articles"
GeneralMenuArray(5,0) = "FAQ"
GeneralMenuArray(6,0) = "Sled Showcase"
GeneralMenuArray(7,0) = "Site Policy"
GeneralMenuArray(0,1) = "http://www.snowmobilefanatics.com/"
GeneralMenuArray(1,1) = "http://www.snowmobilefanatics.com/gallery/"
GeneralMenuArray(2,1) = "http://www.snowmobilefanatics.com/forum"
GeneralMenuArray(3,1) = "http://www.snowmobilefanatics.com/links/"
GeneralMenuArray(4,1) = "http://www.snowmobilefanatics.com/articles/"
GeneralMenuArray(5,1) = "http://www.snowmobilefanatics.com/faq.asp"
GeneralMenuArray(6,1) = "http://www.snowmobilefanatics.com/webpages"
GeneralMenuArray(7,1) = "http://www.snowmobilefanatics.com/policy.asp"

dim GeneralMenuArrayForum(5,1)
GeneralMenuArrayForum(0,0) = "Active Topics"
GeneralMenuArrayForum(1,0) = "Recent Topics"
GeneralMenuArrayForum(2,0) = "Members"
GeneralMenuArrayForum(3,0) = "Search"
GeneralMenuArrayForum(4,0) = "Statistics"
GeneralMenuArrayForum(5,0) = "Events"
GeneralMenuArrayForum(0,1) = "http://www.snowmobilefanatics.com/forum/active.asp"
GeneralMenuArrayForum(1,1) = "http://www.snowmobilefanatics.com/forum/inc_mod_recent.asp"
GeneralMenuArrayForum(2,1) = "http://www.snowmobilefanatics.com/forum/members.asp"
GeneralMenuArrayForum(3,1) = "http://www.snowmobilefanatics.com/forum/search.asp"
GeneralMenuArrayForum(4,1) = "http://www.snowmobilefanatics.com/forum/forum_stats.asp"
GeneralMenuArrayForum(5,1) = "http://www.snowmobilefanatics.com/forum/events.asp"


dim GeneralMenuArrayShowcase(1,1)
GeneralMenuArrayShowcase(0,0) = "Edit Your Pages"
GeneralMenuArrayShowcase(1,0) = "Browse Sites"
GeneralMenuArrayShowcase(0,1) = "http://www.snowmobilefanatics.com/webpages/website_listpages.asp"
GeneralMenuArrayShowcase(1,1) = "http://www.snowmobilefanatics.com/webpages/listsites.asp"

dim GeneralMenuArrayMediaGallery(1,1)
GeneralMenuArrayMediaGallery(0,0) = "Upload A File"
GeneralMenuArrayMediaGallery(1,0) = "View By Member"
GeneralMenuArrayMediaGallery(0,1) = "javascript:openWindow('upload.asp')"
GeneralMenuArrayMediaGallery(1,1) = "http://www.snowmobilefanatics.com/gallery/listusers.asp"


'##### Build the General Menu
For I=0 to Ubound(GeneralMenuArray)
 Response.write "								<li><a "
	if GeneralMenuArray(I,0) = CurrentMenuSection then
		Response.Write "class=""currentpage"" " 
	end if
	Response.Write "href=""" & GeneralMenuArray(I, 1) & """>" & GeneralMenuArray(I, 0) & "</a></li>" & vbNewLine
	'Print out submenu if there is one
	if CurrentMenuSection = "Forum" and GeneralMenuArray(I, 0) = "Forum" then
		For J=0 to Ubound(GeneralMenuArrayForum)
			Response.Write "								<li><a class=""sublist "
			if GeneralMenuArrayForum(J,0) = CurrentSubMenuSection then
				Response.Write "currentsubpage"
			end if
			Response.Write """ href=""" & GeneralMenuArrayForum(J,1) & """>"
			Response.Write "-" & GeneralMenuArrayForum(J,0)
			Response.Write "</a></li>" & vbNewLine
		Next
	elseif CurrentMenuSection = "Media Gallery" and GeneralMenuArray(I, 0) = "Media Gallery" then
		For J=0 to Ubound(GeneralMenuArrayMediaGallery)
			Response.Write "								<li><a class=""sublist "
			if GeneralMenuArrayMediaGallery(J,0) = CurrentSubMenuSection then
				Response.Write "currentsubpage"
			end if
			Response.Write """ href=""" & GeneralMenuArrayMediaGallery(J,1) & """>"
			Response.Write "-" & GeneralMenuArrayMediaGallery(J,0)
			Response.Write "</a></li>" & vbNewLine
		Next
	elseif CurrentMenuSection = "Sled Showcase" and GeneralMenuArray(I, 0) = "Sled Showcase" then
			For J=0 to Ubound(GeneralMenuArrayShowcase)
				Response.Write "								<li><a class=""sublist "
				if GeneralMenuArrayShowcase(J,0) = CurrentSubMenuSection then
					Response.Write "currentsubpage"
				end if
				Response.Write """ href=""" & GeneralMenuArrayShowcase(J,1) & """>"
				Response.Write "-" & GeneralMenuArrayShowcase(J,0)
				Response.Write "</a></li>" & vbNewLine
			Next
	end if
Next




Erick
Snowmobile Fanatics


Edited by - sr_erick on 02 February 2005 22:56:26
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07