[Zope] HTML anchor using DTML?

J Cameron Cooper jccooper@jcameroncooper.com
Tue, 08 Apr 2003 03:56:05 -0500


>
> For the above examples, there are 3 subheaders: 'Laboratory', 
> 'consultation' and 'onsite'
> If I click on the subheading, I want it to display immediately on top 
> of the page.
> I can use 'Anchor' if I use the HTML FRAME
>  
> But how to do this in DTML?

The short answer is "exactly like you do it in HTML". (Remember, DTML is 
for generating HTML.) Meaning it's an HTML question. I think.

If you simply want the page page to scroll such that the heading is at 
the top when you click on it, put a named anchor above the heading, and 
wrap the heading in a link anchor referring to the named anchor. 
Something like:

<a name="somewhere" />
<a href="#somewhere"><h1>Heading 1</h1></a>

If you want the heading to link to a page with only that heading's 
contents on it, it goes something like

#main page
<dtml-var header>
<dtml-var section1>
<dtml-var section2>
<dtml-var section3>
<dtml-var footer>

#section1
<a href="&dtml-id;"><h2>Section 1</h2></a>
...contents...

and so forth.

I suspect you were asking about the first scenario, though, which really 
isn't a Zope question at all.

                --jcc