Use sub folder url with share_layouts


I’m using share_layouts in a page ‘/project’ which is using a layout
I created an extension, with routes, controllers etc. to map the project
Everything is working, the ‘part’ is display thanks to the layout.

Then, I created a new page ‘/project/list’. I maped it again etc., but
the final display is strange : I got the content of the ‘project’ page
(only from database not from my view), the content of my new page and
the view of my new page.
In fact the normal page + ‘/project’ content.

Is it normal or did I forgot something?


Hello Vincent. I’ve been working with ShareLayouts a bit recently,
maybe I can help. Can you give more details, though?

I’d like to know:

* Are you using the latest version of ShareLayouts from GitHub?
* Can you provide your route(s)?
* Can you provide any of your actions/views (enough to show what's
  using what).
* It sounds like you're using an Application Page in Radiant with
  the URL of /project/ is this correct? Is there anything fancy
  there?  Do you have an Application Page at /project/list too?


Hello, thanks ! I will give you more informations :

I created two pages :
Projects => /projects (with body content ‘Here is Projects’)
Create => /projects/new (with body content ‘Here is new project’)

Then, I created a new extension with the following routes :
map.with_options(:controller => ‘projects’) do |project|
project.project_index ‘/projects’, :action => ‘index’
project.project_new ‘/project/new’, :action => ‘new’

The controller project is a simple controller like that :
class ProjectsController < ApplicationController
radiant_layout ‘’
skip_before_filter :verify_authenticity_token

def index

def new


In the two view, I have something like :

  • content_for :extension do
    content for project…

  • content_for :extension do
    content for new project…

Back to the backend, I’m using a layout which include parts ‘body’ and

Now with share_layouts this is my result :

Here is Projects
content for project…

Here is Projects
content for new project…

The way is normal for the first link, but the page content of the second
come from the first one.
Let me know if you need more informations.
I’m not using fancy extension except the vhost extension (for multi

Thanks !

Hi Vincent,
I’ve been using Radiant for just a few days now, but I recall reading
something about inheriting content from parent pages through the page
parts. If I get your descriptions right, part of the content from
/projects is rendered in subpages, so I guess that might indeed result
from said feature. I’d have liked to look it up for you, but I’m in a
bit of a hurry.

Hope this helps

-------- Original-Nachricht --------

I tried the last version of share_layouts on github but I got the same
problem… maybe it’s a mistake of one of my extension.
I will check in a new Radiant project later.

I have another problem with share_layouts. I created a page and add some
content :


" />

And in my view :

  • content_for :title do
    = @project.topic

  • content_for :project_id do

  • content_for :query do

    • @project.queries.each do |query|
      %li= query.search_string

It is working in development mode but not in production. What could
change between both of them?

Thanks !

Christian, this is true – sortof. I recently submitted some patches to
Sean that have been rolled into shared_layouts. One of these changes
now lets you create a sub-page within Radiant like Vincent describes.
If you fail to create a sub-page, then the old behavior – the one you
described – prevails. This way you can use the sub-page’s breadcrumbs,
title, and, page parts.

This is also why I wanted to know if Vincent was using this latest
version of shared_layouts.

Vincent, try pulling the latest version and see if it fixes things for



I found new stuff linked (I hope) to my bug with share_layouts.

In the rails page model, I did a debug in the console :
def build_parts_from_hash!(content)
content.each do |k,v|
puts "$$$$$$$$ part : " + k.to_s
puts "$$$$$$$$ part content : " + v
(part(k) || => k.to_s)).content = v

And this is my result :

$$$$$$$$ part : my_part
$$$$$$$$ part content :
I’m in the part
$$$$$$$$ part : body
$$$$$$$$ part content :
WARNING: You’re using the Ruby-based MySQL library that ships with
Rails. This library is not suited for production. Please install the
C-based MySQL library instead (gem install mysql).

I’m using mysql with xampp, the problem is maybe coming from this

I tried to install the mysql gem, but I have some mysql package missing
checking for mysql_query() in -lmysqlclient… yes
checking for mysql_ssl_set()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
*** extconf.rb failed ***

I will try to install mysql from scratch.
But is it normal, do you have any idea?


I tried the last version of share_layouts but I got the same errors.
So, I decided to test it from scratch with a fresh radiant 0.6.9,
share_layouts, and my projects extension. It’s working, but now I got
sometimes another error.

Example : I created a /project page and a layout with the following
content : <r:content page=“test” /> (in both of them, it’s for a test).
In production mode, it’s working, but if I add some controller /
extension, it’s not working (the content of the page is not display, but
the content from the layout is display, so it’s realy strange). If I
add/remove another controller / extension it’s now working… I don’t
understand, because it’s the case with any controller / extension. If
I’m running in development mode, everything is working fine.

Is it a cache problem or something like that?
Anyone had the same error?


You are missing the mysql development headers. Depending on your
distribution they come in various packages. Something along the lines of
mysql-devel or something like that