[pmwiki-devel] New Recipe Code Problem: HTMLHeadFmt.
Hans
design5 at softflow.co.uk
Tue Nov 21 16:05:55 CST 2006
Monday, November 20, 2006, 8:40:15 PM, Craige wrote:
> If anybody wants though, take a look at these lines:
> /* PHP error here to look at:
> Warning: Cannot use a scalar value as an array in
> /homepages/20/d88928485/htdocs/theleederboard/pmwiki/cookbook/googlemaps.php
> on line 91
> */
> $ParsedArgs['location'] = array('lon' => $ll[0],
> 'lat' => $ll[1]);
> and tell my why I'm getting the error. I've never seen the error before
> in 3 years of working with PHP.
I just looked at your code from the previous post.
I think this error came because you defined ParseArgs twice, first you
gave it a string value, and then an array:
A) $ParsedArgs['location'] = str_replace('"', '',$params['location']);
B) $ParsedArgs['location'] = array( 'lon' => $ll[0], 'lat' => $ll[1] );
I suggest to add 'location' to the $GoogleMapDefaults array,
'location' => '',
then inside function GenerateMap do this:
function GenerateMap( $params ) {
global $GoogleMapDefaults, etc...;
$opt = array_merge($GoogleMapDefaults, ParseArgs($params));
and then work with $opt['location'], $opt['lon'], $opt['lat'] etc.
if($opt['location']) FindCoordsForLocation($opt['location']);
etc.
So in your wiki page markup you use:
(:map location="string...":) or (:map lon=.. lat=... width=..
height=...:)
just have all your parameter keys defined in $GoogleMapDefaults.
As to the ?HeadFmt problem: I would only use $HTMLHeaderFmt, and use
the $opt['lat'] and $opt['lon'] to create the correct javascript entry
to initialise the map.
Hope this helps a bit an dis not too confusing.
Hans
More information about the pmwiki-devel
mailing list