Advertisement
whyisjake

Untitled

Jul 6th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8" />
  5.     <title>Weather - Jake Spurlock</title>
  6.     <meta name="generator" content="BBEdit 9.6" />
  7.     <link href='http://fonts.googleapis.com/css?family=Slackey' rel='stylesheet' type='text/css'>
  8.     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
  9.     <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
  10.     <script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
  11.    
  12. </head>
  13. <body>
  14.  
  15.  
  16.  
  17. <div data-role="page">
  18.  
  19.     <div id="header" data-role="header">
  20.    
  21.         <?php          
  22.            
  23.             if ($_POST) {
  24.             $request_url = 'http://www.google.com/ig/api?weather='.urlencode($_POST['zip']);
  25.             $xml = simplexml_load_file($request_url) or die("feed not loading");
  26.        
  27.         ?>
  28.         <h1><?php echo $xml->weather[0]->forecast_information[0]->city['data']; ?></h1>
  29.         <?php }
  30.        
  31.             else {
  32.         ?>
  33.        
  34.         <h1>Weather</h1>
  35.        
  36.         <?php } ?>
  37.    
  38.     </div>
  39.  
  40.    
  41.     <div data-role="content" id="content">
  42.    
  43.    
  44.        
  45.         <?php if (!$_POST) { ?>
  46.        
  47.         <form action="" method="post">
  48.         Zip Code:  <input type="text" name="zip" /><br />
  49.         <input type="submit" name="submit" value="Submit me!" />
  50.         </form>
  51.         <?php }  ?>
  52.        
  53.         <?php
  54.         if ($_POST) {
  55.        
  56.         error_reporting(E_ALL);
  57.        
  58.        
  59.            
  60.             ?>
  61.        
  62.        
  63.             <p>Currently, it is <?php echo strtolower($xml->weather[0]->current_conditions[0]->condition['data']); ?> with the temperature hovering around <?php echo $xml->weather[0]->current_conditions[0]->temp_f['data']; ?>.</p>
  64.            
  65.             <p>Today, it is going to be <?php echo strtolower($xml->weather[0]->forecast_conditions[0]->condition['data']); ?>, with a high around <?php echo $xml->weather[0]->forecast_conditions[0]->high['data']; ?> and dipping down to <?php echo $xml->weather[0]->forecast_conditions[0]->low['data']; ?>.</p>
  66.            
  67.         <?php } ?>
  68.        
  69.         <ul data-role="listview" data-inset="true">
  70.             <li><a href="#two">Links</a></li>
  71.             <li><a href="#one">Zip Code</a></li>
  72.        
  73.     </div>
  74.    
  75.     <div data-role="footer">
  76.         <h4>&copy; Jake Spurlock</h4>
  77.     </div><!-- /footer -->
  78.  
  79.    
  80. </div>
  81.  
  82.     <div id="one" data-role="page">
  83.     <div  data-role="header">
  84.    
  85.         <h1>Zip Code</h1>
  86.    
  87.     </div>
  88.     <div  data-role="content">
  89.  
  90.         <p>Add your zip code to get at a glance weather.</p>
  91.  
  92.         <div data-role="fieldcontain">
  93.             <label for="name">Enter Zip Code:</label>
  94.             <input type="text" name="name" id="name" value=""  />
  95.         </div>     
  96.    
  97.     </div>
  98.     <div  data-role="footer">
  99.    
  100.         <h4>&copy; Jake Spurlock</h4>  
  101.    
  102.     </div>
  103.    
  104.  
  105. </div>
  106.  
  107.     <div id="two" data-role="page">
  108.     <div  data-role="header">
  109.    
  110.         <h1>Links</h1>
  111.    
  112.     </div>
  113.     <div  data-role="content">
  114.    
  115.         <ul data-role="listview" data-inset="true">
  116.             <li data-role="list-divider">Jake Spurlock Links</li>
  117.             <li>Jake Spurlock.com</li>
  118.             <li>SMRTDSGN.com</li>
  119.         </ul>
  120.    
  121.     </div>
  122.     <div  data-role="footer">
  123.    
  124.         <h4>&copy; Jake Spurlock</h4>  
  125.    
  126.     </div>
  127.    
  128.  
  129. </div>
  130.  
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement