genauso habe ich es bisher gemacht, nur wird es etwas
problematisch, wenn mehrere parameter zur liste hinzugefügt
werden müssen, denn die gesamte parameterliste ist
dynamisch.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
a)
$param = "foo=bar&bar=foo";
$param .= "&sid=$sid" if $sid && $param;
$param = "sid=$sid" if $sid && !$param;
$template->param(ARGV => $param);
<a href="foo.bar?<TMPL_VAR NAME="ARGV">">
b)
$template->param(ARGV => $param);
$template->param(SID = "sid=$sid");
<a href="foo.bar?<TMPL_IF NAME="ARGV"><TMPL_VAR NAME="ARGV"><TMPL_IF NAME="SID">&<TMPL_VAR NAME="SID"></TMPL_IF><TMPL_ELSE><TMPL_VAR NAME="SID"></TMPL_IF>">
c)
<a href="foo.bar?<TMPL_IF NAME="ARGV"><TMPL_VAR NAME="ARGV">&</TMPL_IF><TMPL_VAR NAME="SID">
An a) stört mich die Zuweisung ungemein.
An b) stören mich die vielen Template-Tags.
An c) stört mich das Trennzeichen & in der Liste, das erscheint, wenn die SID nicht gesetzt ist, also
http://website/foo.bar?foo=bar&
Oder bin ich einfach nur zu penibel? :)\n\n
<!--EDIT|opi|1136463525-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.