cloudy cloudy

Author Topic: Cellphone / Mobile / iPhone Weather Script  (Read 52225 times)

0 Members and 1 Guest are viewing this topic.

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #15 on: January 06, 2010, 01:31:42 AM »
I added that to the ajax script and it didnt work. Still getting that same error..



line 241...  $monthname = langtransstr($monthname);
« Last Edit: January 14, 2010, 12:11:59 AM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #16 on: January 06, 2010, 01:35:56 AM »
Here's the code for the Gradient Thermometer:
Latest version available here:
http://www.weather-watch.com/smf/index.php/topic,43750.0.html

Sample:
« Last Edit: January 06, 2010, 07:55:00 PM by Meerkat »
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #17 on: January 06, 2010, 01:40:29 AM »
I added that to the ajax script and it didnt work. Still getting that same error..

http://www.snoqualmieweather.com/cell_ajax-dashboard.php

line 241...  $monthname = langtransstr($monthname);

Just replace those function without the "function_exists":

function langtransstr($word) {
   return $word;
}

function langtrans($word) {
   echo $word;
}

Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #18 on: January 06, 2010, 01:42:48 AM »
That did it.. thanks.. now to get everything working on it.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #19 on: January 06, 2010, 01:50:59 AM »
I've added the following lines to the cell_ajax-dashboard.php script in case common.php does not exist:

if ((include_once "common.php") == 0) {
   function langtransstr($word) {
      return $word;
   }
   function langtrans($word) {
      echo $word;
   }
}

Get it here: http://www.bashewa.com/cell_ajax-dashboard.php?sce=view
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #20 on: January 06, 2010, 01:51:46 AM »
That did it.. thanks.. now to get everything working on it.

Can I have a look at it?
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #21 on: January 06, 2010, 01:55:41 AM »
lol.. its still pretty messed up for the time being.. most of it isnt even working yet..



How did you get yours so narrow in width?
« Last Edit: January 17, 2010, 08:07:03 PM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #22 on: January 06, 2010, 02:00:17 AM »
How did you get yours so narrow in width?

You'll need the handheld Style Sheet:
http://www.bashewa.com/handheld.css

Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #23 on: January 06, 2010, 02:05:49 AM »
Or you can do this:

<div id="content" style="clear:both; margin-bottom: 10px; border:1px solid #ccc;max-width:240px;text-align:left;background:#FFF;padding:4px">
<?php include_once("cell_ajax-dashboard.php"); ?>
</div>

Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #24 on: January 06, 2010, 02:14:52 AM »
Here is the full page code for cell.html:
Code: [Select]
<?php
$isBot    
keyMatch('Googlebot,msnbot,Yahoo! Slurp,Mediapartners-Google,AnanziSpider,ia_archiver,FreshCrawler',$_SERVER['HTTP_USER_AGENT'],true);
$isSearch keyMatch('google,bing,yahoo,ananzi',$_SERVER['HTTP_REFERER'],true);
$isMobile keyMatch('MIDP,iPhone,Google Wireless Transcoder,Windows CE',$_SERVER['HTTP_USER_AGENT'],true);

if (!isset(
$_GET["skip"]))
if (
$isSearch && !$isBot && !$isMobile) {
// Reroute to Main page if comming from google search
header("Location: http://www.bashewa.com/"); /* Redirect browser home page */
exit;
} else
if (
stripos($_SERVER['HTTP_USER_AGENT'],"MIDP")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"iPhone")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Google Wireless Transcoder")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Windows CE")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Mediapartners")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"GoogleBot")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"msnbot")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Slurp")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Twiceler")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Ask Jeeves")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Ananzi")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"TwoFour")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"archiver")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"Feedfetcher")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"PageFetcher")===false
&&  stripos($_SERVER['HTTP_USER_AGENT'],"W3C_Validator")===false) {
// Reroute to Opera Mini
header("Location: http://www.bashewa.com/cell-demo.php?url=http://www.bashewa.com/cell.html"); /* Redirect browser to Opera Mini */
exit;
}
############################################################################
require_once("Settings.php");
$TITLE 'Bronberg Weather';
$DESC  "Bronberg Weather Station: current weather, weather forecast, trends and history for Bashewa &amp; Tiegerpoort.";
$KEYW  "Bronberg, Bashewa, Tiegerpoort, weather, current weather, weather forecast";
############################################################################
require_once("common.php");
include(
"cell_top.php");
############################################################################
if (isset($_GET["skip"]))
  $skip "?skip=1";
