Hi guys, is it possible to get the URLPARAM of a topic in a formatted Search, is there a way like format="$urlparam(q)"?
Best regards, Matthias.
--
MatthiasFidorra1 - 14 Apr 2008
If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
Hm, doesn't
$percntURLPARAM{$quotp$quot}$percnt work for you?
--
FranzJosefGigler - 14 Apr 2008
Hello Franz,
I tried that already, but the response for that field is empty..
here's my search code:
%SEARCH{ "item" topic="itemTopic*" scope="text" regex="on" nosearch="on" excludetopic="Web*" nototal="on" expandvariables="on" format="| $percntURLPARAM{$quotq$quot}$percnt | blah | $topic |" }%
can't see what's wrong here..
When I try
$summary(showvarnames) I get a list of the definded variables, but I need them as single items..
--
MatthiasFidorra1 - 15 Apr 2008
sorry, the search code got lost.. once again:
%SEARCH{ "item" topic="itemTopic" scope="text" regex="on" nosearch="on" excludetopic="IpisEx*,Web*" nototal="on" expandvariables="on" format="| $percntURLPARAM{$quotq$quot}$percnt | | $topic |" }%
--
MatthiasFidorra1 - 15 Apr 2008
Aehm.. Beginners problems.. ok, now I omitted the percent signs of the search variable..
SEARCH{ "id_sm2_rna" topic="IpisProduct*VersionListVersNo*" scope="text" regex="on" nosearch="on" excludetopic="IpisEx*,Web*" nototal="on" expandvariables="on" format="| $percntURLPARAM{$quott$quot}$percnt | | $topic |" }
--
MatthiasFidorra1 - 15 Apr 2008
Hm, first: there is no parameter
regex, if your search term shall be a regex you need to specify
type="regex". In your case you could drop this parameter cause the default (
literal) should be enough. You can also drop parameter
scope as the default is already
text.
Second: If you specify the parameter
topic the parameter
excludetopic should be a subset to be of any value, otherwise drop one of them.
Third: Do you really want to
expandvariables ?
Can you please provide sample content in topic
IpisProduct0815VersionListVersNo4711? and explain what you want done with an potential
URLPARAM named
t cause I think I don't exactly understand what you are trying to do ?
Tip: You can use
<verbatim> and
</verbatim> to suppress execution of TWiki code.
--
FranzJosefGigler - 15 Apr 2008
Dear Franz,
I have a database where a user can enter items via a form definded on a topic. These items can have different versions and so each item links to a topic
(IpisProduct0815? for example) that has a button that creates a topic where a list of versions is listed and new versions can be created by creating a new subtopic. This leads to
IpisProduct0815VersionListVers4711.. I perform the search to get the form information on the topic
IpisProduct0815VersionListVers4711, but I also need some information from the
IpisProduct0815 topic. That is a parameter of the form defined on that topic and the name of that topic. I pass these parameters with the
URLPARAM variable. Here's the code I use to create the
IpisProduct0815VersionListCersNo4711:
<form name="%TOPIC%VersNoXXXXXXXXXX" action='%SCRIPTURLPATH{"edit"}%/%WEB%/'>
<input type="hidden" name="topic" value="%TOPIC%VersNoXXXXXXXXXX"/>
<input type="submit" class="twikiSubmit" value="Create New Version"/>
<input type="hidden" name="q" value="IpisProduct0" />
<input type="hidden" name="r" value="test prod 1" />
<input type="hidden" name="s" value="%TOPIC%" />
<input type="hidden" name="t" value="%FORMFIELD{"Product/Project Version"}%" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="topicparent" value="%TOPIC%"/>
<input type="hidden" name="templatetopic" value="IpisExProductIPVersionListTemplate"/>
<input type="hidden" name="formtemplate" value="IpisExProductVersionListForm"/>
</form>
But actually, could here be a problem, because when I try to get the
URLPARAM variable with the
%URLPARAM{"q"}% command directly on the
IpisProduct0815VersionListVersNo4711, the output is also blank. Why can't I access the
URLPARAM variable? It is working when I create the topic with the topictemplate and pass the
URLPARAM to that topic, as the
URLPARAM values show up on the definded topic with this template:
---++ %URLPARAM{"r"}% Version %FORMFIELD{"Product/Project Version"}%
%ICON{arrowbleft}% [[IpisExAllProjects][Product/Project List]]%BR%
%ICON{arrowbleft}% [[%URLPARAM{"q"}%][%URLPARAM{"r"}%]]%BR%
%ICON{arrowbleft}% [[%URLPARAM{"s"}%][%URLPARAM{"r"}% Version List]]
---+++ Version -> IP links
%TABLE{ sort="on" tableborder="0" cellpadding="1" cellspacing="1" headerbg="#D5CCB1" databg="#FAF0D4, #F3DFA8" headerrows="1" }%
| *IP-Name* | *Version* |** |
%SEARCH{ "IpisExIPtoLinkForm" topic="%TOPIC%*" scope="text" regex="on" nosearch="on" excludetopic="%TOPIC%, IpisEx*,Web*" nototal="on" format="| $formfield(IP-Block) | $formfield(Version) | [[$topic][details/edit]] |" }%
<form name="%TOPIC%IPlinkXXXXXXXXXX" action='%SCRIPTURLPATH{"edit"}%/%WEB%/'>
<input type="hidden" name="topic" value="%TOPIC%IPlinkXXXXXXXXXX"/>
<input type="submit" class="twikiSubmit" value="add IP" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="q" value="%TOPIC%" />
<input type="hidden" name="r" value="%URLPARAM{"q"}%" />
<input type="hidden" name="s" value="%URLPARAM{"r"}%" />
<input type="hidden" name="t" value="%URLPARAM{"t"}%" />
<input type="hidden" name="topicparent" value="%TOPIC%"/>
<input type="hidden" name="templatetopic" value="IpisExIPtoLinkTemplate" />
<input type="hidden" name="formtemplate" value="IpisExIPtoLinkForm" />
</form>
---+++ Version Info
</form> <form action="%SCRIPTURLPATH{"edit"}%/%WEB%/%TOPIC%">
<input type="submit" class="twikiSubmit" value="edit list" />
</form>
Do you have an explanation for this? Do I misunderstand the
URLPARAM variable?
--
MatthiasFidorra1 - 16 Apr 2008
Well, when you use
URLPARAM in a topic template it will be replaced by the value you hand over at topic creation. If you need the text
URLPARAM in your topic created on basis of that topic template you have to
NOP it.
I use (parameterized)
INCLUDE in topic templates for sections that contain
URLPARAM functions. This has several advantages: first I don't need to
NOP the
URLPARAM in the included topic, second it's much easier to put functional topic enhancements into a set of topics.
URLPARAM needs the parameter set via the URL:
<a href='%SCRIPTURL{"view"}%/%WEB%/%TOPIC%?q=q&r=q&s=r&t=t'>link</a>
will expand to
link
(click the link and see how the values below change to uppercase).
The values of the individual parameters are:
- %URLPARAM{"q"}% = q
- %URLPARAM{"r"}% = q
- %URLPARAM{"s"}% = r
- %URLPARAM{"t"}% = t
Tip: You can specify a default value for parameters that aren't always set.
Hope that helps somehow.
--
FranzJosefGigler - 16 Apr 2008
Closing this question after more than 30 days of inactivity. Feel free to re-open if needed.
--
PeterThoeny - 03 Jun 2008