Changeset 801
- Timestamp:
- 10/12/2007 05:56:14 PM (14 months ago)
- Files:
-
- 1 modified
-
trunk/application/controllers/welcome.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/welcome.php
r784 r801 10 10 echo html::anchor('welcome/'.$method, $method)."<br/>\n"; 11 11 } 12 } 13 14 function rss_example() 15 { 16 include Kohana::find_file('vendor', 'Markdown'); 17 18 $feed = new DOMDocument(); 19 $feed->load(APPPATH.'cache/rss.xml'); 20 21 foreach($feed->getElementsByTagName('item') as $index => $node) 22 { 23 if ($index > 4) break; 24 25 $title = $node->getElementsByTagName('title')->item(0)->nodeValue; 26 $desc = $node->getElementsByTagName('description')->item(0)->nodeValue; 27 $link = $node->getElementsByTagName('link')->item(0)->nodeValue; 28 $date = $node->getElementsByTagName('pubDate')->item(0)->nodeValue; 29 30 print Markdown("### [{$title}]({$link})\n$desc\n"); 31 } 32 33 print Kohana::lang('core.stats_footer'); 12 34 } 13 35 … … 90 112 { 91 113 echo '<p>YES! Lets do some work =)</p>'; 92 114 93 115 $query = $this->db->select('title')->from($table)->get(); 94 116 echo '<h3>Iterate through the result:</h3>'; … … 109 131 echo '<pre>'.print_r($item, true).'</pre>'; 110 132 } 111 133 112 134 echo '<h3>Try Query Binding with arrays (returns both associative and numeric because I pass MYSQL_BOTH to result():</h3>'; 113 135 $sql = 'SELECT * FROM '.$table.' WHERE id = ?'; … … 119 141 echo '<pre>'.print_r($item, true).'</pre>'; 120 142 } 121 143 122 144 echo '<h3>Look, we can also manually advance the result pointer!</h3>'; 123 145 $query = $this->db->select('title')->from($table)->get();
