On 2 Feb 2011, at 11:35, Hadi S. wrote:

> I am defining some specific tags for a project. Is there a way to
> render a snippet
> from inside a tag definition?
> 
> In my tag i need to retrieve the type of the page and want to render a
> specific
> snippet dependent of the type.


You should be able to call render_snippet directly. Something like this piece 
of untested made-up code:

        if snippet = Snippet.find_by_name(snippet_name)
          tag.globals.page.render_snippet(snippet)
        end

but I would feel uncomfortable about hard-coding content names. You might be 
better off defining conditional tags based on page class (<r:if_page_is 
class="archivePage">...</r:if_page_is>) and keeping the content-choice in the 
content layer. 

best,

will




Reply via email to