get object id for page given nav id

23 views
Skip to first unread message

AJ Mercer

unread,
Mar 7, 2012, 11:29:07 PM3/7/12
to farcr...@googlegroups.com
Is there a Farcry function that returns the objectID for an item (dmHTML or dmInclude) for a given navigation object ID?

I have pages with the same name under multiple navigation nodes
eg
node 1
- page 1
- page 2
node 2
 - page 1
 - page 2

I would like to pass in the object id of the nav node (form alias, eg node-2) and page title and it would return node 2/page 2 objectID
something like getPageID(APPLICATION.navID['node-2'], 'page 2')


What I am trying to achieve is create a fireindly URL with skin:buildLink 

--

AJ Mercer
<webonix:net strength="Industrial" /> | <webonix:org community="Open" />
http://twitter.com/webonix

Blair McKenzie

unread,
Mar 8, 2012, 12:05:05 AM3/8/12
to farcr...@googlegroups.com
dmNavigation stores pages in aObjectIDs. If you use getData for a navid, you can then use getLink for each item in that array. I think there's a Child Links rule around somewhere that does something like this.

Blair

--
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: farcr...@googlegroups.com
To unsubscribe, email: farcry-dev+...@googlegroups.com
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry

Sean Coyne

unread,
Mar 8, 2012, 8:59:28 AM3/8/12
to farcr...@googlegroups.com
This should do it:

st = application.fapi.getContentObject(application.fapi.getNavId('node-2'));
pageId = st.aObjectIds[2];

Chris Kent

unread,
Mar 8, 2012, 1:04:53 PM3/8/12
to farcr...@googlegroups.com
Untested and no error checking but try

<cfset stArgs = structNew()>
<cfset stArgs.typeName = "dmHTML">
<cfset stArgs.objectID_eq = "#arrayToList(application.fapi.getContentObject(application.fapi.getNavId('node-2').aObjectIDs))#">
<cfset stArgs.title_eq = "page 2">
<cfset q=application.fapi.getContentObjects(argumentCollection=stArgs)>

Chris.

Chris Kent

unread,
Mar 8, 2012, 1:07:43 PM3/8/12
to farcr...@googlegroups.com
oops, try 

<cfset stArgs = structNew()>
<cfset stArgs.typeName = "dmHTML">
<cfset stArgs.objectID_in = arrayToList(application.fapi.getContentObject(application.fapi.getNavId('node-2').aObjectIDs))>
<cfset stArgs.title_eq = "page 2">
<cfset q=application.fapi.getContentObjects(argumentCollection=stArgs)>

changed the objectID_eq to objectID_in

Chris.

On Thursday, 8 March 2012 04:29:07 UTC, AJ Mercer wrote:
Reply all
Reply to author
Forward
0 new messages