Re: Utilizing multiple behaviors per page

I just recently discovered Radiant and have utilized it on a personal
project, and one of the pieces I was missing was a comments section -
which I was glad to find via the list. However - do have a question.
I’m also using the gallery behavior in one section - is there anyway
to combine 2 behaviors on sets of pages, i.e. comments and gallery -
or is this just a limitation of the behaviors?

I believe you could have a child page that has the comments behavior and
display that page in the parent using the children tag. The ability to
have
multiple child pages each with thier own behavior, and subsequently
display
them all on the parent page is a general technique that gets used quite
a
bit in Radiant (and makes it super flexible too :stuck_out_tongue: )

Justin

On Sep 6, 2006, at 7:12 AM, Justin Marney wrote:

The ability to have multiple child pages each with thier own
behavior, and subsequently display them all on the parent page is a
general technique that gets used quite a bit in Radiant

This gives me the idea of creating something on the wiki about
“Radiant Recipes” or something, documenting common usage patterns,
tips, and radiant idioms. What do people think?

Bodhi

Bodhi wrote:

On Sep 6, 2006, at 7:12 AM, Justin Marney wrote:

The ability to have multiple child pages each with thier own
behavior, and subsequently display them all on the parent page is a
general technique that gets used quite a bit in Radiant

This gives me the idea of creating something on the wiki about
“Radiant Recipes” or something, documenting common usage patterns,
tips, and radiant idioms. What do people think?

Perhaps the How To section would work for this?

http://dev.radiantcms.org/radiant/wiki/HowTos


John L.
http://wiseheartdesign.com

Is there a reason why this doesn’t work the other way around, for
example:
I have an area of the website which I have restricted access to, I
wanted to
have a parent page that takes care of the restrictions for all child
pages.
What I did was have a parent with a restricted_behavior and a body part
that
shows either a ‘registered’ or a ‘not_registered’ page parts depending
if
the user is registered or not.
Then I have child pages hat do not have a body page part, so radiant
finds
the body page part in the parent, but if the tags I used in the parent
are
not in the child behavior I get errors that the tags are not recognized,
which made me duplicate the tags to all behaviors I use with the page
children.
Is this the way it suppose to work? Is there any other way of doing what
I
want to do?
Dror

Bodhi wrote:

This gives me the idea of creating something on the wiki about
“Radiant Recipes” or something, documenting common usage patterns,
tips, and radiant idioms. What do people think?

Bodhi

I think this is an excellent idea. I’m fairly new to Radiant as well and
have been struggling with some of the fundamentals such as the multiple
behaviours type setup you mentioned. A single place that covers a lot of
these pitfalls without having to search through a forum would make entry
to Radiant a lot easier.

Kev

dror tirosh wrote:

not in the child behavior I get errors that the tags are not recognized,
which made me duplicate the tags to all behaviors I use with the page
children.
Is this the way it suppose to work? Is there any other way of doing what I
want to do?
Dror

A clever hack for using multiple behaviors on the same page is to create
another page, assign a behavior to it, and then use the <r:find /> tag
to include content from it. For example, on the Ruby-Lang site we have a
top-projects box which is repeated on most of the top level pages. To
make this work we do this:

<r:find url=“/en/libraries/top-projects/”>
<r:content part=“top-projects” />
</r:find>

This outputs the “top-projects” part of the top projects page. You can
see it in action in several places:

http://new.ruby-lang.org/en/
http://new.ruby-lang.org/en/libraries/
http://new.ruby-lang.org/en/libraries/top-projects/


John L.
http://wiseheartdesign.com

I know, I use the same solution for the events and promotions on our
sites
(look at the right sidebar on lokihostel.com).
But I was looking for a solution I can offer to other users who enter
data
in our CMS.
That is why I thought I could use the fact that Radiant searches up for
body
parts, to have a body part that have all that extra tagging, and my
users
just take care of the text in the other page parts.
Most of my users will simply wont enter data when it has tags in it,
that is
why most of the content entered by users on our site is through the
fckeditor a wysiwyg editor.
So I was looking for a different solution.
If there is none I would accept that as well, but if you guys have a
different hack I’ll be happy.

BTW - I don’t see why the two acts so differently, so if I look for a
page
it uses its own behavior but if radiant looks for a page (like a body
part)
it uses the current page behavior.

Dror

dror tirosh wrote:

So I was looking for a different solution.
If there is none I would accept that as well, but if you guys have a
different hack I’ll be happy.

For this kind of thing I’d recommend making the tags global (so they can
be used on any page). There seems to be a common misconception that
behaviors are the appropriate way to add tags to a page. You can use
behaviors for this, but most of the time it is only useful if you tie it
in with other features (like overriding the render_page method).

BTW - I don’t see why the two acts so differently, so if I look for a page
it uses its own behavior but if radiant looks for a page (like a body part)
it uses the current page behavior.

It’s so that you can cycle through the children of a page and render
parts in the correct context.


John L.
http://wiseheartdesign.com