Jumat, 24 April 2009

Display YM (Yahoo Messenger) Notification

After doing some research over the internet, I found out the simplest way to display yahoo messenger notification in your website.

Please follow the steps below:

1. Copy and paste the script inside this text box below.




<a href="http://messenger.yahoo.com/edit/send/
?.target=your_yahoo_id">
<img src="http://opi.yahoo.com/yahooonline/
u=your_yahoo_id/m=g/t=2/l=us/opi.jpg"
border="0" alt="Status YM" /></a>



2. You need to change "your_yahoo_id" with your real yahoo id. If you notice you will need to do 2 changes.



You can change the icon of online/offline by changing the value of "t=2". Here are some references for changing the icon:


t=0


t=1


t=2


t=3


t=4


t=5


t=6


t=7


t=8


t=9


t=10


t=11


t=12


t=13


t=14


t=15


t=16






3. Save your work and try it.






Content Feed to your Website using MagpieRSS


When you create a website, sometimes you confuse of what content to put or to fulfil inside your website. What about if you can get a content feed right to your website?

Yes, content feed is what you need!!!

There are tons of RSS feed out there that beg you to be aggregated. It is quick and painless by doing this rather than you write the whole blocks.

I will show you how to aggregate this by using PHP.

Please follow the steps below:


1. Download the Magpie scripts from http://magpierss.sourceforge.net

   Now, why do I choose Magpie?

   MagpieRSS, affectionately known as Magpie, is an RSS and Atom parser for PHP. It allows you to display the newest articles from websites with RSS or Atom feeds on your own site. This is a great way to add new, fresh, and relevant information to your site. It parses RSS 0.9, RSS 1.0, and has some support for RSS 2.0 as well as Atom 0.3

   What is the requirement to use Magpie?

   Your server must support PHP version 4.2.0 with XML support, or PHP5 with libxml2 support.



2. Simply extract the file and upload the following files to your server: rss_fetch.inc, rss_parser.inc, rss_cache.inc, and rss_utils.inc and the entire directory named extlib. You can put theses files in any directory in the root of your webserver.



3. Here I give you my sample script:



<?php


require_once("magpierss/rss_fetch.inc");

$url = "http://rss.news.yahoo.com/rss/linux";
$rss = fetch_rss( $url );

echo "<b>" . $rss->channel['title'] . "</b><p><ul>";

$ct = 0;
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
$pubDate = $item['pubdate'];
$description = $item['description'];
$ct++;
if ($ct <= 5 ) {
echo "<li><a target='new' href=$href>$title</a><br/>$description
<br/>Publish Date: $pubDate</li> ";
}
}

?>



3. Save your work and try it.