New here? Then you may want to subscribe to my rss feed. :)
July 8th, 2008 | Posted in Codeigniter, Development, Freelancing, My Work News, PHP |

After many months of development, I am glad to say that www.asht.info has finally launched.
Who are ASHT?
The Anglo Sikh Heritage Trail is a project of the Maharajah Duleep Singh Centenary Trust. The Trust was first established in 1993, the centenary year of the death of Maharajah Duleep Singh, with the primary objective of highlighting and promoting Anglo Sikh heritage. Since then it has engaged in a series of initiatives, including the Arts of the Sikh Kingdoms exhibition in collaboration with the V&A, the annual Portrait of Courage lecture at the Imperial War Museum and the Jawans to Generals exhibition in collaboration with English Heritage. Other projects have included the commissioning of a bronze statue of Maharajah Duleep Singh at Thetford; the first major piece of Sikh art outside India, as well as two highly successful festivals of Anglo Sikh heritage.
The site has a user friendly CMS, newsletter system as well as various ways for the community to contribute. The site was built using PHP/Codeigniter framework with a MySQL database. Client side development resulted in clean CSS/HTML markup as well as the creation of database driven flash elements. Site wide search makes use of Google’s Custom Search.
Visit ASHT
June 18th, 2007 | Posted in Codeigniter, Development, PHP | 16 Comments
Users of the latest version of Simplepie (Version 1.0.1) have been getting errors when passing in the feed url. The error refers to a missing method “feed_url()”. This is due to a change in Simplepie, to set the feed url you must now use “set_feed_url(your rss url)”.
A pet project of mine which I will unleash upon you all soon required the home page to read in an RSS feed. Since I am a CodeIgniter whore I soon learnt that amongst its many libraries and helpers that there wasn’t an RSS reader.
This was easily solved using an open source PHP RSS class called SimplePie. Simply, I can’t imagine ever needing anything else. Not to mention the ease of getting it to work within CodeIgniter. By placing simplepie.inc in the libraries directory and renaming it to simplepie.php, I could now use its methods to parse and display my RSS feed.
Within your controller:
function index() {
$this->load->library('simplepie');
//$this->simplepie->feed_url('http://www.digg.com/rss/indexdig.xml');
// You may have encountered an error where it couldn't find feed_url. This is due
// to a change in the latest version of simplepie. Simply, feed_url is now set_feed_url
$this->simplepie->set_feed_url('http://www.digg.com/rss/indexdig.xml');
$this->simplepie->init();
$data['dig_feed'] = $this->simplepie;
}
-
function index() {
-
$this->load->library(’simplepie’);
-
//$this->simplepie->feed_url(’http://www.digg.com/rss/indexdig.xml’);
-
// You may have encountered an error where it couldn’t find feed_url. This is due
-
// to a change in the latest version of simplepie. Simply, feed_url is now set_feed_url
-
$this->simplepie->set_feed_url(‘http://www.digg.com/rss/indexdig.xml’);
-
$this->simplepie->init();
-
$data[‘dig_feed’] = $this->simplepie;
-
}
Passing the $data array holding the parsed feed data to the view template made displaying the data a breeze. get_items() returns all feed data as an array. Optionally, if you wish to only display the first 5 items, get_items takes 2 parameters, the starting position and quantity to return. Passing in 0,5 as arguments returns the first 5 items.
echo "
";
foreach($dig_feed->get_items() as $item) {
echo "
- Show Plain Code]:
-
-
foreach($dig_feed->get_items() as $item) {
-
echo "<li><a href=’" .
$item->
get_link() .
"’>" .
$item->
get_title() .
"</a></li>";
-
}
-
Any problems then let me know.