[Zope] context and URLs

Peter Bengtsson peter at fry-it.com
Tue Feb 14 18:43:12 EST 2006


On 2/14/06, Ole Johan Tennvassås <oj.tennvassaas at gmail.com> wrote:
> Thanks, it really helped (but the syntax seems to be <a tal:attributes="href
> string:${here/folderB/absolute_url}/ -  not the _path
> ending...

someobject/absolute_url returns "http://localhost:8080/somefolder/someobject"
someobject/absolute_url_path returns "/somefolder/someobject"
As far as a browser is concern there's absolutely no difference. The
advantage of absolute_url_path is less output in the HTML source and
that links still work as before if you change the domain and serve
cached or static content.


> Ole
>
>
> On 2/14/06, Peter Bengtsson <peter at fry-it.com> wrote:
> > This will work
> > <a tal:attributes="href
> >
> string:${here/folderB/absolute_url_path}/scriptobject?Parameter=$variable">Text</a>
> >
> >
> > On 2/13/06, Ole Johan Tennvassås < oj.tennvassaas at gmail.com> wrote:
> > > Sorry for late reply - have been away.
> > >
> > > Cant get this to work!  I hope I can avoid to use an absolute URL path.
> > > What i want is, as you say, to let the server generate as much of the
> URL as
> > > possible. To be more spesific, the zpt whith the calling href (located
> in
> > > "folderA") calls a script with a construct  like this:
> > > <a tal:attributes="href
> > >
> string:folderB/scriptobject?Parameter=$variable">Text</a>
> > > The effect of this is that Zope generates a link to the URL
> > >
> http://myserver/application/folderA/folderB/scriptobject?...
> > > and after this link is used to call the script in folderB, the script
> calls
> > > a zpt in folderA again.  Now, all links in this zpt gets /folderB added
> in
> > > their path! If you have some more tips about this, or could point me to
> some
> > > examples or documentation that could explain to me how this is supposed
> to
> > > work, it would be great!
> > >
> > > Regards
> > > Ole
> > > >Instead of writing links like this::
> > > >
> > > > <a href="folderB/object">object</a>
> > > >
> > > >write them like this::
> > > >
> > > > <a tal:attributes="href
> > > folderB/object/absolute_url_path">object</a>
> > >
> > > >
> > > >I know it's more typing but it will solve all your problems. I always
> > > >let the server have a part in generating URLs and I never suffer from
> > > >problems like this.
> > >
> > >
> >
> >
> > --
> > Peter Bengtsson,
> > work www.fry-it.com
> > home www.peterbe.com
> > hobby www.issuetrackerproduct.com
> >
>
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list