how can I hardwire a link to a folder or a file in Zope? I'm trying to create a navbar method (?) and include it on all pages on different levels of the site. The relative location of the link of course would be changing throughout the site ... but I'd like Zope to do the work here ... Tried it like this <a href:"<dtml-var myfolder>"> myfolder</a> but it did not work ... thnxx 'K:)
how can I hardwire a link to a folder or a file in Zope? I'm trying to create a navbar method (?) and include it on all pages on different levels of the site. The relative location of the link of course would be changing throughout the site ... but I'd like Zope to do the work here ...
Tried it like this <a href:"<dtml-var myfolder>"> myfolder</a> but it did not work ...
Objects have an absolute_url method that will give their full URL. <dtml-var "someobject.absolute_url()"> or <dtml-with someobject><dtml-var absolute_url></dtml-with> or (better) <a href="" tal:attributes="href context/someobject/absolute_url">link text</a> or (Python script) here.someobject.absolute_url() --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
on 08.10.2003 19:38 Uhr, J. Cameron Cooper at jccooper@jcameroncooper.com wrote:
how can I hardwire a link to a folder or a file in Zope? I'm trying to create a navbar method (?) and include it on all pages on different levels of the site. The relative location of the link of course would be changing throughout the site ... but I'd like Zope to do the work here ...
Tried it like this <a href:"<dtml-var myfolder>"> myfolder</a> but it did not work ...
Objects have an absolute_url method that will give their full URL.
<dtml-var "someobject.absolute_url()">
this does work if someobject is in the same folder as the actual page. But if I use it one level above the current directory I get an error: An error was encountered while publishing this resource. Error Type: NameError Error Value: global name 'someobject' is not defined ----- the structure is like this: -index -works/ someobject mypage ----- if I reference from mypage to someobject it works. If I reference from index to someobject it doesn't ... 'K:?
Hello Kai,
Objects have an absolute_url method that will give their full URL.
<dtml-var "someobject.absolute_url()">
this does work if someobject is in the same folder as the actual page. But if I use it one level above the current directory I get an error:
of course! Put your application in it's own folder. Don't use Zope's root folder for any of your objects. Then use the full path to the object like <dtml "project.subfolder.subsubfolder.someobject.absolute_url()"> Hope it helps Ulrich
on 08.10.2003 23:13 Uhr, Ulrich Wisser at liste@publisher.de wrote:
Hello Kai,
Objects have an absolute_url method that will give their full URL.
<dtml-var "someobject.absolute_url()">
this does work if someobject is in the same folder as the actual page. But if I use it one level above the current directory I get an error:
of course! Put your application in it's own folder. Don't use Zope's root folder for any of your objects. Then use the full path to the object like
<dtml "project.subfolder.subsubfolder.someobject.absolute_url()">
Hope it helps
Ulrich
I'm sorry .... seems as I only can create folders inside the root folder ... And do objects have unique id's? If so isn't each object identifiable by this id alone? Doesn't Zope know where everything is? If so I could move objects around without breaking the links pointing to them ... 'K:?
_______________________________________________ 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 )
-- Kai Vermehr | eBoy http://www.eboy.com
On Wed, 2003-10-08 at 15:30, Kai Vermehr wrote:
I'm sorry .... seems as I only can create folders inside the root folder ...
And inside other Folders and folderish objects, hopefully.
And do objects have unique id's?
Within each Folder, yes. Globally, no.
If so isn't each object identifiable by this id alone?
Not in the sense I think you mean. On the other hand, any object may be called by name at any point in the hierarchy at or below where it is defined *if* it is the only object with that name in the hierarchy. This object can also be selectively overridden by placing a same-named object at any point in the hierarchy where you want a different result to apply.
Doesn't Zope know where everything is?
Not in the way I think you mean. A better way to put it is that Zope determines whether there is a publishable object/method that can be reached from the location a user specifies in their request.
If so I could move objects around without breaking the links pointing to them ...
If you moved them up, probably... if you moved them sideways or down, probably not. In order to get anywhere with Zope, it is *essential* to understand a key concept called Acquisition. An excellent intro to Acquisition is here: http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/Acquisition.stx Rule of thumb: put heavily-used objects at the *highest* point in the hierarchy over which they apply and use folders primarily to enforce differing levels of privilege/access. HTH, Dylan
participants (4)
-
Dylan Reinhardt -
J. Cameron Cooper -
Kai Vermehr -
Ulrich Wisser