Hi Experts, Below is the snippet build for displaying the Title field value on Container. I am though able to achieve to fetch "Title" for "nav Container" where as per the requirement I also want to display the "secondaryNavTitle" field which I am failing to achieve the same for the "Child Container" i.e. secondaryNav.
You process only "/Navigation/nav" Children, something like /Navigation/nav[1], /Navigation/nav[2] etc..."SecondaryNav" is a nested Container of "Nav". For each "Nav" you can get it using for example item.getChildByNameMethod. Then try to set (sub)Title with the nested loop calling setTitle(...) for "SecondaryNav" children.
Bo, When you say that "try to set (sub)Title with the nested loop calling setTitle(...)" I am failing to understand this part is it possible if you may kindly elaborate on the same.Regards,Ace
Using your notation, I meant something like the following. Note that you'll have to play with it, it'not *real* code[php]for (var i=0; i var item = levelItems; . . . setTitle(item, title); // Loop through secondaryNav Replicant Container var sn = item.getChildByName('secondaryNav'); if (sn) { var secondary = sn.getChildren(); for (var j=0; j var subItem = secondary; var subTitle = 'whatever it is that you want here'; . . . setTitle(subItem, subTitle); } }}[/php]
Bo, I tried implementing the solution as suggested but still unable to achieve the output as desired. Would it be possible for you to provide the actual workaround for this issue as I tried several other ways of achieving the result but no success ...Regards,Ace
My apologies. I forgot that "getChildByName" will probably not work with the Container child.You'd have to go through all children and filter out ones that yo do not want. Something likethe following should do it[php]var pattern = /secondaryNav/i;for (var i=0; i var item = levelItems; . . . setTitle(item, title); // Loop through secondaryNav Replicant Container var children = item.getChildren(); for (var j=0; j var subItem = children; if (subItem.getName().match(pattern)) { var subTitle = 'whatever it is that you want here'; setTitle(subItem, subTitle); } } }[/php]That said, your complete setTitle code represents undocumented and unsupported hack. There isno guarantee that it will work for nested replicant Containers as well as for the outer ones.If that's the case you'd have to debug it, etc...