[pmwiki-users] Page Variables help - how to take one and split into two

Eemeli Aro eemeli at gmail.com
Sun Nov 1 16:02:14 CST 2009


2009/11/1  <stevecrisp at gmail.com>:
> I'm trying create two page variables from a new markup I've created (ref
> GeoTagging recipe in development).  The markup is as follows and represents
> a comma separated latitude and longitude:
>
> (:coord 50.1234, -2.3456:)
>
> I'm trying (and failing) to take the value from coord and split it to store
> two page variable called Latitude and Longitude.  [...]

> If this can done in a one-liner that would be even better. e.g.:
>     $FmtPV['$Latitude'] = 'explode(',',$FmtPV['$Coord'])'[0];
>     $FmtPV['$Longitude'] = 'explode(',',$FmtPV['$Coord'])'[1];

Not sure, but these might work:

$FmtPV['$Latitude'] = 'trim(reset(explode(',', @$FmtPV["\$Coord"])))';
$FmtPV['$Longitude'] = 'trim(end(explode(',', @$FmtPV["\$Coord"])))';

2009/11/1 Hans <design5 at softflow.co.uk>:
> But why don't you use simple PageTextVariables, like
>
> (:latitude: 50.1234:)
> (:longitude: -1.23456:)
>
> and use {$:latitude} and {$:longitude} in your
> $FeedFmt['georss']['item'] array?
>
> Why do you want to use PageVariables?

I think it's due to the GeoRSS feed generation, which is done using
the default feeds.php, which passes stuff through FmtPageName to parse
page variables, which in turn won't parse page text variables. Of
course the data could be stored as PTVs, with some kind of parallel
interface for accessing their values via PVs, but that's liable to
cause about as much work and confusion as the current (:directive:)
method. This is guess, mind.

eemeli



More information about the pmwiki-users mailing list