[pmwiki-users] Extracting a value in an array of included variables

Kathryn Andersen kat_lists at katspace.homelinux.org
Thu Jan 14 18:19:50 CST 2010


On Mon, Jan 11, 2010 at 11:52:45PM +0100, Patrick Provinciael wrote:
> I was wondering if it is possible to include an array of variables and then to
> extract a certain variable. Example:
> 
> (:include group.pagename vararray="first, second, third":)
> 
> I know this should somehow be possible with string manipulation (I still have
> to figure out how). I'm wondering if it is possible in an easier way.
> 
> The reason I ask, is that I want a variable with a variable number of entries
> (which is not that easy with string manipulation, if at all possible).
> 
> To be more precise, what I want to be able to do on the included page is:
> 
> His relatives are: [[First]], [[Second]], [[Third]].
> 
> With other words, I want to be able to make a link of every relative (to that
> relative's page). For this I need to be able to extract the variables one by
> one.

The Tagger recipe may be what you need:
http://www.pmwiki.org/wiki/Cookbook/Tagger

With Tagger, you can go

(:Relatives: First, Second, Third:)

and then use variables to display with links:

His relatives are: {*$RelativesLinked}

which would give:

His relatives are: [[Relatives/First]], [[Relatives/Second]], [[Relatives/Third]]


(this is assuming that you configure it correctly to treat the
"Relatives" PTV as being associated with the "Relatives" group).
 
> With String Manipulation, I would just have to replace the separators ", " with
> "]], [[" and append a [[ and a ]]. But what if I want to be able to refer to
> the first in a separate way?

Tagger doesn't enable you to refer to the first in a separate way, I'm
afraid.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.org>
/      \    | 
\_.--.*/    | <http://kerravonsen.dreamwidth.org/>
      v     | <http://kerravonsen.redbubble.com/>
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe



More information about the pmwiki-users mailing list