Mohit Sindhwani wrote:
You could try this:
* Create each bio page separately as you suggested
* Create a special page part called 'anchor' in the bio page
You could then write a special tag that creates a link to that anchor
using r:children:each
and a special tag similar to r:content called r:content_anchor that
spits out the anchor in the HTML before doing the r:content for the
child page?
I hope I make sense.
Cheers,
Mohit.
3/17/2009 | 12:07 AM.
OK, I did this for you. I hope that these tags help you get started.
If you have a page part called 'anchor', then the first one renders the
link (for the table of contents) to an anchor within the same page.
The second one renders a heading for the actual item, creating the
anchor there. Names of anchors are specified in the 'anchor' page part
of the bio.
tag 'local:anchor_link' do |tag|
part = tag.locals.page.parts.find_by_name('anchor')
text = part.content
#"<a name=\"#{text}\"> </a>"
"<a href=\"##{text}\">#{tag.locals.page.title}</a>"
end
tag 'local:anchor_cover' do |tag|
part = tag.locals.page.parts.find_by_name('anchor')
title = tag.locals.page.title
text = part.content
"<a name=\"#{text}\">#{title}</a>"
end
In the page from which all bios are listed, you do this:
To create the table of contents:
h1. Bio
<r:children:each><r:if_content part="anchor">
* <r:local:anchor_link /></r:if_content></r:children:each>
The output for this is something like:
Bio
* Sienfeld (links to --> http://localhost:3700/bio#sienfeld)
* Jerry (links to --> http://localhost:3700/bio#jerry)
Further down, to create the list, you do:
h1. Details --
<r:children:each><r:if_content part="anchor">
* <r:local:anchor_cover /><r:link /></r:if_content></r:children:each>
This produces:
Details—
* Sienfeld Sienfeld (this has an anchor called #sienfeld)
* Jerry Jerry (this has an anchor called #jerry)
Hope this makes sense and does what you need.
Cheers,
Mohit.
3/17/2009 | 12:44 AM.
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant