Hi Rob!

#2 would definately NOT be the best practice - don't go down this road!

#1 is more like what you want.
By configuring your new-bars and edit-bars appropriately, you can add new 
content in different "nodes" - so for sidebar content, it is appropriate to 
create a "collection" node, which holds a bunch of paragraphs intended for the 
sidebar. Use the "JCR Browser" in the Tools menu to get an overview of how the 
content is stored under your page node.
So basically, when you inherit with 
mgnl.inherit(content).mySidebarCollection
you will get the nodes stored under the collection node " mySidebarCollection 
". By storing the page-specific content in a different collection you can 
prevent it from being inherited.

You'll have to play with it a bit to get the idea, but it's pretty well 
structured overall.

Regards from Vienna,

Richard 

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Magnolia Forums (on behalf of Robert Bowen)
Gesendet: Samstag, 16. Juli 2011 15:37
An: Magnolia User List
Betreff: [magnolia-user] Re: Two Noob Questions: Inheritance and i18n


Richard, you're a genius! Or at least very clever ... :)

With your hints I was able to dig a little deeper about the inheritance issue 
(the i18n issue is no longer a problem, I'm going to just make 3 different 
content trees.) Thanks so much again for your help. 

At first I didn't understand how or where to out the code you wrote. Then 
finally I understood. What I had to do was change my template, get rid of 

[@cms.contentNodeIterator contentNodeCollectionName="myNewCollection"]
  [@cms.includeTemplate /] 
[/@cms.contentNodeIterator]

and instead put:

[#assign topMenuItems=mgnl.inherit(content).myNewCollection /]
  [#list topMenuItems?children as kid]
[@cms.includeTemplate contentNode=kid /]

That way sub-pages inherit it. Genius!

But there's always a 'but'! In my case it's a bit one. Here it is: if I define 
all my paragraphs in my homePage template - header (with a top menu), sidebar 
(with teasers, for example), footer, etc - and then define another page, let's 
say an About page, that inherits all of those paragraphs, *how* do I make it so 
the other homePage-specific content (in my case a flash movie) isn't displayed 
in the About page, but rather aboutPage-specific content is displayed?

I've been looking around and haven't found an answer. Two ideas occur to me:

1. Instead of defining all of those paragraphs in the homePage template, 
instead define a headerTemplate (with the topMenu), sideTemplate (with 
teaders), and footerTemplate and somehow tell my homePage to use a different, 
'homePage' template that includes headerTemplate, sideTemplate and 
footerTemplate. Is this a best practice? Is it even possible?

2. Define all paragraphs in the homePageTemplate and have all pages inherit 
from homePageTemplate and where there is sub-page specific content put an 'if', 
something like:

if (page='about') display aboutContent
else if (page='contact') display contactContent

Again .. is this a best practice? (It doesn't seem like it ... to have n 'if's 
in the template, one for each page ...) Is it even possible?

I'll keep digging. Any help, as you already know, is very appreciated.

Cheers,
Bob

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=8a6f25e7-70ce-4fb8-b03e-15588729ff17


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





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

Reply via email to