Guest User

Untitled

a guest
May 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. #Find the Page.
  2. >> n = Page.find 8
  3. => #<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">
  4.  
  5. #Show we have liquid tags
  6. >> n.body
  7. => "{% for article in page.articles %}{{article.name}}{{article.class}}{% endfor %}{{page.articles}}"
  8.  
  9. #Pass the body text to the template
  10. >> @template = Liquid::Template.parse(n.body)
  11. => #<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=[]>]>>
  12.  
  13. # Render the template
  14. >> @template.render( 'page' => n )
  15.  
  16. #why may this be empty?
  17. => ""
Add Comment
Please, Sign In to add comment