# \[ANN\] share\_layouts extension

**URL:** <https://www.ruby-forum.com/t/ann-share-layouts-extension/115143>\
**Category:** Radiant CMS\
**Created:** [September 21, 2007, 12:23am UTC](https://www.ruby-forum.com/t/ann-share-layouts-extension/115143 "2007-09-21T00:23:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [September 21, 2007, 12:23am UTC](https://www.ruby-forum.com/t/ann-share-layouts-extension/115143/1 "2007-09-21T00:23:00Z")

</div>

One of the “most requested” features for Radiant is to be able to reuse  
layouts in your standard Rails controllers. Well, it’s here!

With the help of John, I was able to write this extension from scratch  
today, and it is pretty well tested. I invite you to try it out and  
give me your feedback. You can download the extension from the main  
Radiant repository:

[http://dev.radiantcms.org/svn/radiant/trunk/extensions/share\_layouts](http://dev.radiantcms.org/svn/radiant/trunk/extensions/share_layouts)

The README has a little more detail, but here’s the basic way to use it:

class MyController \< ApplicationController  
radiant\_layout ‘Main’  
end

This will make all your actions from that controller be rendered within  
the Radiant Layout named ‘Main’. ‘content\_for’ blocks are mapped to  
page parts, e.g. a content\_for :sidebar block will be accessed via  
\<r:content part=“sidebar” /\> in the Layout. The total result of your  
template, a.k.a. @content\_for\_layout, maps to the ‘body’ part, or  
\<r:content /\>. If your Layout has \<r:title /\> or \<r:breadcrumbs /\>  
invocations in it, you can assign these in your controller/view with  
@title and @breadcrumbs respectively. You may also use content\_for  
:title/:breadcrumbs if you prefer.

Cheers!

Sean

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [September 24, 2007, 9:58am UTC](https://www.ruby-forum.com/t/ann-share-layouts-extension/115143/2 "2007-09-24T09:58:04Z")

</div>

Nice, Sean!

If anyone prefers it the other way around, that is; wants to use an  
ordinary Rails layout for their Radiant pages, this extension makes  
it possible:  
[http://svn.casperfabricius.com/extensions/file\_based\_layout/](http://svn.casperfabricius.com/extensions/file_based_layout/)

Best regards,  
Casper F.
