On 2014-12-14 01:20, ki...@kirpi.it wrote:
If I set a PTV to a random value with {(randk)}[1], say
Random_string: {(randk 7)}
I then would like that specific PTV to retain its value.
Instead,
{$:Random_string}
gets every time a new random value.
I am perhaps just misunderstanding the way PTVs are working;
When you write into a page "{$:Random_string}", it will be replaced with
the wikitext content after the "Random_string:" definition, and
evaluated later. To PmWiki, it is the same if you paste more than once
"{$:Random_string}" or "{(randk 7)}". So the "{(randk 7)}" expression
will be evaluated every time.
nonetheless I am trying to find a way to "freeze" PTV random values
once they are set, in order to use them in pages and formulas.
This can be done with a custom page variable defined in config.php:
$FmtPV['$Randk7'] = 'randomkeys(7)'; # evaluated every time -OR-
$FmtPV['$Randk7'] = '"'. randomkeys(7) . '"'; # evaluated once and
freezed until the page is reloaded
Then in the wiki page use {$Randk7}.
(this uses the function suggested in the MarkupExpressionSamples page)
This is obviously not very handy if you need to have many different such
variables of different length in the pages. Do you need many lengths?
Petko
_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users