Thanks for the feedback, everyone!

I'm glad that my code seems to be acceptable. However I guess I should open a 
JIRA issue asking for a "getAncestor" method in STKUtils... 

-will

On 25.02.2011, at 10:31, Unger, Richard wrote:

> Hi Will!
> 
> I can confirm that we are doing similar „tricks“ to handle things like 
> sidebar content.
>  
> It doesn’t seem like such a bad solution to me, and the code does not seem so 
> “dirty” to me either.
>  
> On a similar note, I also wrote some macro/model code to do the function 
> “inherit first” à since stk.inheritContent() is an “inherit all” type 
> function, where all the content named “iconLinks” (to use your example) from 
> all ancestor nodes of content is gathered in a collection.
> We found we wanted to walk up the tree to find the first instance of 
> “iconLinks” and then stop there, effectively allowing us to make settings at 
> top level pages, but ‘override’ them at deeper level pages if needed.
>  
> Regards from Vienna,
>  
> Richard
>  
>  
> Von: [email protected] 
> [mailto:[email protected]] Im Auftrag von Will Scheidegger
> Gesendet: Donnerstag, 24. Februar 2011 23:26
> An: Magnolia User-List
> Betreff: Re: [magnolia-user] STK question: inherited singelton link list like 
> meta nav?
>  
> Answering my own question... something like this below did the job. But I 
> don't think it would win a price in a code beauty contest...
>  
> [#assign cms=JspTaglibs["cms-taglib"]]
> 
> <ul id="icon_links">
>   [#assign iconLinksModel = stk.inheritContent(content, "iconLinks") /]
>   [#if iconLinksModel.exists]
>     [@cms.contentNodeIterator contentNode=iconLinksModel.content!]
>         [@cms.includeTemplate /]
>     [/@cms.contentNodeIterator]
>   [/#if]
>   [#if mgnl.editMode && content.@level == 1]
>       <li class="icon_link">[@cms.newBar 
> contentNodeCollectionName="iconLinks" newLabel="Neues Icon-Link" 
> paragraph="schweizmobilcardExternalImageLink,schweizmobilcardInternalImageLink"
>  /]</li>
>   [/#if]
> </ul>
>  
> On 24.02.2011, at 18:16, Will Scheidegger wrote:
> 
> 
> 
> Dear Magnolians
> 
> We need to add a list of "sponsor" (icon, link, name) on each page. It pretty 
> much boils down to the same functionality the meta navigation offers. But the 
> meta navigation uses special methods the model provides. 
> 
> Now of course I could extend STKTemplateModel and copy the meta navigation 
> methods. But can I do the same without modifying the model?
> 
> Whatever I have tried so far has failed miserably. I've done this in JSP 
> templates, but somehow Freemarker is giving me a hard time... for instance: 
> How can I get the ancestor node at level 1? ${content.getAncestor(1)} does 
> not work because of the Magnolia Freemarker "features"...
> 
> Thanks for any pointers!
> 
> -will
> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
> 
>  
>  
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to