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
Next revision
Previous revision
xbee:xml [2010/05/23 17:26] – old revision restored rfilexbee:xml [2010/05/23 20:41] (current) rfile
Line 48: Line 48:
 </code> </code>
 </box> </box>
 +
 +controller
 +<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.1274653578.txt.gz · Last modified: 2010/05/23 17:26 by rfile