HighDots Forums  

Can DW do this ASP?

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Can DW do this ASP? in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dlcmpls
 
Posts: n/a

Default Can DW do this ASP? - 07-06-2004 , 03:08 PM






Hi All

I'm attempting to use a bit of ASP to help with a css driven navigation menu.
I have the navigation menu built, but I'd like to use conditional asp to
designate where a visitor is in the site.

So, sasy my site has the following categories:

About Us
Products
Services

Each category has a directory on the server to hold the appropriate web pages:

about
products
services

So my nav menu contains 4 items across the top of each page:

Home Products Services About Us

The nav menu is text and is controlled via css for rollovers etc.

What I'd like the asp to do is something like this:

<% If
the server path
CONTAINS
"products"
MAKE
the products nav menu item bold
IF NOT
MAKE
the products nav menu item not bold
%>

So when a visitor visits a page within the Products directory, the products
nav menu item would be bold.

Ditto for About Us or Services.

I know I can use the ServerVariable PATH_INFO to get a files location on the
server. What I don't know how to do is to create the conditional code. I
think I need to have asp read the PATH INFO, determine if the word "products"
is in the string and then do the appropriate display.

Can DW do this or do I need to hand code this?

Any advice is appreciated.

dlc


Reply With Quote
  #2  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: Can DW do this ASP? - 07-06-2004 , 03:17 PM






Quote:
Can DW do this or do I need to hand code this?
Yes.

It's pretty simple to do. Each link in the menu could be something like <a
href="blah.asp?2" where the '2' is used to specify the button number. Your
code in the menu could then parse this number and do an if test to determine
which source to use.

But there is an even simpler way using CSS.

Make your buttons like this -

<a href="blah.asp" class="button2">
<a href="blahblah.asp" class="button3">

and have an embedded stylesheet in the head of each document like this -

<style type="text/css">
<!--
buttonx { your style for the selected button; }
-->
</style>

Then on any given page, just change buttonx to the button number desired,
and you're done.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"dlcmpls" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi All

I'm attempting to use a bit of ASP to help with a css driven navigation
menu.
I have the navigation menu built, but I'd like to use conditional asp to
designate where a visitor is in the site.

So, sasy my site has the following categories:

About Us
Products
Services

Each category has a directory on the server to hold the appropriate web
pages:

about
products
services

So my nav menu contains 4 items across the top of each page:

Home Products Services About Us

The nav menu is text and is controlled via css for rollovers etc.

What I'd like the asp to do is something like this:

% If
the server path
CONTAINS
"products"
MAKE
the products nav menu item bold
IF NOT
MAKE
the products nav menu item not bold
%

So when a visitor visits a page within the Products directory, the
products
nav menu item would be bold.

Ditto for About Us or Services.

I know I can use the ServerVariable PATH_INFO to get a files location on
the
server. What I don't know how to do is to create the conditional code. I
think I need to have asp read the PATH INFO, determine if the word
"products"
is in the string and then do the appropriate display.

Can DW do this or do I need to hand code this?

Any advice is appreciated.

dlc




Reply With Quote
  #3  
Old   
darrel
 
Posts: n/a

Default Re: Can DW do this ASP? - 07-06-2004 , 03:38 PM



Quote:
It's pretty simple to do. Each link in the menu could be something like
a
href="blah.asp?2" where the '2' is used to specify the button number.
Your
code in the menu could then parse this number and do an if test to
determine
which source to use.
There's really no need to muddy up the URL with query strings in this case.

You can read the URL via ASP and see if it contains a phrase within it:

Get the URL and assign it to a string:

strURL = Request.FilePath

Then, use the instr function to see if it contains a word/phrase:

InStr(StringBeingSearched, StringSearchingFor)

So, if you are looking for the about page:

if InStr(strURL, "about") > 0 then
set the about link's class to "on"

-Darrel




Reply With Quote
  #4  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: Can DW do this ASP? - 07-06-2004 , 03:50 PM



I still think the CSS is the right way to do it! 8)

Although this is not bad....

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"darrel" <notreal (AT) hotmail (DOT) com> wrote

Quote:
It's pretty simple to do. Each link in the menu could be something like
a
href="blah.asp?2" where the '2' is used to specify the button number.
Your
code in the menu could then parse this number and do an if test to
determine
which source to use.

There's really no need to muddy up the URL with query strings in this
case.

You can read the URL via ASP and see if it contains a phrase within it:

Get the URL and assign it to a string:

strURL = Request.FilePath

Then, use the instr function to see if it contains a word/phrase:

InStr(StringBeingSearched, StringSearchingFor)

So, if you are looking for the about page:

if InStr(strURL, "about") > 0 then
set the about link's class to "on"

-Darrel





Reply With Quote
  #5  
Old   
darrel
 
Posts: n/a

Default Re: Can DW do this ASP? - 07-06-2004 , 04:01 PM



Quote:
I still think the CSS is the right way to do it! 8)
You need both. The CSS styles it, the ASP decides which one to specifically
style at any given time.

Your method works too, but you'd have to write a separate style on each page
of the site. It probably makes the most sense to put the ASP in an include
file containing the navigation and then linking to a main CSS file. Keeping
both items as standalone objects that can be used site-wide.

-Darrel




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.