Последние изменения - Поиск:

Новости
Хроника

2017-98-08-Deb:

2017-05-03-11-24-57:

2011-10-02:

2011-08-27:

2011-05-30:

2011-05-28:

2011-04-16:

2011-01-22:

2010-12-03-13-04-04:

2010-09-24:

2010-01-08:

2009-11-16:

2009-09-xx:

2008-01-25:

2007-09-28:

2007-04-21:

2007-04-13:

2006-12-01:

2006-09-22:

2006-09-06:

2006-04-20:

2006-03-XX:

2006-01-XX:

2006-01-28-04-57-02:

2005-09-23:

2005-08-12:

2005-01-24:

2004-09-24:

2004-05-13:

2003-12-08:

2003-04-04:

2002-02-22:

2002-01-25:

Архив


Старый сайт External Link to http://gaish78.narod.ru/
Хочу жить вечно External Link to http://virtualphotoalbum.tau-site.ru/2009_FFMeeting/index.htm

OtherVariables

$FmtV
This variable is an array that is used for string substitutions at the end of a call to FmtPageName(). For each element in the array, the "key" (interpreted as a string) will be replaced by the corresponding "value". The variable is intended to be a place to store substitution variables that have frequently changing values (thus avoiding a rebuild of the variable cache making FmtPageName() faster). Also see $FmtP. Values of $FmtV are set by the internal functions FormatTableRow, LinkIMap, HandleBrowse, PreviewPage, HandleEdit, PmWikiAuth, and PasswdVar, apparently to set values for system generated string substitutions like PageText.

$FmtP
This variable is an array that is used for pattern substitutions near the beginning of a call to FmtPageName. For each element in the array, the "key" (interpreted as a pattern) will be replaced by the corresponding value evaluated for the name of the current page. This is for instance used to handle $-substitutions that depend on the pagename passed to FmtPageName(). Also see $FmtV. From robots.php: If $EnableRobotCloakActions is set, then a pattern is added to $FmtP to hide any "?action=" url parameters in page urls generated by PmWiki for actions that robots aren't allowed to access. This can greatly reduce the load on the server by not providing the robot with links to pages that it will be forbidden to index anyway.

$FmtPV
This variable is an array that is used for defining Page Variables. New variables can be defined with $FmtPV['$VarName'] = 'variable definition'; which can be used in markup with {$VarName}. Please note that the contents of $FmtPV['$VarName'] are eval()ed to produce the final text for $VarName, so the contents must be a PHP expression which is valid at the time of substitution. In particular, this does not work:
#This doesn't work
$FmtPV['$MyText'] = "This is my text."; # WARNING: Doesn't work!
The problem is that the text This is my text. is not a valid PHP expression. To work it would need to be placed in quotes, so that what actually gets stored in $FmtPV['$MyText'] is "This is my text." which is a valid PHP expression for a text string. Thus the correct way to do this would be with an extra set of quotes:
#This will work
$FmtPV['$MyText'] = '"This is my text."';
This also has implications for how internal PHP or PmWiki variables are accessed. To have the page variable $MyVar produce the contents of the internal variable $myvar, many folks try the following which does not work:
#This doesn't work either!
$myvar = SomeComplexFunction();
$FmtPV['$MyVar'] = $myvar; # WARNING: Doesn't work!
There are several correct ways to do this, depending on whether you need the value of the $myvar variable as it was at the time the $FmtPV entry was created, or at the time that a particular instance of $MyVar is being rendered on a page. For most simple page variables that don't change during the processing of a page its more efficient to set the value when the entry is created:
$myvar = SomeComplexFunction();
$FmtPV['$MyVar'] = "'" . $myvar . "'"; #capture contents of $myvar
NOTE: If $myvar should contain single quotes, the above won't work as is, and you'll need to process the variable to escape any internal quotes.
For more complex cases where an internal variable may have different values at different places in the page (possibly due to the effects of other markup), then you need to make the $FmtPV entry make an explicit reference to the global value of the variable (and the variable had better be global) like this:
global $myvar;
$FmtPV['$MyVar'] = '$GLOBALS["myvar"]';
Finally, there's nothing to stop you from simply having the evaluation of the $FmtPV entry execute a function to determine the replacement text:
# add page variable {$Today}, formats today's date as yyyy-mm-dd
$FmtPV['$Today'] = 'strftime("%Y-%m-%d", time() )';
See Cookbook:MoreCustomPageVariables External Link to http://www.pmwiki.org/wiki/Cookbook/MoreCustomPageVariables for more examples of how to use $FmtPV.
$MaxPageTextVars
This variable prevents endless loops in accidental recursive PageTextVariables which could lock down a server. Default is 500 which means that each PageTextVariable from one page can be displayed up to 500 times in one wiki page.


This page may have a more recent version on pmwiki.org External Link to http://www.pmwiki.org: PmWiki:OtherVariables External Link to http://www.pmwiki.org/wiki/PmWiki/OtherVariables, and a talk page: PmWiki:OtherVariables-Talk External Link to http://www.pmwiki.org/wiki/PmWiki/OtherVariables-Talk.

Править - История - Печать - Последние изменения - Поиск
Редакция от 10.09.2011 20:08