librelist archives

« back to archive

Layouts

Layouts

From:
Jeremy Bush
Date:
2010-05-27 @ 00:02
Hello-

I'm kind of struggling with trying to work out how to do layouts with 
dynamic body content, and I can't seem to find any info anywhere on it.

What I want to do is have a master layout template (layout.rb / 
layout.mustache), then insert dynamic body content into it (random.rb / 
random.mustache).

Can anyone point me in the right direction? I looked at partials, but they
don't seem to be exactly what I'm looking for.

Jeremy

Re: [mustache] Layouts

From:
Chris Wanstrath
Date:
2010-05-27 @ 01:42
On Wed, May 26, 2010 at 5:02 PM, Jeremy Bush
<contractfrombelow@gmail.com> wrote:

> I'm kind of struggling with trying to work out how to do layouts with 
dynamic body content, and I can't seem to find any info anywhere on it.
>
> What I want to do is have a master layout template (layout.rb / 
layout.mustache), then insert dynamic body content into it (random.rb / 
random.mustache).
>
> Can anyone point me in the right direction? I looked at partials, but 
they don't seem to be exactly what I'm looking for.

http://gist.github.com/415329

If you're using Sinatra, you can use Mustache::Sinatra:
http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb

Hope that helps.

Re: [mustache] Layouts

From:
Jeremy Bush
Date:
2010-05-27 @ 01:51
On May 26, 2010, at 8:42 PM, Chris Wanstrath wrote:

> On Wed, May 26, 2010 at 5:02 PM, Jeremy Bush
> <contractfrombelow@gmail.com> wrote:
> 
>> I'm kind of struggling with trying to work out how to do layouts with 
dynamic body content, and I can't seem to find any info anywhere on it.
>> 
>> What I want to do is have a master layout template (layout.rb / 
layout.mustache), then insert dynamic body content into it (random.rb / 
random.mustache).
>> 
>> Can anyone point me in the right direction? I looked at partials, but 
they don't seem to be exactly what I'm looking for.
> 
> http://gist.github.com/415329
> 
> If you're using Sinatra, you can use Mustache::Sinatra:
> http://github.com/defunkt/mustache/blob/master/lib/mustache/sinatra.rb
> 
> Hope that helps.

Yep, that looks like it should do it. Thanks a lot! :)

Jeremy

P.S. I'm not using sinatra, but my own mvc framework. Been working on 
integrating mustache into it the past couple of days. I've also adapted 
the php version to the Kohana framework 
(http://github.com/zombor/KOstache)