Re: [Radiant] Counting Articles
On Wed, Feb 4, 2009 at 5:07 AM, Sean Cribbs seancri...@gmail.com wrote: r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Are you sure? Looking at the code for the r:children:count tag[1], it doesn't appear that its behaviour is modified by passing any attributes. In my fork of Radiant[2], I have modified the r:children tag so that it accepts the same options as r:children:each/first/last. I overlooked the r:children:count tag, so it still has this bug. However, by breaking up the r:children:count tag as follows: r:children virtual=falser:count//r:children using my version of the r:children tag, this should exclude virtual pages, whereas (I think) the current Radiant would include virtual pages. Cheers, Drew [1]: http://github.com/radiant/radiant/blob/a9f7925f1ecec9e797db191b3f903b153400ba2c/app/models/standard_tags.rb#L51-53 [2]: http://github.com/nelstrom/radiant/blob/b096e6f7b054d212725013b41b7c22663e84b843/app/models/standard_tags.rb#L69-75 Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count //r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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 ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Counting Articles
My version 7rc2 doesn't seem to have this option either. Adding virtual=false has no effect. Replacing children with Drew's tag 'children' do |tag| tag.locals.filter_attributes = tag.attr tag.locals.options = children_find_options(tag) tag.locals.children = tag.locals.page.children tag.locals.children_filtered = tag.locals.page.children.find(:all, tag.locals.options.clone) tag.expand end and r:children virtual=falser:count//r:children I end up with undefined local variable or method `tag' for # For my use it would be best if count had the option to exclude virtual pages and only include published pages. I think Drew's method would do that. But there must be more to it then just changing out that code and restarting Mongrel. Steven On Feb 4, 2009, at 3:21 AM, Andrew Neil wrote: On Wed, Feb 4, 2009 at 5:07 AM, Sean Cribbs seancri...@gmail.com wrote: r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Are you sure? Looking at the code for the r:children:count tag[1], it doesn't appear that its behaviour is modified by passing any attributes. In my fork of Radiant[2], I have modified the r:children tag so that it accepts the same options as r:children:each/first/last. I overlooked the r:children:count tag, so it still has this bug. However, by breaking up the r:children:count tag as follows: r:children virtual=falser:count//r:children using my version of the r:children tag, this should exclude virtual pages, whereas (I think) the current Radiant would include virtual pages. Cheers, Drew [1]: http://github.com/radiant/radiant/blob/a9f7925f1ecec9e797db191b3f903b153400ba2c/app/models/standard_tags.rb#L51-53 [2]: http://github.com/nelstrom/radiant/blob/b096e6f7b054d212725013b41b7c22663e84b843/app/models/standard_tags.rb#L69-75 Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count // r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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 ___ 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
Re: [Radiant] Counting Articles
Steven, Replacing children with Drew's tag 'children' do |tag| tag.locals.filter_attributes = tag.attr tag.locals.options = children_find_options(tag) tag.locals.children = tag.locals.page.children tag.locals.children_filtered = tag.locals.page.children.find(:all, tag.locals.options.clone) tag.expand end Sorry, I should have explained that that was not the only modification to the standard_tags file. The method filter_attributes is a private method, defined near the bottom of the file. (And some of the other children tags have been altered too). I've just updated my branch[1] to fix the bug in the r:children:count tag[2]. Specs are there too, and it seems to work fine. If you want to use this, I suggest you just copy the whole standard_tags.rb from my branch into your copy of Radiant. Cheers, Drew [1]: http://github.com/nelstrom/radiant/commit/037afe6c162a38a547ff49655e73e4a61c0a8fc2 [2]: http://github.com/nelstrom/radiant/blob/037afe6c162a38a547ff49655e73e4a61c0a8fc2/app/models/standard_tags.rb#L80-85 and r:children virtual=falser:count//r:children I end up with undefined local variable or method `tag' for # For my use it would be best if count had the option to exclude virtual pages and only include published pages. I think Drew's method would do that. But there must be more to it then just changing out that code and restarting Mongrel. Steven On Feb 4, 2009, at 3:21 AM, Andrew Neil wrote: On Wed, Feb 4, 2009 at 5:07 AM, Sean Cribbs seancri...@gmail.com wrote: r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Are you sure? Looking at the code for the r:children:count tag[1], it doesn't appear that its behaviour is modified by passing any attributes. In my fork of Radiant[2], I have modified the r:children tag so that it accepts the same options as r:children:each/first/last. I overlooked the r:children:count tag, so it still has this bug. However, by breaking up the r:children:count tag as follows: r:children virtual=falser:count//r:children using my version of the r:children tag, this should exclude virtual pages, whereas (I think) the current Radiant would include virtual pages. Cheers, Drew [1]: http://github.com/radiant/radiant/blob/a9f7925f1ecec9e797db191b3f903b153400ba2c/app/models/standard_tags.rb#L51-53 [2]: http://github.com/nelstrom/radiant/blob/b096e6f7b054d212725013b41b7c22663e84b843/app/models/standard_tags.rb#L69-75 Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count // r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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 ___ 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 ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Counting Articles
Okay that works great. It totally cut out the archive month index and the draft articles. Thanks for the extra instructions they were helpful. On Feb 4, 2009, at 5:30 PM, Andrew Neil wrote: Steven, Replacing children with Drew's tag 'children' do |tag| tag.locals.filter_attributes = tag.attr tag.locals.options = children_find_options(tag) tag.locals.children = tag.locals.page.children tag.locals.children_filtered = tag.locals.page.children.find(:all, tag.locals.options.clone) tag.expand end Sorry, I should have explained that that was not the only modification to the standard_tags file. The method filter_attributes is a private method, defined near the bottom of the file. (And some of the other children tags have been altered too). I've just updated my branch[1] to fix the bug in the r:children:count tag[2]. Specs are there too, and it seems to work fine. If you want to use this, I suggest you just copy the whole standard_tags.rb from my branch into your copy of Radiant. Cheers, Drew [1]: http://github.com/nelstrom/radiant/commit/037afe6c162a38a547ff49655e73e4a61c0a8fc2 [2]: http://github.com/nelstrom/radiant/blob/037afe6c162a38a547ff49655e73e4a61c0a8fc2/app/models/standard_tags.rb#L80-85 and r:children virtual=falser:count//r:children I end up with undefined local variable or method `tag' for # For my use it would be best if count had the option to exclude virtual pages and only include published pages. I think Drew's method would do that. But there must be more to it then just changing out that code and restarting Mongrel. Steven On Feb 4, 2009, at 3:21 AM, Andrew Neil wrote: On Wed, Feb 4, 2009 at 5:07 AM, Sean Cribbs seancri...@gmail.com wrote: r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Are you sure? Looking at the code for the r:children:count tag[1], it doesn't appear that its behaviour is modified by passing any attributes. In my fork of Radiant[2], I have modified the r:children tag so that it accepts the same options as r:children:each/first/last. I overlooked the r:children:count tag, so it still has this bug. However, by breaking up the r:children:count tag as follows: r:children virtual=falser:count//r:children using my version of the r:children tag, this should exclude virtual pages, whereas (I think) the current Radiant would include virtual pages. Cheers, Drew [1]: http://github.com/radiant/radiant/blob/a9f7925f1ecec9e797db191b3f903b153400ba2c/app/models/standard_tags.rb#L51-53 [2]: http://github.com/nelstrom/radiant/blob/b096e6f7b054d212725013b41b7c22663e84b843/app/models/standard_tags.rb#L69-75 Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/ archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count // r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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 ___ 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 ___ Radiant mailing list Post: Radiant@radiantcms.org Search:
Re: [Radiant] Counting Articles
Actually replacing the whole file worked great for the counting but not so good for the articles. I get undefined method `merge' for nil:NilClass on the month index page. On Feb 5, 2009, at 12:21 AM, Steven Southard wrote: Okay that works great. It totally cut out the archive month index and the draft articles. Thanks for the extra instructions they were helpful. On Feb 4, 2009, at 5:30 PM, Andrew Neil wrote: Steven, Replacing children with Drew's tag 'children' do |tag| tag.locals.filter_attributes = tag.attr tag.locals.options = children_find_options(tag) tag.locals.children = tag.locals.page.children tag.locals.children_filtered = tag.locals.page.children.find(:all, tag.locals.options.clone) tag.expand end Sorry, I should have explained that that was not the only modification to the standard_tags file. The method filter_attributes is a private method, defined near the bottom of the file. (And some of the other children tags have been altered too). I've just updated my branch[1] to fix the bug in the r:children:count tag[2]. Specs are there too, and it seems to work fine. If you want to use this, I suggest you just copy the whole standard_tags.rb from my branch into your copy of Radiant. Cheers, Drew [1]: http://github.com/nelstrom/radiant/commit/037afe6c162a38a547ff49655e73e4a61c0a8fc2 [2]: http://github.com/nelstrom/radiant/blob/037afe6c162a38a547ff49655e73e4a61c0a8fc2/app/models/standard_tags.rb#L80-85 and r:children virtual=falser:count//r:children I end up with undefined local variable or method `tag' for # For my use it would be best if count had the option to exclude virtual pages and only include published pages. I think Drew's method would do that. But there must be more to it then just changing out that code and restarting Mongrel. Steven On Feb 4, 2009, at 3:21 AM, Andrew Neil wrote: On Wed, Feb 4, 2009 at 5:07 AM, Sean Cribbs seancri...@gmail.com wrote: r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Are you sure? Looking at the code for the r:children:count tag[1], it doesn't appear that its behaviour is modified by passing any attributes. In my fork of Radiant[2], I have modified the r:children tag so that it accepts the same options as r:children:each/first/last. I overlooked the r:children:count tag, so it still has this bug. However, by breaking up the r:children:count tag as follows: r:children virtual=falser:count//r:children using my version of the r:children tag, this should exclude virtual pages, whereas (I think) the current Radiant would include virtual pages. Cheers, Drew [1]: http://github.com/radiant/radiant/blob/a9f7925f1ecec9e797db191b3f903b153400ba2c/app/models/standard_tags.rb#L51-53 [2]: http://github.com/nelstrom/radiant/blob/b096e6f7b054d212725013b41b7c22663e84b843/app/models/standard_tags.rb#L69-75 Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/ archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count // r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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 ___ 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:
Re: [Radiant] Counting Articles
It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count //r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] Counting Articles
might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count //r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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
Re: [Radiant] Counting Articles
r:children:count / should use the default find options for page children, which is to exclude virtual pages. Just to be sure, add virtual=false and see if you get a different result. Sean Steven Southard wrote: It seems like that should work but it doesn't. First, best I can tell, the archive month index doesn't have a url. Second even if I try to exclude another article's url it doesn't change the count. On Feb 3, 2009, at 4:34 PM, john muhl wrote: might try excluding it by url r:find url=/articlesr:unless_url matches=/articles/archive r:children:count / /r:unless_url /r:find On Tue, Feb 3, 2009 at 3:03 PM, Steven Southard ste...@stevensouthard.comwrote: I was using r:find url=/articlesr:children:count //r:find to keep track of the number of articles published. Now I've added an archive month index so my count is off by one. How do I subtract one or exclude the month index? Steven ___ 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 ___ 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