Actually I think you need to rethink things a bit. Specifically, I think that specifying multiple parts should be handled in an OR fashion. The reason is that there would be no way to create a div.sidebar if either a marketing or callout part exist and then put one or both of those part into the div. This is a completely reasonable use case (IMHO). At the same time, you can preserve the AND behaviour by nesting <r:if_content> tags.

As you've proposed, I can see no difference between:

<r:if_content part="this, that">Stuff</r:if_content>


<r:if_content part="this"><r:if_content part="that">Stuff</ r:if_content></r:if_content>

And that suggests to me that applying an OR to the first case is a useful idea.

As to how inherit should work, I think you're on the right track; look for each part independently. Otherwise the following would not behave as you'd expect:

<r:if_content part="this, that" inherit="true"> <r:content part="this" inherit="true" /><r:content part="that" inherit="true" /></r:if_content>


On 7-Jul-08, at 5:29 PM, Jim Gay wrote:

I'm working on this feature, but one of the main reasons I put this out to the list for feedback is that it can become confusing, so I wanted to see if anyone else had thought about this.

The next version of Radiant (0.6.8) will accept a list of parts in if_content
<r:if_content part="this, that">
It will display the contents only if all of those parts exist.
This is useful for outputting information from customers (for example) where you want to display the customer description part only if it also has a testimonial part. If only some but not all of the listed parts are found, it will display nothing.

In light of that, how would you expect inherit="true" to work?

Would you expect that it looks up the tree for the existence of each part no matter where in the tree that part is found? Or would you expect it to look up the tree to find any page that has all of the listed parts?

My inclination is to make it look up the tree for each listed part regardless of the location of other parts, and as long as it finds all of them, it will output the contents of the if_content tag.

I personally have had the need for
<r:if_content part="this, that">
<r:if_content part="this" inherit="true">

But I have not had the real-world need for
<r:if_content part="this, that" inherit="true">

I'm working on it slowly to allow myself time to consider the pros and cons and to allow anyone to jump in with ideas before I get too far. I'd appreciate more feedback.
On Jul 7, 2008, at 7:04 PM, Adam van den Hoven wrote:

There are few things that make me more grumpy that empty elements that server no useful purpose. I'd love it.
On 7-Jul-08, at 12:56 PM, Jim Gay wrote:

Is there any interest in adding the inherit attribute to the if_content tag?

In some instances I'll find the need to output something like

<div id="extras">
<r:content part="extras" inherit="true" />

But I don't have a way to conditionally render the <div id="extras"> bit. If the parent or current page has an "extras" part, then it will appear, but if it doesn't I'll have an empty div element.

Is there a simple way to handle this or would <r:if_content inherit="true"> be a clear and welcomed addition?

Radiant mailing list

Radiant mailing list

Reply via email to