Chris,
Ahh yes. This is a flaw in the way FarCry processes the object
structure (it's been this way since the first public release of
FarCry). I've run into this problem (the same problem you're having)
on pretty much every FarCry site I've ever developed.
The way I overcome it is by doing the following: On every
displayPageSOMETHING.cfm template I run a custom tag at the top which
gathers all the extra data I need and stores it to a structured
variable.
<!--- example code near the top of a displayPageStandard.cfm file --->
<cfimport taglib="../../tags/webskin" prefix="myskin" />
<myskin:prepVars objectid="#request.navid#" returnVar="stSettings" />
<!--- Here is an example prepVars.cfm file I use (this is the smallest
one I could find :) --->
<cfsetting enablecfoutputonly="true" />
<!--- allow developers to close custom tag by exiting on end --->
<cfif thistag.ExecutionMode eq "end">
<cfsetting enablecfoutputonly="false" />
<cfexit method="exittag" />
</cfif>
<cfparam name="attributes.returnVar" default="stReturn" />
<cfparam name="attributes.objectid" default="#request.navid#" />
<cfscript>
stReturn = structNew();
// get ancestor
stReturn.qAncestors =
application.factory.oTree.getAncestors(objectid=attributes.objectid,
bIncludeSelf=true);
stReturn.lAncestorNames = valuelist(stReturn.qAncestors.objectName);
stReturn.lAncestorObjectIds =
valuelist(stReturn.qAncestors.objectId);
if (stReturn.lAncestorNames contains "Home"){
stReturn.startLevel = 1;
} else if (stReturn.lAncestorNames contains "Error Handling"){
stReturn.startLevel = 4;
} else {
stReturn.startLevel = 3;
}
caller[attributes.returnVar] = duplicate(stReturn);
</cfscript>
<cfsetting enablecfoutputonly="false" />
Hope this helps,
Regards,
--
Jeff Coughlin
Web Application Developer
http://jeffcoughlin.com
On May 7, 2009, at 5:27 PM, Might Aswell wrote:
>
> Jeff,
>
> Thanks, I really appreciate your helping. however, at this high a
> level, request.navid isnt defined yet, so how would I go about passing
> my curernt navid to get ancestors to get my parent?
> If I want to get my parent nav id's alias, and I put something like
> the below in _serverSpecificRequestScope.cfm navid is not defined in
> request scope. I'm still quite newbie and I am not sure where
> everything gets set and when.
>
> <cfset lHomeAliases = "home,jp_home">
> <cfset qAncestors = application.factory.oTree.getAncestors
> (objectid=request.navid)>
> <cfset listAncestors = QuotedValueList(qAncestors.objectid)>
> <cfset listAncestors = ListAppend(listAncestors,"'#request.navid#'")>
>
> <cfloop list="#lHomeAliases #" index="i">
>
> <cfset thisaliasid = application.navid[i]>
>
> <cfif ListFind(listAncestors, "'#thisaliasid#'")>
> <cfset request.parentAlias = i>
> </cfif>
>
> </cfloop>
>
> On May 7, 12:11 pm, Jeff Coughlin <[email protected]> wrote:
>>> rather than invoking this in the header webskin, where would be a
>>> good
>>> place to get/set this value so its available before any webskins are
>>> called?
>>
>> Chris,
>>
>> Since you need it on each page request, I would advise setting the
>> variable to the request scope and save it in projects/myProject/
>> config/
>> _serverSpecificRequestScope.cfm. That's how I've always done things
>> like this.
>>
>> --
>> Jeff Coughlin
>> Web Application Developer
>> http://jeffcoughlin.com
--~--~---------~--~----~------------~-------~--~----~
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: [email protected]
To unsubscribe, email: [email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
-~----------~----~----~----~------~----~------~--~---