Redtie

Redtie

beta
www.redtie.ro

Creative coding...


Page Not Found Error

30-03-2009 by webified
When using the Search function, I receive a "Page Not Found" error for the city that I typed in. If there is more than one city available, then the links to those cities also result in the same error. You can see a live example at http://navajotimes.com/wxtest/index.php This is the original unaltered script provided by redtie. Here are steps I took to make the script work on the server: 1. Modified config.php to include weather.com license key and partner ID. Also changed the default city. 2. Added three subdirectories to the "cache" directory. They are: cc, dayf and search. 3. CHMOD'd parser, cache, cc, dayf, and search to 777. I am really stuck. Hope you can help! Thanks.

6 Replies

31-03-2009 by webified
I believe the bad code is in functions.php starting at about line 43:
if($n == 1){ $explode = explode(",",$r[city][0]); $r[city][0] = $explode[0]; ?> <script type="text/javascript"> <!-- window.location = ">? echo $http."/".str_replace(" ","-",strtolower($r[city][0]))."/".$r[loc_id][0]; ?>" //--> </script> <? }elseif($n > 1){ for($i=0;$i<$n;$i++){ $explode = explode(",",$r[city][$i]); $city[$i] = $explode[0]; $url = str_replace("index.php",str_replace(" ","-",strtolower($city[$i]))."/".$r[loc_id][$i],"http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); ?> <li><a href="<? echo $url; ?>"<>? echo $r[city][$i]; ?></a></li> <? } }else{ ?> <? } ?>
But, I cannot determine what to fix. I am on a Linux system, using PHP5.
31-03-2009 by webified
Why does it work on your site, but not mine? I believe the difference is found in functions.php. The file available for download is probably different than the file you are using on redtie.ro, no?
31-03-2009 by Admin
The problem may be with the way your server handles .htaccess redirection. The simple away around this problem is to not use redirection. This is what you have to do:
In function.php, change line 58 to:
<li><a href="<? echo $http."/?loc_id=".$r[loc_id][0]; ?>"><? echo $r[city][$i]; ?></a></li>

And change lines 262 to 266 to:
if(isset($_REQUEST['loc_id'])){
  $loc_id = $_REQUEST['loc_id'];
}

That should resolve this problem.
01-04-2009 by webified
Well, it works for large cities, such as Phoenix, Arizona. But, the modified script fails for smaller communities, such as Kayenta, Arizona.
01-04-2009 by webified
OK. I found the problem. If the search only turns up one town or city, then that code in the lines just above must also be changed to match. All works now.
01-04-2009 by Admin
Yes, that is the solution to the problem. I am sorry I forgot to put that change to. So, changes need to be made to line 48 as well:
window.location = "<? echo $http."/?loc_id=".$r[loc_id][0]; ?>"


  • Your username will be shown. If this is your first reply, it will be verified for spam before it will appear on the site.

Search

Login