[Zope-CMF] Insert path into a query URL?

Jon Edwards jon@pcgs.freeserve.co.uk
Mon, 1 Jul 2002 13:26:59 +0100


Thanks for the solution Dieter!

In case anyone is trying to do something similar (alphabetical links at top
of page, user clicks on a letter to get all the items in this folder, that
begin with that letter), I ended up doing it slightly differently -

- customised the "doFormSearch" script, renamed it "doLocalFormSearch" and
changed the last line to

   return context.portal_catalog( form_vars,
path='/'.join(context.getPhysicalPath()) )

- customised the "search" page to call "doLocalFormSearch" instead of
"doFormSearch", and renamed it to "localSearch"

- added links at the top of the page, one for each letter, like

   <a href="search"
   tal:attributes="href
string:${abs_url}/localSearch?Type=Link&amp;review_state=published&amp;title
=a*">A</a>&nbsp;|&nbsp;

There must be a way to get a PythonScript to generate all 26 alphabetical
links, but I haven't worked that one out yet! :-)

HTH

Cheers, Jon

> -----Original Message-----
> From: Dieter Maurer [mailto:dieter@handshake.de]
> Sent: 13 June 2002 19:58
> To: Jon Edwards
> Cc: Zope-Cmf
> Subject: Re: [Zope-CMF] Insert path into a query URL?
>
>
> Jon Edwards writes:
>  > ...
>  > I can work out the path by defining a variable, something like -
>  >
>  >    define = local_path python: '/'.join(here.getPhysicalPath())
>  >
>  > - in the page header, but is it possible to insert this in the
> URL query?
> Sure:
>
> 	tal:define="
> 	  std	modules/Products/PythonScripts/standard;
> 	  qp	nocall:std/url_quote_plus;
> 	  upath	python:qp(local_path);
> 	  "
>
> Now, "upath" contains "local_path" in a form that can be used as part
> of a query string:
>
>         tal:attributes="
> 	  href  string:...&path=${upath}...;
> 	  "
>
>
> Dieter
>