|
Cookbook /
StringReplaceSummary: link or form markup for replacing text strings in pages
Version: 2007-03-12
Prerequisites: pmwiki 2.2.0 beta
Status: beta
Maintainer:
Download: stringreplace.phpΔ
Categories: Editing
Questions answered by this recipeHow can I replace text strings, toggle page text variables? DescriptionDownload stringreplace.phpΔ, copy to cookbook folder and install in local configuration file with: include_once("$FarmD/cookbook/stringreplace.php");
This script enables replacing of strings in pages, by creating special replace links or input forms. Markup syntax for replace links: (:stringreplace str1="to be replaced" str2="replacement string":)
Optional parameters:
By default after replace one is redirected to TargetPage. By default replacing is enabled for current page only. $EnableStringReplaceTarget = 1;
Replacements can also be done with Input forms, using action stringreplace. ExamplesReplace toggle link for page text variable Var(:Var:0:) Page text variable {$:Var}
(:if eq {$:Var} 0:)(:stringreplace str1=":Var:0:" str2=":Var:1:" label="Toggle Var":)
(:if eq {$:Var} 1:)(:stringreplace str1=":Var:1:" str2=":Var:0:" label="Toggle Var":)
(:if:)
Dummy link: Toggle Var Input radio buttons to change page text var State(:State:1:)
'''state: {$:State}'''
(:input form "{$PageUrl}":)
(:input hidden action stringreplace:)
(:input hidden str1 ":State:{$:State}:":)
(:input radio str2 ":State:1:":) state 1 \\
(:input radio str2 ":State:2:":) state 2 \\
(:input radio str2 ":State:3:":) state 3 \\
(:input submit post Change:)
(:input end:)
Dummy form:
state: 1 Input text replace form for SideBar or RightBar(:input form "{*$PageUrl}":)(:input hidden action stringreplace:)
replace this\\
(:input text str1 "":)\\
with this\\
(:input text str2 "":)\\
(:input submit post Replace:)
(:input end:)
Dummy form: Notes
Release Notes
CommentsSee AlsoContributors |