2008/9/12 Linly <[EMAIL PROTECTED]>:
>
> Ahha, I got it working too. Last time I forgot to look out google
> group had added the line break on a long line.
Hehehe, I did the same thing too, and it took be a good long while to
figure out why it wasn't working. After that it worked exactly as
expected... :)
> This snippet can set one value to multi pages. Is it possible to set
> different value to different pages at one click? I've test a while but
> no luck...
Try something like this:
[t width=100%]
[(search group=test template=check)]
[t]
/*
[[#check]]
[(template first)][form]
[(template each)][r][c]{+p}: [c][radio status_{(counter output=true)}
{+:author} checked={+:author}] {+:author} [c][radio status_{(counter
= output=true)} Alice] Alice [c][radio status_{(counter =
output=true)} Bob] Bob [c][radio status_{(counter = output=true)}
Cindy] Cindy
[session target_{(counter = output=true)} {+p}]
[session author_{(counter = output=true)} {+:author}]
[session if_{(counter = output=true)} "! equal '{=status_{(counter =
output=true)}}' '{=author_{(counter = output=true)}}' ?
author={=status_{(counter = output=true)}} , savedata_{(counter =
output=true)}=author"]
[session savedata_{(counter = output=true)}]
[(template last)][r][c][submit][form]
[[#end]]
*/
I notice the thing that makes this really cluttered is the {(counter)}
script. I just adding a shortcut like:
{ +1 } { = }, etc and have that automatically translate to {(counter
+1 output=true)}. Notice the spaces inside the braces, to avoid
conflicts.
Here's the rule I plan to add to the very end of the vars section (in
markups.php):
MarkUp('vars', 'counter', '/\{ (\+|\-|\=)?([-+0-9\/*. =]+)? \}/e',
'BOLTMfunc("counter $1 \"$2\" output=true", "$zone", "func")'); // {
= }
I also slightly tweaked the counter function to look like this:
function BOLTFcounter($args, $zone='') {
global $BOLTcounter;
if (isset($args['id'])) $id = $args['id'];
else $id = 0;
if (! $args[''][1] == '') $increment = $args[''][1];
else $increment = 1;
if (! isset($args[''][0])) $args[''][0] = '+';
if ($args[''][0] == '+') $BOLTcounter[$id] = $BOLTcounter[$id] +
$increment;
elseif ($args[''][0] == '-') $BOLTcounter[$id] = $BOLTcounter[$id] -
$increment;
elseif (is_numeric($args[''][0])) $BOLTcounter[$id] = $args[''][0];
elseif ($args[''][0] != '' && $args[''][0] != '=') {
$value = $args[''][0];
if (BOLTfilter($value, '-+0-9/*. ') != '')
eval("\$BOLTcounter[\$id]
= $value;");
}
if ($args['output'] == 'true') return trim($BOLTcounter[$id]);
}
Now { + } { = } { +2 } { + 2 } { 3 + 5 } { - 1 } { -1 } { -3 }
generates 1 1 3 5 8 7 6 3
And the template above now looks like:
[t width=100%]
[(search group=test template=check)]
[t]
/*
[[#check]]
[(template first)][form]
[(template each)][r][c]{+p}: [c][radio status_{ + } {+:author}
checked={+:author}] {+:author} [c][radio status_{ = } Alice] Alice
[c][radio status_{ = } Bob] Bob [c][radio status_{ = } Cindy] Cindy
[session target_{ = } {+p}]
[session author_{ = } {+:author}]
[session if_{ = } "! equal '{=status_{ = }}' '{=author_{ = }}' ?
author={=status_{ = }} , savedata_{ = }=author"]
[session savedata_{ = }]
[(template last)][r][c][submit][form]
[[#end]]
*/
Quite a bit easier on the eyes, no? All this will be in the next release...
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---