# Reusable Page Parts - With A Twist

**URL:** <https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704>\
**Category:** Radiant CMS\
**Created:** [January 29, 2007, 1:30am UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704 "2007-01-29T01:30:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 29, 2007, 1:30am UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/1 "2007-01-29T01:30:46Z")

</div>

Before I ask my question, I’d like to make it clear that I am new to  
Radiant – perhaps I am asking this the wrong way or maybe there’s  
already a posted solution that I missed. If so, I apologize in advance.

I also realize that what I’m trying to do isn’t typical and that Radiant  
is not intended to be a swiss army knife to solve every problem. The  
abstraction of my problem, however, is something that could be  
needed/useful elsewhere.

Here goes…

I have two “interfaces” to my site – one that is the typical,  
open-to-the-public site with content on various subjects. The other  
“side” has its own stylesheets, unique content and is password  
protected.

The catch is that some of the content is not unique and is used in both  
places. To make it more complicated, these pages don’t match up in a  
1:1 correlation. Instead, parts of each page are what’s duplicated.  
For instance:

Site Side 1, Page 1 (Page 1.1)  
\* Unique Content (intro)  
\* Page Part A  
\* Page Part B  
\* Unique Content (ending)

Site Side 2, Page 1 (Page 2.1)  
\* Unique Content (different intro)  
\* Page Part A

Site Side 2, Page 2 (Page 2.2)  
\* Unique Content (another intro)  
\* Page Part B  
\* Unique Content (another ending)

Ideally, I would store the content for the common page parts (in this  
example Parts A and B) in their own location (maybe as hidden pages?)  
and then reference them in the actual pages (in this example, Pages 1.1,  
2.1, & 2.2)

The purpose, of course, is to keep this content DRY and to make it easy  
for future writers to follow the structure and methods used (so putting  
the parts A & B inside Page 1.1 and referencing them from 2.1 and 2.2  
would obscure it somewhat).

In many ways, this sounds to me like the debates I’ve read about storing  
and reusing resources within pages. Essentially, my page parts are just  
resources of a different flavor.

Wishlist: Just as with a resource solution, it would be nice to have  
some admin interface to confirm that the page part (or resource) is  
actually being used somewhere. Better yet – I would love some sort of  
itemization showing each usage of the page part (or resource).

Thanks for your help, suggestions, and guidance. This problem is my  
main concern at the moment before moving my site to Radiant.

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 30, 2007, 4:20am UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/2 "2007-01-30T04:20:13Z")

</div>

So, basically you’re just looking for a bunch of debug output below the  
page part tabs about what’s being used where?

It’s not really a functional change, just some information to help you  
setup your site the way you describe, right?

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 30, 2007, 5:57am UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/3 "2007-01-30T05:57:23Z")

</div>

Actually, I only need one thing:

Some way to reuse a page part within other pages (I’m not sure if I’m  
using the right term – I haven’t played with Radiant enough to say I  
really understand “page parts”). I don’t know if this is do-able with  
Radiant. If so, I’m not sure if it can be done using page parts, hidden  
pages referenced within visible ones, or some other device.

If anyone can tell me an easy way to do this, you’re my hero.

That said, a nice addition would be to collect and organize data on the  
usage of these sub-elements. This is not really a need – but would fit  
common use cases:

1. Writer modifies the visible pages and no longer uses sub-element A.  
A report/view/alert/whatever alerts him of this so he knows it is safe  
to delete it.

2. Writer re-organizes sub-element A and so checks all the visible  
pages that depend on it (maybe changing their unique content to dovetail  
with the newly modified sub-element text).

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 30, 2007, 6:18am UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/4 "2007-01-30T06:18:05Z")

</div>

By the way, this problem sounds an awful lot like the whole resources  
thing to me. Sure, in many cases a resource is only used once and can  
be “attached” to that page. But in other cases, say with a logo or  
other commonly used element, the resource belongs more to the site than  
any one page - just like a style sheet.

When I think about the resource/attachment problem, I see:

Primary Issue - Who/What owns the resource (or in my case the  
sub-element) and how do you reference it from multiple pages.

Secondary Issue - How can you find out where (or if) the resource is  
being used (for cleanup and maintenance reasons).

Just my $0.02 – hope it helps how the whole resource problem is  
approached. As I said in my original post, my problem here is really  
common when abstracted.

I only need the Primary Issue solved for now, though.

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 30, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/5 "2007-01-30T17:56:59Z")

</div>

Kevin A. wrote:

> If you’re trying to do what I think you’re are then it should just be a  
> case of using the radius tags…
> 
> \<r:find url=“section/page-name”\>  
> \<r:content part=“part-name” /\>  
> \</r:find\>
> 
> That will pull the page-part you specify out of the page that you  
> selected with the find tag. Does that help at all?

Thanks Kev - not sure how I missed that one.

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [January 30, 2007, 1:09pm UTC](https://www.ruby-forum.com/t/reusable-page-parts-with-a-twist/83704/6 "2007-01-30T13:09:06Z")

</div>

Hi Chris,

If you’re trying to do what I think you’re are then it should just be a  
case  
of using the radius tags…

\<r:find url=“section/page-name”\>  
\<r:content part=“part-name” /\>  
\</r:find\>

That will pull the page-part you specify out of the page that you  
selected  
with the find tag. Does that help at all?

Kev
