PmWiki | Cookbook / SetPageTextVariable (original) (raw)

Summary: Set PageTextVariables in config.php

Version: 1.1

Prerequisites: none

Status: obsolete

Maintainer:

This addon is obsolete - use https://www.pmwiki.org/wiki/PmWiki/PageTextVariables#default

Questions answered by this recipe

This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.

Description

Set a PageTextVariable in config.php

Currently you can read a PageTextVariable using the PageTextVar(). This recipe allows you to also set a PageTextVariable.

Syntax:

SetPageTextVariable($pagename, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mi>t</mi><mi>v</mi><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">ptv, </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8095em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">pt</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mpunct">,</span></span></span></span>val);

In the example above the $pagename variable would have a value like "Main.MyDataPage", the ptvwouldbethenameofaPageTextVariable,andptv would be the name of a PageTextVariable, and ptvwouldbethenameofaPageTextVariable,andval would be the value to set it to.

WARNING: If you change a PageTextVariable that is currently being viewed you should restart the page using the redirect function to the same page. For example, if you are viewing page "Main.MyDataPage" and your code sets PageTextVariables, at the very end of the code you would have the line Redirect("Main.MyDataPage");

Installing

Copy SetPageTextVariable.phpΔ to your cookbook directory

In your config.php enter:

include_once("cookbook/SetPageTextVariable .php");

or in your farmconfig.php enter:

include_once("$FarmD/cookbook/SetPageTextVariable .php");

Notes

Release Notes

Comments

See Also

Contributors

User notes : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.