okay, so i’m using phoogle. if anyone doesn’t know what it is, you can find it here: [url]http://www.systemsevendesigns.com/phoogle
i need to set the width of my map to 85%. but i also need to pull the address, city, state, venue from a variable.
this example works but in here i have written in the address:
[code=php]<?
$map->addAddress(‘615 E Washington Street, Louisville, KY’,’Sleep Chamber’);
$map->setWidth(‘85%’);
$map->setHeight(200);
$map->showMap();
?>
But this one doesn’t! This bottom one works when i change the width to 300, or any number, but as a percent it doesn’t work!
[code=php]<?
$map->addAddress(stripslashes($address).’ ‘.$city.’ ‘.$state, stripslashes($venue));
$map->setWidth(‘85%’);
$map->setHeight(200);
$map->showMap();
?>
does anybody have any idea why?
Thanks in advance!
-sheep
[code=php]
$map->addAddress(stripslashes($address).', '.$city.', '.$state, stripslashes($venue));
[/code]
[code=php]<?
$map->addAddress('615 E Washington Street, Louisville, KY','Sleep Chamber');
$map->setWidth('85%');
$map->setHeight(200);
$map->showMap();
?>[/code]
is the same as this:[code=php]
$address = "615 E Washington Street";
$city = "Louisville";
$state = "KY";
$venue = "Sleep Chamber";
$map->addAddress(stripslashes($address) . ', ' . $city . ', ' . $state, stripslashes($venue));
?>[/code]
Try doing the following right before calling the map function:[code=php]
echo "<hr>";
echo stripslashes($address) . ', ' . $city . ', ' . $state;
echo "<br>";
echo stripslashes($venue);
echo "<hr>";
[/code]
[code=php]<div id="map" style="width: 85%px; height: 200px">[/code]
In other words, the "px" seems to be hardcoded into the class, which, of course, when used with your % doesn't add up to anything useful and the <div> can't/won't display.[code=php]$map->setWidth('85%;padding-left:0');[/code]
.Better would be to compute the 85% yourself and then pass the desired number of pixels in SetWidth.[code=php]<?
$thisADDRESS = $address . ', ' . $city . ', ' . $state;
$thisVENUE = $venue;
$thisWIDTH = intval(300 * .85);
$map->addAddress($thisADDRESS, $thisVENUE);
$map->setWidth($thisWIDTH);
$map->setHeight(200);
$map->showMap();
?>[/code]
[code=php] <?
$map->addAddress(stripslashes($address) . ", " . $city . ", " . $state, stripslashes($venue));
$map->setWidth(intval(300*.85));
$map->setHeight(200);
$map->showMap();
?>[/code]
So far, not too many differences. The one difference - one that could be a major one - is that, since I don't have a form to post from, I used this at the top of the script:[code=php]$venue = "Sleep Chamber";
$address = "615 E Washington Street";
$city = "Louisville";
$state = "KY";[/code]
to simulate user input.[code=php] echo "n<div id="map" width="".$this->mapWidth."" style="height: ".$this->mapHeight."px">n</div>n";[/code]
[code=html]<div id="map" width="85%" style="height: 200px">[/code]
[code=html]<div id="map" width="85%" style="height: 200px">[/code]
[code=php]<?
$address = "615 E Washington Street";
$city = "Louisville";
$state = "KY";
$venue = "Sleep Chamber";
$map->addAddress(stripslashes($address) . ", " . $city . ", " . $state, stripslashes($venue));
$map->setWidth('85%');
$map->setHeight(200);
$map->showMap();
?>[/code]
thanks for all your help nightshift![/QUOTE]You're welcome. I think I'm going to look at this map stuff. Never did it before, but I think it's pretty cool.
0.1.9 — BETA 5.21