From cbbbab851de84dc2291cd3f81ffb45e284d3dd98 Mon Sep 17 00:00:00 2001 From: MikeMannix Date: Fri, 23 Nov 2001 11:33:33 +0000 Subject: none --- TWiki/TWikiVariablesExamples.mdwn | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 TWiki/TWikiVariablesExamples.mdwn (limited to 'TWiki/TWikiVariablesExamples.mdwn') diff --git a/TWiki/TWikiVariablesExamples.mdwn b/TWiki/TWikiVariablesExamples.mdwn new file mode 100644 index 00000000..7ffc8165 --- /dev/null +++ b/TWiki/TWikiVariablesExamples.mdwn @@ -0,0 +1,62 @@ +%TOC\{depth="4"\}% %STARTINCLUDE% + +# TWikiVariables Examples + +## Bullet list showing topic name and summary + +**Write this:** + +%SEARCH\{ "FAQ" scope="topic" web="TWiki" nosearch="on" nototal="on" header="   \* \*Topic: Summary:\*" format="   \* [[$web.$topic]]: $summary" \}% + +**To get this:** + +%SEARCH\{ "FAQ" scope="topic" web="TWiki" nosearch="on" nototal="on" header=" \* \*Topic: Summary:\*" format=" \* [[Webtopic]]: $summary" \}% + +## Table with form field values of topics with a form + +**Write this:** + +| \*Topic:\* | \*OperatingSystem:\* | \*OsVersion:\* |
%SEARCH\{ "[T]opicClassification.\*?value=\\"[P]ublicFAQ\\"" scope="text" regex="on" nosearch="on" nototal="on" format="| [[$topic]] | $formfield([[OperatingSystem]]) | $formfield([[OsVersion]]) |" \}% + +**To get this:** _(simulated)_ + + + + + + + + + + + + + + + + + +
Topic:OperatingSystem:OsVersion:
IncorrectDllVersionW32PTH10DLLOsWin 95/98
WinDoze95CrashOsWin 95
+ +## Extract text from a topic using regular expressions + +**Write this:** + +%SEARCH\{ "\_\_Back to\\:\_\_ TWikiFAQ" scope="text" web="TWiki" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format="   \* $pattern(.\*?FAQ\\:[\\n\\r]\*([^\\n\\r]+).\*) [[$web.$topic]\[Answer...]]" \}% + +**To get this:** + +%SEARCH\{ "\_\_Back to\\:\_\_ [[TWikiFAQ]]" scope="text" web="TWiki" regex="on" nosearch="on" nototal="on" header="TWiki FAQs:" format=" \* $pattern(.\*?FAQ\\:[\\n\\r]\*([^\\n\\r]+).\*) [[Webtopic]]" \}% + +## Creating Custom Variables + +* You can add your own preference variables for an entire site, a single web, or a single topic, using the standard syntax. Whatever you include in your variable will be expanded on display, and treated exactly as if it had been written out. So you can place formatted text, page links, image paths. + +> **Example: Create a custom logo variable** +> +>
+> +> * To place a logo anywhere in a web by typing **%MYLOGO%**, simply define the variable on the web's [[WebPreferences]] page. You also have to upload `logo.gif` - this can be done by [[FileAttachment]] to `LogoTopic` (any topic name you choose): +> * **Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif** + +-- [[Main/MikeMannix]] - 23 Nov 2001 -- cgit v1.2.3