Silly ASP question
#1
Scooby Regular
Thread Starter
Join Date: Apr 1999
Location: Bore Knee Muff
Posts: 3,666
Likes: 0
Received 0 Likes
on
0 Posts
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
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
#4
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.
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.
Thread
Thread Starter
Forum
Replies
Last Post
Brzoza
Engine Management and ECU Remapping
1
02 October 2015 05:26 PM