Forum Moderators: coopster

Message Too Old, No Replies

map appears twice

image appears twice

         

msarath

12:44 pm on May 5, 2005 (gmt 0)

10+ Year Member



Hi there

The school map for one school appears twice
[example.com...]

All other school maps are coming up perfectly which uses the same logic.

Can anyone of you suggest what could be the problem?

[example.com...]

Thanks in advance,
Sarath.

[edited by: jatar_k at 4:31 pm (utc) on May 5, 2005]
[edit reason] no urls thanks [/edit]

Blackie

1:19 pm on May 5, 2005 (gmt 0)

10+ Year Member



Should really see php code itself. URLs tells nothing

msarath

1:47 pm on May 5, 2005 (gmt 0)

10+ Year Member



Here is the code which displayes school map.

<?if($longitude && $latitude){?>
<tr>
<?
$mapfile = "school_maps/zoom5/" . $school_id . "_map.gif";
$scalefile = "school_maps/zoom5/" . $school_id . "_scale.gif";
$name = ucwords($name);
$altname = urlencode($name);
if(! file_exists($mapfile) &&! file_exists($scalefile)){
$mapurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif? off=streets,counties&on=cities,states,GRID& murl=http://tiger.census.gov/tigerwww/mission2& lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350&iwd=475&mark= $longitude,$latitude,redstar,$altname;");
//print $mapurl . "<br>";
$scaleurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif? legend=on&lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350&iwd=475& mark=$longitude,$latitude,redstar,$altname;");
$img=GrabImage($mapurl, $school_id . "_map");
$img=GrabImage($scaleurl, $school_id . "_scale");
}
?>
<td colspan=3 valign="center" align="middle"><img src="<?=$mapfile?>" alt="Map showing location of <?=$name?>" border="0"></td></tr>
<tr><td colspan=3><img src="scale.gif" alt="Map legend" border="0"></td></tr>
<?}?>

[edited by: jatar_k at 4:32 pm (utc) on May 5, 2005]
[edit reason] fixed sidescroll [/edit]

Stormfx

3:20 pm on May 5, 2005 (gmt 0)

10+ Year Member



Did you paste this code? If so, look at this line:

if(! file_exists($mapfile) &&! file_exists($scalefile)){

See the position of the two '!' characters? It should be:

if(!file_exists($mapfile) &&!file_exists($scalefile)){

Never put white space between the! operator and its comparison subject. :)

HTH

msarath

6:03 pm on May 5, 2005 (gmt 0)

10+ Year Member



Thanks for the reply. I have changed the code as you mentioned but same problem. I ma confused why the problem is only whith this school?
All other schools in the directory are displaying only one map which is supposed to be but for only this school the problem.

Here is the modified code

<?if(!file_exists($mapfile) &&!file_exists($scalefile)){?>
<tr><td class="header" colspan=3>School Map:<A name="schoolmap"></A></td></tr>
<tr>
<?
$mapfile = "school_maps/zoom5/" . $school_id . "_map.gif";
$scalefile = "school_maps/zoom5/" . $school_id . "_scale.gif";
$name = ucwords($name);
$altname = urlencode($name);
if(! file_exists($mapfile) &&! file_exists($scalefile)){
$mapurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif?off=streets,counties& on=cities,states,GRID&murl=http://tiger.census.gov/tigerwww/mission2& lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350&iwd=475& mark=$longitude,$latitude,redstar,$altname;");
//print $mapurl . "<br>";
$scaleurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif?legend=on& lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350& iwd=475&mark=$longitude,$latitude,redstar,$altname;");
$img=GrabImage($mapurl, $school_id . "_map");
$img=GrabImage($scaleurl, $school_id . "_scale");
}
?>
<td colspan=3 valign="center" align="middle"><img src="<?=$mapfile?>" alt="Map showing location of <?=$name?>" border="0"></td></tr>
<tr><td colspan=3><img src="scale.gif" alt="Map legend" border="0"></td></tr>
<?}?>

[edited by: jatar_k at 6:21 pm (utc) on May 5, 2005]
[edit reason] fixed url and sidescroll [/edit]

msarath

6:13 pm on May 5, 2005 (gmt 0)

10+ Year Member



my bad, actually the code I have written doesnot have any spaces. I am just copying the code over here but it's displaying spaces in between

Actually there is no space between! and file_exists in my code.

Anyone of you please suggest.

Blackie

7:20 am on May 6, 2005 (gmt 0)

10+ Year Member



I wonder why do you have two same lines in your code?

<?if(!file_exists($mapfile) &&!file_exists($scalefile)){?>

But that is not the answer to your question :-(
Could it be that you have two instances in your database just for that school?

msarath

10:24 am on May 6, 2005 (gmt 0)

10+ Year Member



I have checked in DB, there is only one record for this school. Also the school map contains one in maps folder. The code I have corrected, the first condition is latitude and londitude checking.

<?if($longitude && $latitude){?>
<tr><td class="header" colspan=3>School Map:<A name="schoolmap"></A></td></tr>
<tr>
<?
$mapfile = "school_maps/zoom5/" . $school_id . "_map.gif";
$scalefile = "school_maps/zoom5/" . $school_id . "_scale.gif";
$name = ucwords($name);
$altname = urlencode($name);
if(!file_exists($mapfile) &&!file_exists($scalefile)){
$mapurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif?off=streets,counties&on=cities,states,GRID&murl=http://tiger.census.gov/tigerwww/mission2&lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350&iwd=475&mark=$longitude,$latitude,redstar,$altname;");
//print $mapurl . "<br>";
$scaleurl = ("http://tiger.census.gov/cgi-bin/mapgen/.gif?legend=on&lat=$latitude&lon=$longitude&wid=$wid&ht=$ht&iht=350&iwd=475&mark=$longitude,$latitude,redstar,$altname;");
$img=GrabImage($mapurl, $school_id . "_map");
$img=GrabImage($scaleurl, $school_id . "_scale");
}
?>
<td colspan=3 valign="center" align="middle"><img src="<?=$mapfile?>" alt="Map showing location of <?=$name?>" border="0"></td></tr>
<tr><td colspan=3><img src="scale.gif" alt="Map legend" border="0"></td></tr>
<?}?>

msarath

2:52 pm on May 6, 2005 (gmt 0)

10+ Year Member




Ok, I am able to solve the problem. I added no-cache header and it is working fine. Also deleted and modified the map for this school.

Thanks for one and all for your time!