Hi Sean:

Sean Cribbs wrote:
> Put it in a snippet! Snippets are evaluated in the context of the
> local page (whether that's the one being rendered on a global level or
> not).

Yeah, I know I can include parts from other pages or snippets into the
current page and the tags in those parts will be rendered in the
context of the page they belong to. But I was more wondering about the
case where you don't know what type of page you are accessing. As in:

<r:children:each>
  <!--
    The current child can be anything and I cannot say for sure how
    to expand the following tag, unless I do it in the context of the
    child.
  -->
  <r:link/>
</r:children:each>

> However, I do see your point.  I'm not sure what complications it
> would cause in the parsing/evaluating.

It probably would have to be decided on a tag by tag basis whether to
change the context or not and probably is something that is largely
done in the tag implementation and not in Radius. E.g.:

 tag 'children:each' do |tag|
   options = children_find_options(tag)
   result = []
   children = tag.locals.children
   tag.locals.previous_headers = {}
   children.find(:all, options).each do |item|
-    tag.locals.child = item
-    tag.locals.page = item
-    result << tag.expand
+    p = Radius::Parser.new(item.context, :tag_prefix => 'r')
+    result << p.parse(tag.raw_content)
   end
   result
 end

Though, I could not find anything in Radius that would be a equivalent
to #raw_content.

Cheers,
Oliver

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to