Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Silly ASP question

Thread Tools
 
Search this Thread
 
Old 02 July 2009, 10:57 AM
  #1  
RichB
Scooby Regular
Thread Starter
 
RichB's Avatar
 
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes on 0 Posts
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
Old 02 July 2009, 02:58 PM
  #2  
boxst
Scooby Regular
 
boxst's Avatar
 
Join Date: Nov 1998
Posts: 11,905
Likes: 0
Received 0 Likes on 0 Posts
Default

Looks okay to me (apart from the case).

What error do you get?

Steve
Old 03 July 2009, 04:15 PM
  #3  
mykp
Scooby Regular
 
mykp's Avatar
 
Join Date: Jan 2006
Location: On the Cat and Fiddle
Posts: 1,483
Likes: 0
Received 0 Likes on 0 Posts
Default

surely this would be better

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

what error are you getting?
Old 03 July 2009, 06:10 PM
  #4  
AllenJ
Scooby Regular
 
AllenJ's Avatar
 
Join Date: Mar 2004
Posts: 752
Likes: 0
Received 0 Likes on 0 Posts
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 06:11 PM.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Darrell@Scoobyworx
Trader Announcements
26
30 January 2024 01:27 PM
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
slimwiltaz
General Technical
20
09 October 2015 07:40 PM
IanG1983
Wheels, Tyres & Brakes
2
06 October 2015 03:08 PM
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM



Quick Reply: Silly ASP question



All times are GMT +1. The time now is 06:13 AM.