else 
$skip "";
?>

<style type="text/css">
.ForecastDetails {
  padding-top: 3px;
  padding-left: 0 px;
  height: 37px;
  line-height: 14px;
  background-position: left;
  background-repeat: no-repeat;
  text-align: right;
  font: 12px Arial;
}
.Sun {
  background-image: url(ajax-images/sun.png);
}

.Moon {
  background-image: url(ajax-images/moon.png);
}
.Field {
  font: bold 11px Arial;
}
</style>
</head>
<body>
<div align="center"><div id="container">

<div class="top"><h1>BRONBERG WEATHER</h1>
<div style="color:yellow; font: bold 10px Arial;">Tiegerpoort &amp; Bashewa Weather</div>
</div>
<div class="toplinkscell">
<div style="float:left">
<a href="cell.html<?php echo $skip?>" title="Mobile Weather"><b>Home</b></a>&nbsp;&nbsp;
<a href="cell-forecast.php<?php echo $skip?>" title="Mobile Forecast"><b>Forecast</b></a>&nbsp;&nbsp;
</div>
<div style="float:right">
<a href="forum/archive/<?php echo $skip?>"><b>Crime</b></a>
</div></div>

<div id="content" style="clear:both; margin-bottom: 10px;">
<?php include_once("cell_ajax-dashboard.php"); ?>
</div>

<div id="footer">
<div id="fullversion"><strong>Full Version:</strong></div>
<div id="infobox">You're currently viewing a stripped down version of our content.<br />
<a href="http://www.bashewa.com/">View the full version</a>.</div>
</div>

</div></div>
</body>
</html>
<?php
############################################################################
# End of HTML Page
############################################################################

function keyMatch($needles,$haystack,$first=false) { // if "first" then break after 1st find
   
if ($needles == '') return 100;
   
$stac ' '.$haystack;
   
$nArray=explode(",",$needles);
   
$found=0;
   
$best=count($nArray);
     for(
$i=0;$i<count($nArray);$i++) {
       
$pzn=stripos($stac,trim($nArray[$i]));
       if (
$pzn>-1) {
      $found++;
  if ($first) break;
  }
       }
//   echo('find #'.$found.'/'.$best.'<br />');
   
$pct=($found*100)/$best;
   return 
round($pct);
}
?>


Code for cell_top.php:
Code: [Select]
<?php
require_once("Settings.php");
require_once(
"common.php");
include_once(
$SITE['WXtags']);
############################################################################
if (stripos($_SERVER['HTTP_USER_AGENT'],"Opera Mini")!==false)
echo 
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
;
else
echo 
'<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
   "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">'
;
?>

<html xmlns="http://www.w3.org/1999/xhtml"<?php
if (false and isset($SITE['lang'])) { // disabled.. seems to be a problem with it
$lang substr($SITE['lang'],0,2);
echo ' lang="'.$lang.'" xml:lang="'.$lang.'"';
}
?>
>
<head>
<?php
if ( !empty($TITLE) )
  echo "<title>" $TITLE "</title>\n";
else echo 
"<title>" $SITE['organ'] . "</title>\n";

if ( !empty(
$DESC) )
  echo "<meta name=\"description\" content=\"" $DESC "\" />\n";
else echo 
"<meta name=\"description\" content=\"" $SITE['organ'] . "\" />\n";

if ( !empty (
$KEYW) )
  echo "<meta name=\"keywords\" content=\"" $KEYW "\" />\n";
else echo 
"<meta name=\"keywords\" content=\"" str_replace(" ",",",$SITE['organ']) . "\" />\n";
?>

