List Info

Thread: Access to the query part of the URL




Access to the query part of the URL
user name
2006-03-02 21:57:30
(Sorry if this is a Cocoon Q. really, but I am working in
Forrest and 
similar issues arise here from time to time)

I can happily skin the output of php scripts using
redirect-to, the 
FileGenerator etc. as suggested in the Cocoon documentation
and at 
various times on this list. That works just fine for me.
Unfortunately, 
some of the php scripts I want to use like this take query
parts in the 
URL to set parameters. I can't see how to get hold of those
in a matcher 
or selector. I can catch
"this/that/theother.php" and skin it, but how 
do I get hold of the parameter from
"this/that/theother.php?var=42" to 
feed that to the FileGenerator?

Help appreciated.

Nigel

-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%lt%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
Nigel Hardy     Tel: +44 1970 622 434.   http://users.aber.ac.uk/
nwh/
Dept. Computer Sci,  University of Wales, Aberystwyth, SY23
3DB, UK
Adran Cyfrifiadureg, Prifysgol Cymru,     Aberystwyth, SY23
3DB, UK

Access to the query part of the URL
user name
2006-03-02 23:08:34
On 3/2/06, Nigel Hardy <nwhaber.ac.uk> wrote:
> (Sorry if this is a Cocoon Q. really, but I am working
in Forrest and
> similar issues arise here from time to time)
>
> I can happily skin the output of php scripts using
redirect-to, the
> FileGenerator etc. as suggested in the Cocoon
documentation and at
> various times on this list. That works just fine for
me. Unfortunately,
> some of the php scripts I want to use like this take
query parts in the
> URL to set parameters. I can't see how to get hold of
those in a matcher
> or selector. I can catch
"this/that/theother.php" and skin it, but how
> do I get hold of the parameter from
"this/that/theother.php?var=42" to
> feed that to the FileGenerator?
>
> Help appreciated.
>
> Nigel

Hi Nigel,
I was thinking there was a better page than this but if you
scroll
down this page and look for RequestParameterModule it should
do what
you need.

http://cocoon.apache.org/2.1/userdocs/concepts/mo
dules-ref.html

In forrest, I think it's prefix is just like that example
so it would
be something like: {request-param:var} to get
"42" in your url above.

--tim
Access to the query part of the URL
user name
2006-03-02 23:06:38
Nigel Hardy wrote:
> (Sorry if this is a Cocoon Q. really, but I am working
in Forrest and 
> similar issues arise here from time to time)
> 
> I can happily skin the output of php scripts using
redirect-to, the 
> FileGenerator etc. as suggested in the Cocoon
documentation and at 
> various times on this list. That works just fine for
me. Unfortunately, 
> some of the php scripts I want to use like this take
query parts in the 
> URL to set parameters. I can't see how to get hold of
those in a matcher 
> or selector. I can catch
"this/that/theother.php" and skin it, but how 
> do I get hold of the parameter from
"this/that/theother.php?var=42" to 
> feed that to the FileGenerator?
> 
> Help appreciated.

If you are planning on using Forrest to generate static
content from 
these PHP scripts I'm afraid you can't. The problem is
that '?' is not a 
valid character in filenames. Cocoon therefore rewrites such
URLs with 
an '_', which then breaks any static links to that page.

If you intend to use Forrest in dynamic mode then you have
no problem.

How? Well, as you say this is a Cocoon question, so best
place to look 
is the Cocoon docs. See below for some starting options.
Which is right 
for you depends on your use case, but given your question I
think the 
RequestModule is what you need. Basically, just do
{request:PARAM-NAME}:

One of the RequestModules [1]

The request selector [2]

The request generator [3]

Ross

[1] http://cocoon.apache.org/2.1/userdocs/concepts/mo
dules-ref.html

[2] http://cocoon.apache.org/2.1/userdocs/reques
tparameter-selector.html

[3] http://cocoon.apache.org/2.1/userdocs/request-genera
tor.html
Access to the query part of the URL
user name
2006-03-03 16:55:11
Nigel Hardy wrote:

> I can happily skin the output of php scripts using
redirect-to, the 
> FileGenerator etc. as suggested in the Cocoon
documentation and at 
> various times on this list. That works just fine for
me. 
> Unfortunately, some of the php scripts I want to use
like this take 
> query parts in the URL to set parameters. I can't see
how to get hold 
> of those in a matcher or selector. I can catch 
> "this/that/theother.php" and skin it, but
how do I get hold of the 
> parameter from
"this/that/theother.php?var=42" to feed that to
the 
> FileGenerator?

Thank you for the quick and informative replies. I think
they can be 
summed up as simple redirection is not possible because the
query parts 
get disassembled. I would need to re-build a new URL if the
original has 
an unknown list of parameters. The mechanisms work on known
parameters.

Thanks.

Nigel

-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%lt%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
Nigel Hardy     Tel: +44 1970 622 434.   http://users.aber.ac.uk/
nwh/
Dept. Computer Sci,  University of Wales, Aberystwyth, SY23
3DB, UK
Adran Cyfrifiadureg, Prifysgol Cymru,     Aberystwyth, SY23
3DB, UK

