Subaru Discussion Forums

Go Back   ScoobyNet > Off Topic > Computer Related

Computer Related Are you going to build your own computer, or want advice on laptops, notebooks, monitors, processors, motherboard, software, computer games, etc. Discuss all things computer, or seek help from our resident geeks!

Welcome to ScoobyNet.com!
Subaru forum
Welcome to the ScoobyNet.com Subaru forum.

You are currently viewing our forum as a guest, which gives you limited access to view most discussions and access our other features. By joining our community, at no cost, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is free, fast and simple, so please join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Reply
 
Thread Tools
Old 02 July 2009, 10:57   #1 (permalink)
Scooby Regular
 
Trader Score: (0)
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,629
Question Silly ASP question

I'm a PHP developer so having to do ASP is not something I'm required to do often but in this instance we are bodging something...

I have a header file and in it is the nav, if the current page is aaa then aaa is highlighted in the nav so I do something if (thispage=="aaa") write class="this" on the href for example.

This all works fine but what I want to do is not have to edit all the other files to declare thispage. On the pages that I am changing, I am setting thispage="ho" for home or thispage="ab" for about etc.

Problem is that when I go to a page that I dont want a nav item highlighting, I get an error because I have not declared thispage. So how do I do this? I tried this in the header:

If not isdeclared("thispage") then
Dim thispage=""
End If

but that doesn't work... I get compilation errors.

Any help gratefully received!

Rich
RichB is offline   Reply With Quote
Old 02 July 2009, 14:58   #2 (permalink)
Scooby Regular
 
Trader Score: (0)
Join Date: Nov 1998
Posts: 9,717
Send a message via MSN to boxst Send a message via Yahoo to boxst
Default

Looks okay to me (apart from the case).

What error do you get?

Steve
boxst is offline   Reply With Quote
Old 03 July 2009, 16:15   #3 (permalink)
Forester Owner
1997 Subaru Forester
 
mykp's Avatar
 
Trader Score: (0)
Join Date: Jan 2006
Location: 5 inches closer to the ground
Posts: 1,463
Send a message via ICQ to mykp Send a message via Skype™ to mykp
This is my Scooby.  To set up your own Scooby, go to your user cp, and click 'Edit Settings'.
Default

surely this would be better

if isdeclared("thispage")<>"" then
Dim thispage=""
End If

what error are you getting?
mykp is offline   Reply With Quote
Old 03 July 2009, 18:10   #4 (permalink)
Scooby Regular
 
Trader Score: (0)
Join Date: Mar 2004
Posts: 743
Default

It'll be helpful to know what error you are getting, but you want to declare your variable out of the 'if' statement.

Is thisPage a variable ? If so, you don't need to have the double quotes, also where is the variable thisPage being set ?

Dim thisPage

If isDeclared("thisPage") <> "" then thisPage = ""

Has your 'isDeclared' function got an error catcher ?

NB: VBscript is not case sensitive but javascript is.

Last edited by AllenJ; 03 July 2009 at 18:11.
AllenJ is offline   Reply With Quote
Reply


Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT +1. The time now is 05:52.


Important - Opinions expressed are not necessarily the opinions of ScoobyNet or any individuals directly or indirectly involved in this website or the companies and individuals associated with it. No responsibility is taken or assumed for any comments or statements made on this or any associated or relating bulletin board. Your personal information will be kept private except to comply with applicable laws or valid legal reasons.

LinkBacks Enabled by vBSEO 3.2.0 © 2008, Crawlability, Inc.