Forum OpenACS Q&A: Re: Can I pass arbitrary variables to xowiki pages in the url?

yes, one can pass parameters to includelet arguments, but only when no actual arguments are provided in the includelet specification. For example, consider a page containing two includelets:
{{recent -max_entries 5}}
The first includelet hat no actual arguments provided, the second one -max_entries 5. If one calls this page (the page with the two includelets) with a query-parameter ...?max_entries=2 then the value of 2 value is honored by the first includelet, but not by the second (idea: the hard-coded value in the page takes precedence over the query-parameter, which can be altered by the user.

Alternatively, one can as well provide a form-based interface to configure the includelets: Define a form with the content

{{recent -max_entries @nrEntries@}}
and the form constraints
When an instance of this form (a form page) is created, one can edit the value of nrEntries via the form. This value is passed as an argument of the includelet. One can certainly define as well other interactions, such as a pull down menu with predefined values, etc. by changing the form constraints.

-gustaf neumann


Thank you for the reply. I am a little confused though about this.

I have an ::xowiki::Form that has various fields for content to enable the creation of new FormPages that are automatically styled. One of the fields is an includelet specification field in which I am in this example putting the carousel includelet.

Instead of creating an instance of the FormPage with the folder that contains the images hard-coded into the includelet specification for every set of pictures, I would like to be able to provide the folder_id for the images to display from a value passed in the url.

Am I correct in understanding that I should create the minimal forms you describe above (which when allocated a category will naturally appear in the dropdown menu), and then include these forms in the page?

So essentially we would have a carousel embedded within a form, which itself is embedded in a form?


Ah! It's ok. I see. I had effectively already done this, and was getting confused by trying to re-use a single formpage. However, I was collecting the entire includelet spec in a formfield. I can't then reasonably expect to be able to substitute another @value@ into the result of an already substituted @formfield@! This would require nested substitutions within a single ::xowiki::Form!! :-O

If I put the fixed part of the includelet declaration into the ::xowiki::Form spec, then I see that I could add a hidden field to the form and pass in values using a query parameter in the url. The disadvantage with this is that then I would lose the ability to add SEO content to the resulting carousel page, which has other fields specifically for this purpose, and any case, to drive a menu you would have to have an instance of one form or the other for each folder of pictures.

I apologise that this may be a bit confusing to read, but I have posted it as a record for future reference.