Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Find the Page.
- >> n = Page.find 8
- => #<Page id: 8, title: "n_and_e", summary: "News & Events", body: "{% for article in page.articles %}{{article.name}}{...", parent_id: 1, lft: 50, rgt: 51, status: nil, layout_id: nil, published: false, published_at: nil, author: nil, permalink: "news-events", created_at: "2008-10-08 15:14:53", updated_at: "2008-10-16 07:25:32", map_image_name: "settlement_cooper_fitness.png">
- #Show we have liquid tags
- >> n.body
- => "{% for article in page.articles %}{{article.name}}{{article.class}}{% endfor %}{{page.articles}}"
- #Pass the body text to the template
- >> @template = Liquid::Template.parse(n.body)
- => #<Liquid::Template:0x25169e8 @root=#<Liquid::Document:0x25169c0 @nodelist=[#<Liquid::For:0x2516754 @nodelist=[#<Liquid::Variable:0x251645c @name="article.name", @markup="article.name", @filters=[]>, #<Liquid::Variable:0x25161c8 @name="article.class", @markup="article.class", @filters=[]>], @variable_name="article", @markup="article in page.articles ", @name="article-page.articles", @collection_name="page.articles", @attributes={}, @tag_name="for">, #<Liquid::Variable:0x2515df4 @name="page.articles", @markup="page.articles", @filters=[]>]>>
- # Render the template
- >> @template.render( 'page' => n )
- #why may this be empty?
- => ""
Add Comment
Please, Sign In to add comment