Ill try something like that.  I figured I was going to have to go into
the tag code and get it to evaluate any radiant tags in the urls list
before parsing the urls, so it looks like that is what I will be doing.

Thanks for the help!
Chaim

Mohit Sindhwani wrote:
> Chaim Kirby wrote:
>> Mostly correct, yes.
>> For now you can ignore your #2, if I can figure out #1 I should be good
>> to go.
>> For #1, Ideally I would like to have a snippet that handles putting the
>> urls together. I know where in my hierarchy news pages will be, but I
>> wont necessarily know when someone has added a new project with news.  I
>> would be easier to be able to do:
>>
>> {pseudocode}<r:find url="projects"><r:children:each><if has child url
>> matches /news/ return url></r:children:each></r:find>
>>
>> if that is not possible, but having a page "HOME" with a page part
>> "news_urls" /news;/project1/news;/project2/news;
>>
>> and then saying
>> <r:aggregate urls='<r:find url="/home"><r:content
>> part="news_urls"/></r:find></r:aggregate>
>>
>> would be sufficient.
>>   
> 
> If you're comfortable writing tags, I think this is what you need to do:
> * Merge the code from the 2 sets below: 1 is from aggregate and the 
> other is from snippet
> 
> --- from standard_tags.rb > tag: snippet
>   tag 'snippet' do |tag|
>     if name = tag.attr['name']
>       if snippet = Snippet.find_by_name(name.strip)
>         tag.locals.yield = tag.expand if tag.double?
>         tag.globals.page.render_snippet(snippet)
>       else
>         raise TagError.new('snippet not found')
>       end
>     else
>       raise TagError.new("`snippet' tag must contain `name' attribute")
>     end
>   end
> 
> ---- from aggregation_tags.rb > tag: aggregate
>   tag "aggregate" do |tag|
>     raise "`urls' attribute required" unless tag.attr["urls"]
>     urls = tag.attr["urls"].split(";").map(&:strip).reject(&:blank?).map 
> { |u| clean_url u }
>     parent_ids = urls.map {|u| Page.find_by_url(u) }.map(&:id)
>     tag.locals.parent_ids = parent_ids
>     tag.expand
>   end
> 
> If you could just merge the 2, it should be possible to create:
> * aggregate_snippet snippet_name="..." or modify aggregate to do:
> 
> You could try something like this (done from a lot of copy and paste, no 
> testing!)
> 
>   tag "aggregate_snippet" do |tag|
>     raise "`snippet_name' attribute required" unless 
> tag.attr["snippet_name"]
>     if name = tag.attr['snippet_name']
>       if snippet = Snippet.find_by_name(name.strip) #snippet was found..
>        urls = 
> snippet.content.split(";").map(&:strip).reject(&:blank?).map { |u| 
> clean_url u }
>       parent_ids = urls.map {|u| Page.find_by_url(u) }.map(&:id)
>     tag.locals.parent_ids = parent_ids
>     tag.expand
>   end
> 
> You should be able to use this by doing:
> <r:aggregate_snippet snippet_name="whatever">.........
> </r:aggregate_snippet>
> 
> Hope this helps.
> Cheers,
> Mohit.
> 5/27/2009 | 12:50 AM.
> 
> 
> 
> 
> _______________________________________________
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> 


_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to