Let me start off by saying I'm a PHP developer, not an ASP one. (And I really wish ASP had isset()
.) And I'm working in a live environment so I don't really have an opportunity to do any testing.
All the resources I've found suggest different ways to test for the existence of a variable.
Here's what I'm trying to do:
On SOME pages, I set a variable which holds a value for a robots <meta>
tag:
dim dsep_robots
dsep_robots = "nofollow,noindex"
All pages include header.asp
. In my header file, I want to test whether dsep_robots
has a value and if so, output that value, otherwise, output nothing.
I think that testing whether dsep_robots
has a value might look like this:
if not dsep_robots = "" then
'...
end if
Best practices in PHP state that when you're using a variable that may or may not exist, you should always test if (isset($var)) {...}
(not doing so will trigger a Notice if the variable doesn't exist).
Is there such a thing in ASP -- i.e. do I really need to test if it exists, or can I simply test if it has a value?