Hi,
I created a sitemap using the method described here:
http://wiki.radiantcms.org/How_To_Make_a_Sitemap
I’ve been very happy with the result. But recently I started cleaning
up my xhtml to make it validate, and I find that there is a problem
with the sitemap page. The sitemapper snippet creates a
whether
or not the current page has children. A with no - children
does not pass the w3c validation (I’m on XHTML 1.0 strict).
I propose that modifying the sitemapper snippet along the following
lines would fix this:
<r:children:each by=“title” order=“asc”>
<r:unless_content part=“no-map”>
-
<r:link />
<r:has_child>
<r:snippet name=“sitemapper” />
</r:has_child>
</r:unless_content>
</r:children:each>
The block inside <r:has_child> would only render if the current page
had one or more child pages with status=published.
Currently, there is no tag equivalent to <r:has_child>, as far as I
know. There are tags <r:parent /> and <r:unless_parent />. If such a
tag was to be created, it would probably be useful to create its
opposite as well, e.g <r:has_no_child> or <r:childless>. (Any
thoughts as to how the pair of tags should be named?)
Should I create a trac ticket for this? Or am I missing something?
Cheers,
Andrew
Andrew,
They shouldn’t be hard to implement. Have a look at the definitions for
<r:parent> and <r:if_parent> in standard_tags.rb.
Sean
On 9 Nov 2007, at 14:19, Sean C. wrote:
Andrew,
They shouldn’t be hard to implement. Have a look at the
definitions for
<r:parent> and <r:if_parent> in standard_tags.rb.
I thought so too.
I can easily roll this out as an extension, but I wonder whether it
should really go into the core? I’ll have a go at creating the tags
and tests myself. When done, I’ll also update the howto page.
As for the naming of these tags, what sounds most idiomatic:
<r:if_children> and <r:unless_children>
<r:has_children> and <r:has_no_children>
<r:is_parent> and <r:is_childless>
I’m favouring the first.
As for the naming of these tags, what sounds most idiomatic:
<r:if_children> and <r:unless_children>
<r:has_children> and <r:has_no_children>
<r:is_parent> and <r:is_childless>
I’m favouring the first.
So am I, as it resembles the other tags in the core. If you can get a
patch with thorough tests to me today via Trac, I can get it into 0.6.4.
Sean
Andrew N. wrote:
Currently, there is no tag equivalent to <r:has_child>, as far as I
know. There are tags <r:parent /> and <r:unless_parent />. If such a
tag was to be created, it would probably be useful to create its
opposite as well, e.g <r:has_no_child> or <r:childless>. (Any
thoughts as to how the pair of tags should be named?)
A while back I mocked up an extension that abstracted conditionals. I
like having a test for children as Andrew suggests but does anyone else
think it would be useful to have a general <r:if> radius tag so that
things like this could be added without cluttering up the number and
variety of default if_tags out there?
So instead of:
<r:if_parent>
<r:if_content>
<r:if_children>
<r:if_next_great_idea>
you’d have something like:
<r:if cond=“parent”> or, maybe <r:if cond=“page.parent exists?”>
<r:if cond=“parts”>
<r:if cond=“children”>
It’s not my suggested syntax that I’m so concerned about here as the
concept of keeping all the <r:if_stuff> code DRY and reducing the number
and complexity of all the different tags for the user. I’m guessing
that this won’t be the last conditional radiant adds.
Oh, and to answer your question Andrew. I think that existence-test
tags in radius are usually named like:
<r:if_children> and <r:unless_children> or,
<r:if_child> and <r:unless_child>
Of course you could also go with the King James Translation:
<r:if_withchild> and <r:if_barren>
-Chris
Chris P. said the following on 11/09/2007 11:42 AM:
things like this could be added without cluttering up the number and
<r:if cond=“parts”>
<r:if cond=“children”>
It’s not my suggested syntax that I’m so concerned about here as the
concept of keeping all the <r:if_stuff> code DRY and reducing the number
and complexity of all the different tags for the user. I’m guessing
that this won’t be the last conditional radiant adds.
Having a
<r:if … >
makes a lot of sense, not just from the POV of DRY, but as a good user
interface. You only have to learn one way of doing things.
However it needs to be implement COMPLETELY, that is it needs to be able
to
support the full range of conditionals and booleans.
At the risk of seeming heretical, the Wiki project ‘TWiki’ has this
feature
‘done right’, although its context is somewhat different. However the
<r:if (cond= and cond= ) or cond= >
type syntax would be great!
And why shouldn’t the conditional inspect the environment, for example,
to
determine if this is a http or https connection?
The idea of having a ruby expression in the conditional that returns
true or
false would make it very powerful at the cost of introducing a security
hazzard.
Oh and don’t forget the “else” !
http://twiki.org/cgi-bin/view/TWiki/IfStatements
/anton
Andrew,
The mailing list strips attachments. Please file a ticket on the Trac
at http://dev.radiantcms.org.
Sean
Check the backdoor extension at http://backdoor.rubyforge.org/ .
Also search this list for "backdoor" for discussions about what you
comment, current security issues with backdoor, alternatives, etc…
Regarding making Radiant "more programmable", my opinion is that the
way
to go is: proper ACL support + sandoxed-and-ACL-aware backdoor like
functionality + proper Radiant object model documentation.
/AITOR
Sean,
If you can get a patch with thorough tests to me today via Trac, I
can get it into 0.6.4.
Here it is. I went with <r:if_children> and <r:unless_children> in
the end. Let me know if you have any trouble with the patch.
Cheers,
Drew
I’ll have a go at creating the tags and tests myself. When done,
I’ll also update the howto page.
The tags <r:if_children/> and <r:unless_children/> are included in
the latest release of Radiant (0.6.4). Just to wrap up this thread, I
updated the how to: http://wiki.radiantcms.org/How_To_Make_a_Sitemap
Cheers,
A
The mailing list strips attachments. Please file a ticket on the Trac
Done: http://dev.radiantcms.org/radiant/attachment/ticket/575/
add_conditional_children_tags.diff