[Zope] Generating links from a list
Andrew Sawyers
andrew at zope.com
Mon Jun 27 14:14:36 EDT 2005
One way would be:
<a href="" tal:attributes="href python:'some_string' + opt[0]">
Andrew
--
Zope Managed Hosting
Software Engineer
Zope Corporation
(540) 361-1700
> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On Behalf Of
> John Poltorak
> Sent: Monday, June 27, 2005 2:05 PM
> To: zope at zope.org
> Subject: Re: [Zope] Generating links from a list
>
> On Mon, Jun 27, 2005 at 10:03:08AM -0600, Nikko Wolf wrote:
> > John Poltorak wrote:
> >
> > > My links list consists of simple lines such as
> > >
> > > org-1,First link
> > > org-2,Second Link
> > > org-x,Another Link
> > >
> > > How do I prepend a hardcoded path to org-1 instead of what is getting
> > > generated?
> >
> > > I would like to see the link for org-1 being generated as
> > >
> > > http://www.mysite.org/links/org-1
> >
> > Check the "HREF" attribute of the links in the generated HTML, and see
> > what you are getting there; unrooted paths are appended (by the browser,
> > not Zope) to the directory component of the source URL.
> >
> > For example: <A HREF="org-2">Second Link</A>
> > in a page at: http://mysite.org/links/org-1
> > should equate to: http://mysite.org/links/org-2
> >
> > [If you're still having problems, be explicit on the HREF and the URL
> > you are seeing.]
> >
> >
> > And have you tried simply replacing "org-1" in the File with
> > "http://www.mysite.org/links/org-1" ?
>
> Just tried - and that does work, but the actual site will be changing
> before long.
>
>
> > Finally -- from the ZPT snippet, it looks like "links" is a File object,
> > yet you put it in the URL that you say you wish. It's *sometimes* not a
> > problem given Zope's sibling-acquisition when parsing paths, but could
> be.
>
>
> That's right 'links' simply contains a list of objects and descriptions as
> shown above. When a web page is displayed the objectname is prepended by
> the directory component. I assumed that Zope did that, but I guess I was
> wrong.
>
> What I really need is to change this line:-
>
> tal:attributes="href python:opt[0]"
>
> to something like:-
>
> tal:attributes="href '/mysite/links/' python:opt[0]
>
> but I can't figure out how to prepend python:opt[0] with '/mysite/links/'.
>
> Any hints?
>
>
> >
> > G'Luck
> > Nikko
> >
>
>
> --
> John
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list