On 8/21/10 7:44 PM, Jim Gay wrote:
On Sat, Aug 21, 2010 at 1:33 PM, Wes Gamble<[email protected]> wrote:
On 8/20/10 5:04 PM, Wes Gamble wrote:
On 8/20/10 3:04 PM, Wes Gamble wrote:
All,
I have a page X, which has several children pages underneath it (say, 10).
Is there any relatively easy way to derive the index of a given child of X
in the list of children of X? So, for example, for the 3rd child, I need to
be able to get a 3 somehow in order to construct links.
I'm displaying children using<r:pagination> and I'm generating direct links
to the children. I'd like these direct links to reflect the pagination
within the context of the parent.
So, for example, I want a link to the 3rd page of X that looks just like the
link I get from paginating X, which is: /x/?page=3
I'm glad it's working for you. Before you send a pull request for a
new feature like that, you should get some feedback from this list
about whether or not it would be a valuable addition to the core.
Right off the bat, I'd argue that child_positon is not a good name for
the tag. I would assume from the name that it has to do with the
"position" column added by something like the reorder extension.
Inside our standard tags we loop through the list with an index
http://github.com/radiant/radiant/blob/master/app/models/standard_tags.rb#L119
I think a better approach would be to add something like
"children:each:index". But I'm not currently convinced this needs to
be in the core.
I'd love to hear other opinions on this.
-Jim
I just pushed <r:children:each:index/> to my radiant repo. if you're
interested: http://github.com/weyus/radiant
Wes