Re: [Radiant] check for children
Actually, there are a score of "global tags" that I'm thinking of collecting and putting into a patch, although most people could put them in a plugin in the meantime like I demonstrated in the How To.Sean Cribbs seancribbs.comOn 9/25/06, Dave Crossland <[EMAIL PROTECTED]> wrote: On 25/09/06, Steven Noels <[EMAIL PROTECTED] > wrote:> On 24 Sep 2006, at 22:24, Dave Crossland wrote:>> > If you could provide it as a plugin, that would be awesome! :-)>> Creating a plugin for a two-line patch for a totally trivial addition > would be overkill, no?Sure, I'm just thinking of people who didn't install with --unpackthat's all :-)--Regards,Dave___Radiant mailing list Post: Radiant@lists.radiantcms.orgSearch: http://radiantcms.org/mailing-list/search/Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 25/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: > On 24 Sep 2006, at 22:24, Dave Crossland wrote: > > > If you could provide it as a plugin, that would be awesome! :-) > > Creating a plugin for a two-line patch for a totally trivial addition > would be overkill, no? Sure, I'm just thinking of people who didn't install with --unpack that's all :-) -- Regards, Dave ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 24 Sep 2006, at 22:24, Dave Crossland wrote: > If you could provide it as a plugin, that would be awesome! :-) Creating a plugin for a two-line patch for a totally trivial addition would be overkill, no? Index: app/models/page_context.rb === --- app/models/page_context.rb (revision 122) +++ app/models/page_context.rb (working copy) @@ -40,6 +40,15 @@ end # +# ... +# +# Checks for existing children. +# +define_tag 'if_children' do |tag| + tag.expand if tag.locals.page.has_children? +end + +# # # # Renders the total number of children. -- Steven Noelshttp://outerthought.org/ Outerthought Open Source Java & XML stevenn at outerthought.orgstevenn at apache.org ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 24/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: > > en that indeed did the trick. :-) > No idea however if this is the best way > to do this. This is exactely the way I have done it. > I can provide a (obviously) very simple patch if people > are interested. If you could provide it as a plugin, that would be awesome! :-) -- Regards, Dave ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 24 Sep 2006, at 17:50, Dave Crossland wrote: > On 24/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: >> In my base template, I want to output a only if some children >> of the current page exist. How can I check for children of a page? > > You need to define a new tag like that would work > like this: > > > > > > > > > This is explained in more details on the wiki - to which I hope you'll > contribute your experiences with! :-) I added this to my --unpack'ed version of app/models/page_context.rb : # # ... # # define_tag 'if_children' do |tag| tag.expand if tag.locals.page.has_children? end en that indeed did the trick. No idea however if this is the best way to do this. I can provide a (obviously) very simple patch if people are interested. -- Steven Noelshttp://outerthought.org/ Outerthought Open Source Java & XML stevenn at outerthought.orgstevenn at apache.org ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 24 Sep 2006, at 18:49, Sean Cribbs wrote: > Dave Crossland wrote: >> On 24/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: >>> In my base template, I want to output a >>> only if some children of the current page exist. How can I check >>> for children of a page? >> You need to define a new tag like that would work like this: >> This is explained in more details on the wiki - to which I hope >> you'll contribute your experiences with! :-) http:// >> dev.radiantcms.org/radiant/wiki/HowToDefineGlobalTags > Perhaps, but the children:each tag will only work if children > exist. So in a sense it encapsulates the if_children idea. If you > give us a little more context or detail, I might be able to come up > with some code that will do the trick. I have a containing a secondary navigation that should only be inserted when there's underlying children. Something like: More information would do the trick. -- Steven Noelshttp://outerthought.org/ Outerthought Open Source Java & XML stevenn at outerthought.orgstevenn at apache.org ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
Dave Crossland wrote: On 24/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: In my base template, I want to output a only if some children of the current page exist. How can I check for children of a page? You need to define a new tag like that would work like this: This is explained in more details on the wiki - to which I hope you'll contribute your experiences with! :-) http://dev.radiantcms.org/radiant/wiki/HowToDefineGlobalTags Perhaps, but the children:each tag will only work if children exist. So in a sense it encapsulates the if_children idea. If you give us a little more context or detail, I might be able to come up with some code that will do the trick. Sean Cribbs seancribbs.com ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] check for children
On 24/09/06, Steven Noels <[EMAIL PROTECTED]> wrote: > In my base template, I want to output a only if some children > of the current page exist. How can I check for children of a page? You need to define a new tag like that would work like this: This is explained in more details on the wiki - to which I hope you'll contribute your experiences with! :-) http://dev.radiantcms.org/radiant/wiki/HowToDefineGlobalTags -- Regards, Dave ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
[Radiant] check for children
In my base template, I want to output a only if some children of the current page exist. How can I check for children of a page? -- Steven Noelshttp://outerthought.org/ Outerthought Open Source Java & XML stevenn at outerthought.orgstevenn at apache.org ___ Radiant mailing list Post: Radiant@lists.radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant