creating link to parent container.
I'm having trouble finding a way to make a link to a parent container. Something like this? <a href="#" tal:attribute="href python:container.getURL">Link</a> I can't seem to get this to work, and I'm sure there's a better way. John -
try out absolute_url() -aj --On Dienstag, 20. Mai 2003 23:46 Uhr -0400 John Kipling Lewis <jklewis@umich.edu> wrote:
I'm having trouble finding a way to make a link to a parent container.
Something like this?
<a href="#" tal:attribute="href python:container.getURL">Link</a>
I can't seem to get this to work, and I'm sure there's a better way.
John -
_______________________________________________ Zope maillist - Zope@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 )
That produced the entire url, but I want a link to the next higher container. For example if absolute_url returns: http://www.zope.com/animals/mammals/monkeys I want something that returns: http://www.zope.com/animals/mammals John - On Wed, 21 May 2003, Andreas Jung wrote:
try out absolute_url()
-aj
--On Dienstag, 20. Mai 2003 23:46 Uhr -0400 John Kipling Lewis <jklewis@umich.edu> wrote:
I'm having trouble finding a way to make a link to a parent container.
Something like this?
<a href="#" tal:attribute="href python:container.getURL">Link</a>
I can't seem to get this to work, and I'm sure there's a better way.
John -
_______________________________________________ Zope maillist - Zope@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 )
* John Kipling Lewis [05:46 21/05/03 CEST]: Hello,
I'm having trouble finding a way to make a link to a parent container.
Something like this?
<a href="#" tal:attribute="href python:container.getURL">Link</a>
<a href="#" tal:attributes="href container/absolute_url">Link</a> is a link to the container of the page template. If this page template is acquired as in : http://.../site/animals/dog/waf/showPhoto with showPhoto a pt residing in animals, this link will point to http://.../site/animals. If you want to point to http://.../waf you should use 'here/absolute_url'. HTH -- (°> Nicolas Évrard / ) Liège - Belgique ^^
On Wed, 21 May 2003, [iso-8859-1] Nicolas �vrard wrote:
is a link to the container of the page template. If this page template is acquired as in :
http://.../site/animals/dog/waf/showPhoto with showPhoto a pt residing in animals, this link will point to http://.../site/animals.
If you want to point to http://.../waf you should use 'here/absolute_url'.
I see the mistake I'm making now, we were looking at the index_html so my URL looked like: http://.../site/animals/dog/waf/ When I asked for "here/absolute_url" I got the same result. If I'm in "http://.../site/animals/dog/waf/", how do I return: http://.../site/animals/dog/ John -
* John Kipling Lewis [13:41 21/05/03 CEST]:
On Wed, 21 May 2003, [iso-8859-1] Nicolas Évrard wrote:
is a link to the container of the page template. If this page template is acquired as in :
http://.../site/animals/dog/waf/showPhoto with showPhoto a pt residing in animals, this link will point to http://.../site/animals.
If you want to point to http://.../waf you should use 'here/absolute_url'.
I see the mistake I'm making now, we were looking at the index_html so my URL looked like:
http://.../site/animals/dog/waf/
When I asked for "here/absolute_url" I got the same result.
If I'm in "http://.../site/animals/dog/waf/", how do I return:
Well this is a quick hack (I didn't test it) : In a pythonScript (parameter origin) : url = origin.split('/')[:-1] return '/'.join(url) and in your zpt : <a href="#" tal:attributes="href python:upscript(here.absolute_url())"> -- (°> Nicolas Évrard / ) Liège - Belgique ^^
On Wednesday 21 May à 14:15, Nicolas Évrard wrote:
* John Kipling Lewis [13:41 21/05/03 CEST]:
On Wed, 21 May 2003, [iso-8859-1] Nicolas Évrard wrote:
is a link to the container of the page template. If this page template is acquired as in :
http://.../site/animals/dog/waf/showPhoto with showPhoto a pt residing in animals, this link will point to http://.../site/animals.
If you want to point to http://.../waf you should use 'here/absolute_url'.
I see the mistake I'm making now, we were looking at the index_html so my URL looked like:
http://.../site/animals/dog/waf/
When I asked for "here/absolute_url" I got the same result.
If I'm in "http://.../site/animals/dog/waf/", how do I return:
Well this is a quick hack (I didn't test it) :
In a pythonScript (parameter origin) :
url = origin.split('/')[:-1] return '/'.join(url)
and in your zpt :
<a href="#" tal:attributes="href python:upscript(here.absolute_url())">
you could also simply use the aq_parent attribute : <a href="#" tal:attributes="href python:here.aq_parent.absolute_url()"> or <a href="#" tal:attributes="href here/aq_parent/absolute_url"> -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org
participants (4)
-
Andreas Jung -
John Kipling Lewis -
Nicolas Évrard -
Sylvain Thénault