[pmwiki-users] Is it possible to create and use page-scoped variables?
Patrick R. Michaud
pmichaud at pobox.com
Thu Apr 6 09:23:46 CDT 2006
On Thu, Apr 06, 2006 at 03:13:30PM +0100, Octocias wrote:
> Lets say I will refer to a particular URL many times in a wikiPage. If
> possible, I'd like to declare a variable at the start of the page with a
> string value equal to the URL. Subsequent to that, I can just use the
> variable. Also, if the url changes, I can just change the variable at the
> top of the page, rather than searching/replacing in the edit box.
Ah, these are what we've called "page properties" in the past.
In the past we've discussed the idea of having a (:property:)
markup -- i.e., something like:
(:property home http://www.example.com:)
which could then be later used in the markup as "{$home}" or
something equivalent.
Unfortunately, there's a bit of a chicken and egg problem that
hasn't been resolved yet, especially for conditionals and includes.
For example, some people want to be able to use a property in
a conditional:
(:property testing true:)
(:if {$testing}:)
some markup here for testing
(:if:)
This implies that the (:property:) and {$...} markups have to be
performed *before* conditional markup processing.
Other times, people would like to be able to set a property
inside a conditional:
(:if auth edit:)
(:property message "You don't have permission to edit":)
(:if:)
{$message}
This means that the (:property:) markup has to be performed
*after* conditional markup processing.
At the moment I don't have a good solution short of a major
redesign of PmWiki's internal rendering engine, so lacking
a good solution, I haven't implemented anything here yet.
For version 2.0 there was the Cookbook.Properties recipe, I
don't know if this recipe will still work under 2.1.
Pm
> On 06/04/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>
> On Thu, Apr 06, 2006 at 02:45:39PM +0100, Octocias wrote:
> > Is it possible to create and use wiki page-scoped variables?
>
> Depends on what you mean by "wiki page-scoped" variables.
> Can you give an example?
>
> Pm
>
> --
> Octocias
> http://www.octocias.com
More information about the pmwiki-users
mailing list