Access to the query part of the URL
user name
2006-03-03 17:10:58
Nigel Hardy wrote:
> Nigel Hardy wrote:
> 
>> I can happily skin the output of php scripts using
redirect-to, the 
>> FileGenerator etc. as suggested in the Cocoon
documentation and at 
>> various times on this list. That works just fine
for me. 
>> Unfortunately, some of the php scripts I want to
use like this take 
>> query parts in the URL to set parameters. I can't
see how to get hold 
>> of those in a matcher or selector. I can catch 
>> "this/that/theother.php" and skin it,
but how do I get hold of the 
>> parameter from
"this/that/theother.php?var=42" to feed that to
the 
>> FileGenerator?
> 
> 
> Thank you for the quick and informative replies. I
think they can be 
> summed up as simple redirection is not possible because
the query parts 
> get disassembled. I would need to re-build a new URL if
the original has 
> an unknown list of parameters. The mechanisms work on
known parameters.

I still don't understand your use case since you have not
described it. 
It is therefore difficult to give accurate information.
However, if you 
have an unknown list of parameters then you probably want
the 
RequestGenerator. This will create an XML document from any
query data. 
You can then use that in a pipeline and processes it like
any other 
document.

I linked to the RequestGenereator in my original reply.

What confuses me is how you intend to make use of an unknown
set of 
parameters.

Ross
Access to the query part of the URL
user name
2006-03-03 17:08:37
On 3/3/06, Nigel Hardy <nwhaber.ac.uk> wrote:
> Nigel Hardy wrote:
>
> > I can happily skin the output of php scripts using
redirect-to, the
> > FileGenerator etc. as suggested in the Cocoon
documentation and at
> > various times on this list. That works just fine
for me.
> > Unfortunately, some of the php scripts I want to
use like this take
> > query parts in the URL to set parameters. I can't
see how to get hold
> > of those in a matcher or selector. I can catch
> > "this/that/theother.php" and skin it,
but how do I get hold of the
> > parameter from
"this/that/theother.php?var=42" to feed that to
the
> > FileGenerator?
>
> Thank you for the quick and informative replies. I
think they can be
> summed up as simple redirection is not possible because
the query parts
> get disassembled. I would need to re-build a new URL if
the original has
> an unknown list of parameters. The mechanisms work on
known parameters.
>
> Thanks.
>
> Nigel

I think that's a hasty summation;)  Take a look:
http://wik
i.apache.org/cocoon/InputModules

Look for "RequestModule (JXPath)", specifically,
the queryString
property.  It'll let you pass it along in full:
{request:queryString}

--tim
Access to the query part of the URL
user name
2006-03-04 14:25:40
Tim Williams wrote:

>On 3/3/06, Nigel Hardy <nwhaber.ac.uk> wrote:
>  
>
>>Nigel Hardy wrote:
>>
>>    
>>
>>>I can happily skin the output of php scripts
using redirect-to, the
>>>FileGenerator etc. as suggested in the Cocoon
documentation and at
>>>various times on this list. That works just fine
for me.
>>>Unfortunately, some of the php scripts I want to
use like this take
>>>query parts in the URL to set parameters. I
can't see how to get hold
>>>of those in a matcher or selector. I can catch
>>>"this/that/theother.php" and skin
it, but how do I get hold of the
>>>parameter from
"this/that/theother.php?var=42" to feed that to
the
>>>FileGenerator?
>>>      
>>>
>>Thank you for the quick and informative replies. I
think they can be
>>summed up as simple redirection is not possible
because the query parts
>>get disassembled. I would need to re-build a new URL
if the original has
>>an unknown list of parameters. The mechanisms work
on known parameters.
>>
>>Thanks.
>>
>>Nigel
>>    
>>
>
>I think that's a hasty summation;)  Take a look:
>http://wik
i.apache.org/cocoon/InputModules
>
>Look for "RequestModule (JXPath)",
specifically, the queryString
>property.  It'll let you pass it along in full:
{request:queryString}
>  
>
That is what I was looking for!

Sorry if my question was not sufficiently clear. With Tim's
call I now 
have a general plugin which will let me skin the output of
php scripts 
but, should those scripts themselves produce links to
scripts with query 
strings, then the subsequent "parameterised
call" is also skinned. My 
application is a set of prototype database interface scripts
which is 
becoming unwieldy to manage as a set. Forrest will allow me
to quickly 
provide a navigation front end which, conveniently, can be
part of a 
pre-existing project site generated by Forrest.

Nigel

p.s. Well, I will have such a plugin when I have done the
fleshing out.

-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%lt%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%
Nigel Hardy     Tel: +44 1970 622 434.   http://users.aber.ac.uk/
nwh/
Dept. Computer Sci,  University of Wales, Aberystwyth, SY23
3DB, UK
Adran Cyfrifiadureg, Prifysgol Cymru,     Aberystwyth, SY23
3DB, UK

Access to the query part of the URL
user name
2006-03-06 10:00:52
Nigel Hardy wrote:
> Tim Williams wrote:

...

>> Look for "RequestModule (JXPath)",
specifically, the queryString
>> property.  It'll let you pass it along in full:
{request:queryString}
>>  
>>
> That is what I was looking for!
> 
> Sorry if my question was not sufficiently clear. 

It was clear enough for Tim 

> With Tim's call I now 
> have a general plugin which will let me skin the output
of php scripts 
> but, should those scripts themselves produce links to
scripts with query 
> strings, then the subsequent "parameterised
call" is also skinned. 


Great!

Any chance of packaging this as a plugin and contributing it
to the 
project? We already have a PHP plugin in whiteboard, it
would be great 
to compare your solution with that plugin and cherry pick
the best from 
both.

Even better if you could bring the two together before you
contribute 
your code. Don't worry if you don't have the time to
polish it, there 
are others using Forrest + PHP, they may have the time to
help out. If 
not, ou don't lose anything.

If you are able to do this please attach it to an issue in
Jira.

Ross
[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )