I have 3 pages im working with here.
page1, page2, and page3.
page1 is the main page, it calls page2 as an include and page2 calls page3 as an include, here is some code...
i call page1 with a url like this...
http://localhost/page1.cfm?myURLVariable=99
page1..
blah blah
<cfinclude template="page2.cfm">
blah blah
page2..
blah blah
<cfinclude template="page3.cfm">
blah blah
page3
blah blah
<cfif isDefined("url.myURLVariable")>
do stuff here!!!!
</cfif>
the problem is that the isDefined does not evaluate to true anymore, even though the variable does exist, and if i use the following code it will output the correct info (very strange, see below)
page3
blah blah
<cfif isDefined("url.myURLVariable")>
do stuff here!!!!
</cfif>
--the above does not display--
<cfif NOT isDefined("url.myURLVariable")>
<cfoutput>
#url.myURLVariable#
</cfoutput>
</cfif>
-- the above code will output the actual value of url.myurlvariable--
has anyone else seen this problem with version 6.1 yet? does anyone know if there is a fix? I can think of a bunch of ways i can get around this with cfparams or whatever, its just the principle of the thing that bothers me.
thanks everyone
-tony
If your code is exactly this:
<cfif NOT isDefined("url.myURLVariable")>
<cfoutput>
#url.myURLVariable#
</cfoutput>
</cfif>
And it displays the value then...
... re-install CFMX. YOur install is poked. We - on CFMX / CFMX61 -
have *hundreds* of isDefined() calls within included files all working
fine, never having had a problem with them, nor have I heard anyone
else having such problems.
My true suspicion is that something else is afoot, and you're just not
noticing something, but if you actually *are* experiencing this
situation, do the re-install.
Adam
but change your page2 code to this...
<cfquery dataSource="myDB" name="query1">
select url, content_id
from content
</cfquery>
<cfoutput query="query1">
page2..<br>
blah blah<br>
------------<br>
<cfinclude template="page3.cfm">
</cfoutput>
then change your page3 code to this...
<cfoutput>
page3<br>
blah blah<br>
<cfif isDefined("url.content_id")>
this isdefined!!<br>
content_id from url = #url.content_id#<br>
</cfif>
<cfif NOT isDefined("url.content_id")>
this says its <strong>NOT</strong> defined!!<br>
<cfoutput>
content_id from url = #url.content_id#<br>
</cfoutput>
</cfif>
</cfoutput>
then call page1 with a url paramater like this...
http://localhost/page1.cfm?content_id=3022
i know now that it has something to do with the "URL" Column being called in the query, and possibly something to do with the new dot notation featues in MX, but this code works fine on 6.0
thanks y'all
-tony
Heh.
It's because I'm posting via the NNTP feed, and I guess there's some
descrepancies between how they handle time-zoning between the NNTP and
HTTP feeds (ie: one of them is handled wrong ;-).
I posted my reply at 9:53am, Oct 9 (NZDT). I'm guessing the MM
servers are running on EDT, which seems to be 17hrs behind NZDT?
Either that or they're elsewhere, and they're not handling the
timezones properly. This *could* be due to the fact NZ went onto
daylight savings last weekend.
Either way, I assure you that I'm not so quick as to answer before you
post, and I also agree it's a bit annoying to have my reply before
your original post.
And more importantly, my answer is to be avoided, now that you've
elaborated on the situation a bit!
I'd suggest changing the name of the URL field as returned from the
query, if it's not too much of a chore? And avoid variable names that
are the same as scope names (I know it *shouldn't* matter, but...
hey... apparently it does!).
And I'd log this as a bug. I can see where MM are going with the dot
notation in queries, but it seems there's some descrepancy between how
isDefined() checks for variables existing and how the rest of CF does
it.
Adam
-tony
http://www.macromedia.com/support/email/wishform/?6213=3
Adam