User Tools

Site Tools


xbee:xml

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
xbee:xml [2010/05/23 20:35] rfilexbee:xml [2010/05/23 20:41] (current) rfile
Line 49: Line 49:
 </box> </box>
  
-controller: +controller 
-<code >+<code php> 
 +<?php 
 + 
 +class Latlon extends Controller { 
 +   function __construct() 
 +       { 
 +            parent::Controller(); 
 +       } 
 + 
 +  
 + function index() { 
 + $this->load->model('lat_lon'); 
 + $posdata['rows'] = $this->lat_lon->getAll(); 
 + 
 +        $this->load->view('coords' , $posdata); 
 +
 + 
 +
 + 
 +</code> 
 + 
 +model 
 +<code php> 
 +<?php 
 + 
 + 
 +class Lat_lon extends Model { 
 + 
 + function getAll() { 
 + $q = $this->db->get('latlon'); 
 + 
 + if($q->num_rows() > 0) { 
 + foreach ($q->result() as $row) { 
 +     $lldata[] = $row; 
 +
 + return $lldata ; 
 +
 +
 + 
 + 
 +
 + 
 + 
 +</code> 
 +view 
 +<code php> 
 +<html> 
 +  <head> 
 +    <title></title> 
 +    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
 +  </head> 
 + 
 +  <body> 
 +    <div id="container"> 
 +    <p>My view has been loaded</p> 
 + 
 +        <?php 
 +        foreach($rows as $r){ 
 +        echo "<h1>" . $r->name . "</h1>"; 
 +        echo "<div>Lattitude: " . $r->lat . "</div>"; 
 +        echo "<div>Longitude: " . $r->lon . "</div>"; 
 +        echo "<div>ID: " . $r->id . "</div>"
 +          } 
 + 
 +         ?> 
 +    </div> 
 +  </body> 
 +</html> 
 + 
 +</code>
xbee/xml.1274664953.txt.gz · Last modified: 2010/05/23 20:35 by rfile