<meta http-equiv="Content-Language" content="<?php echo $SITE['lang']; ?>" />
<meta http-equiv="content-type" content="application/xhtml+xml; charset=<?php echo strtoupper($SITE['charset']); ?>" />
<link rel="stylesheet" type="text/css" href="handheld.css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<!-- script type="text/javascript" src="ajaxWDwx.js"></script -->
<!-- end of top -->

Replace www.bashewa.com with your website url.
« Last Edit: January 06, 2010, 02:16:24 AM by Meerkat »
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #25 on: January 06, 2010, 02:23:06 AM »
Here's the code for cell-demo.php which brings up the page in the Opera Mini Simulator:
Code: [Select]
<?php
if (isset($_GET["url"]))
     
$url $_GET["url"];
else 
$url "http://www.bashewa.com/cell.html";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Mobile Weather</title>
</head><body style="font:10px Arial;margin:0px;"><div align="center" style="margin-bottom: 50px;">

<p style="margin:0px;">Below is a live demo of the Bronberg Weather that<br />
functions like it would when viewed on a mobile.</p>

<object height="484" width="240" type="text/html"
 data="http://demo.opera-mini.net/demo.html?<?php echo $url?>">
 <div style="margin:7px 0px;text-align:left;border:1px solid gray;background:#F5F5F5;padding:7px;">
    <br />The Opera Mini demo requires Java enabled in your browser.
    You may need to download the latest
    <a href="http://java.com/en/download/index.jsp">Java Runtime Environment</a>.
 </div>
</object>
<div align="center" style="color:red">Click here if you can't see the Opera Mini phone browser:</div>
<div align="center" style="font:bold 12px Arial;color:blue;"><a href="<?php echo $url?>?skip=1" title="Click here if the simulator does not work"><?php echo $url?></a></div>

<div style="width:240px; text-align:left;border:1px solid gray;background:#F5F5F5;padding:7px;margin-top:7px;">
 <h3 align="center" style="margin:3px;">Mobile Simulator Tips</h3>
 <p>Use your mouse or keyboard to control the simulator
 (<kbd>F1</kbd>, <kbd>F2</kbd> function keys, <kbd>arrow keys</kbd> and <kbd>Enter</kbd> to navigate).</p>
 <p>Drag the scrollbar or the screen to scroll the page.</p>
 <p>Click on the screen if it goes blank.</p>
</div>

</div></body></html>
« Last Edit: January 06, 2010, 02:25:07 AM by Meerkat »
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #26 on: January 06, 2010, 02:27:57 AM »
wow... thanks... ill mess with it more tomorrow.
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #27 on: January 07, 2010, 12:00:25 AM »
Im gaining ground on this script, But has a few minor issues. Im using these settings in the ajax-cell script, but everything is still showing in the script as C, kts.. Any ideas?

$Lang       = 'en';
$uomTemp    = '&deg;F';
$uomBaro    = ' inHg';
$uomWind    = ' mph';
$uomRain    = ' in';
$uomPerHour = '/hr';

« Last Edit: January 17, 2010, 08:07:19 PM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,145
  • North Bend, WA
    • North Bend Weather
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #28 on: January 07, 2010, 12:20:05 AM »
I'm noticing some conflicts. Since this script also uses the common.php and settings.php file, the data that the cell script wants cant be changed. if I did change some of the directories in those files, then some of my site wouldn't work right.

Ive also change everything to F, MPH, etc... but its still somehow using C,kts for some reason.
« Last Edit: January 07, 2010, 12:23:04 AM by ALITTLEweird1 »
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline Meerkat

  • Rainer
  • Posts: 703
  • VP2+, WD v10.37R b37, Win 7, ACER i5 4GB 64bit
  • Pretoria, South Africa
    • Bashewa
Re: Cellphone / Mobile / iPhone Weather Script
« Reply #29 on: January 07, 2010, 12:39:26 AM »
Grab the latest Clientraw Parser here:
http://www.bashewa.com/clientraw-parser.php?sce=view

Then set $useUOM='E'; at the top.
Cheers,
Rainer

Meerkat's Script Collection
Script download links always available on the first page of my threads

 

cumulus