views:

426

answers:

2

I'm trying to render a liquid template within a liquid layout (Liquid Template lang, not CSS liquid layout stuff). I can't seem to get the layout part to render. Currently using:

assigns = {'page_name' => 'test'} @layout = Liquid::Template.parse(File.new(@theme.layout.path).read) @template = Liquid::Template.parse(File.new(self.template.path).read)

@rend_temp = @template.render(assigns) @rend_layout = @layout.render({'content_for_layout' => @rend_temp})

render :text => @rend_layout, :content_type => :html

The resulting HTML of the page shows that the 'template' rendered in liquid fine, but it isn't wrapped with the layout (replacing 'content_for_layout' in the layout with the rendered template)

+1  A: 

Just to let anyone else know who comes across this problem, the code posted above actually does work, the issue is with the variable named @template. I renamed @template, and @layout to @_tempalte, and @_layout and everything works as expected.

bwizzy
A: 

Hi,

I'm in the same boat, would you mind elaboration on your setup? Where do you store your themes and templates (disk or database)? You are storing path to themes in DB?

Thanks!

Damir Horvat