Embed an RSS Feed

RestfulService can be used to easily embed an RSS feed from a site. In this How to we'll embed the latest weather information from the Yahoo Weather API.

First, we write the code to query the API feed.


	public function getWellingtonWeather() {
		$fetch = new RestfulService(
			'q' => 'select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="Wellington, NZ")'
		// perform the query
		$conn = $fetch->request();

		// parse the XML body
		$msgs = $fetch->getValues($conn->getBody(), "results");

		// generate an object our templates can read
		$output = new ArrayList();

		if($msgs) {
			foreach($msgs as $msg) {
				$output->push(new ArrayData(array(
					'Description' => Convert::xml2raw($msg->channel_item_description)

		return $output;

single field Description.


	<% if WellingtonWeather %>
	<% loop WellingtonWeather %>
	<% end_loop %>
	<% end_if %>