
DIY RSS
Yesterday I created an RSS feed for the blog . Now, if I can stand writing all the time, I can quickly read my notes.
I know that the vast majority uses wordpress or other blog engines, so I can send them right away to the second part of the note. I have a completely hand-made one - I hope I'm not the only newbie maniac of my kind, and it will be interesting for my colleagues to read.

When writing the script, a specification and two articles such as “RSS to PHP” were used: here everything is written out briefly and clearly, right down to the finished code; here it is more generalized, but input and output of data are also considered (in my case, it’s absolutely not necessary yet).
Totalthe script was compiled on the go for 10 minutes, but ... refused to work . I had to wait until the evening when I get home to the Internet. Here is the experience acquired at this stage and it makes sense to share.
First, I’ll draw your attention to the fact that languageru does not exist. A dozen RSS feeds were scouted in battle - everyone uses en or en-us . Although, in principle, the specification politely informs that there are other language labels, referring to some other standard, it’s on a different list of standards - in general, I didn’t know if the stream could be officially Russian.
And in order for all this to work, encoding = "UTF-8" or (for me, everything is different from people) encoding = "windows-1251" is indicated directly in the xml tag . In case html is used in the description of the news, the text is in - about this, in the articles above, it seems, was not.
Here is the first part and that’s it. I’ll only add that in order to test the flow for validity I had to drive IE7 - it is the only one from my entire set of browsers that reports specific errors, and as it turned out, it’s not entirely true - in my case, it cursed the title “B” in the channel description :( But IE6 offers to save the streams to a PC, after which they can be “prepared” at your own discretion.
And now the second part is promised .
Next, your humble servant decided to use the services of the FeedBurner service , which provides owners of RSS feeds with detailed statistics and mor not any other amenities that I still don't know about.
By registering for the service (a large text box with a button on the main page), I got a bunch of materials to choose from, what should I do next if I have a blog on Blogger, Wordpress, MySpace, etc. About man-made miracles, of course, not a word.
So, by trial and error, it was established: a new feed address like feeds.feedburner.com/JustKitich is inserted only into the link in the blog template, everything else (in fact, the stream generation script itself) remains unchanged.
Step 2I want a beautiful button with the number of readers. For example, I scored on FeedBurner and tried to fetch the button code from the first blog I got - it wasn’t there. I still had to find where it is located on the service and ... activate the service! By the way, there are also a bunch of buttons like “subscribe through your favorite news reader”. And all this in the section Publicize - FeedCount and friendly graphic links respectively.
Step 3. Collection of statistics. A script is used, placed (usually) in the “head” part of the blog template. It’s hidden far on FeedBurner - I can’t even find it again now, but it doesn’t require activation, so I’ve provided the code here: instead of “...” the address of the current note is inserted, and instead of a script script (Habr feature).
Now I explain: this current address is needed so that the script knows where it is called from and puts the corresponding page in the statistics. On many blogs, I saw horrors such as from notes, the script passes a link to the note, and from all other pages - the link to the last note. IMHO wrong somehow. At home, for example, I hung the following code: that is, the script is displayed only on the blog (I also have other sections), and in the notes we send the address of the note, otherwise it’s just the main blog. Let's see how it will work now. That, in fact, is all. I personally have no more questions. I'm glad if at least someone else comes in handy. Original - here
I know that the vast majority uses wordpress or other blog engines, so I can send them right away to the second part of the note. I have a completely hand-made one - I hope I'm not the only newbie maniac of my kind, and it will be interesting for my colleagues to read.

When writing the script, a specification and two articles such as “RSS to PHP” were used: here everything is written out briefly and clearly, right down to the finished code; here it is more generalized, but input and output of data are also considered (in my case, it’s absolutely not necessary yet).
Totalthe script was compiled on the go for 10 minutes, but ... refused to work . I had to wait until the evening when I get home to the Internet. Here is the experience acquired at this stage and it makes sense to share.
First, I’ll draw your attention to the fact that language
And in order for all this to work, encoding = "UTF-8" or (for me, everything is different from people) encoding = "windows-1251" is indicated directly in the xml tag . In case html is used in the description of the news, the text is in - about this, in the articles above, it seems, was not.
Here is the first part and that’s it. I’ll only add that in order to test the flow for validity I had to drive IE7 - it is the only one from my entire set of browsers that reports specific errors, and as it turned out, it’s not entirely true - in my case, it cursed the title “B” in the channel description :( But IE6 offers to save the streams to a PC, after which they can be “prepared” at your own discretion.
And now the second part is promised .
Next, your humble servant decided to use the services of the FeedBurner service , which provides owners of RSS feeds with detailed statistics and mor not any other amenities that I still don't know about.
By registering for the service (a large text box with a button on the main page), I got a bunch of materials to choose from, what should I do next if I have a blog on Blogger, Wordpress, MySpace, etc. About man-made miracles, of course, not a word.
So, by trial and error, it was established: a new feed address like feeds.feedburner.com/JustKitich is inserted only into the link in the blog template, everything else (in fact, the stream generation script itself) remains unchanged.
Step 2I want a beautiful button with the number of readers. For example, I scored on FeedBurner and tried to fetch the button code from the first blog I got - it wasn’t there. I still had to find where it is located on the service and ... activate the service! By the way, there are also a bunch of buttons like “subscribe through your favorite news reader”. And all this in the section Publicize - FeedCount and friendly graphic links respectively.
Step 3. Collection of statistics. A script is used, placed (usually) in the “head” part of the blog template. It’s hidden far on FeedBurner - I can’t even find it again now, but it doesn’t require activation, so I’ve provided the code here: instead of “...” the address of the current note is inserted, and instead of a script script (Habr feature).
<скрипт src='http://feeds.feedburner.com/~s/JustKitich?i=...' type='text/javascript' charset='utf-8'>
Now I explain: this current address is needed so that the script knows where it is called from and puts the corresponding page in the statistics. On many blogs, I saw horrors such as from notes, the script passes a link to the note, and from all other pages - the link to the last note. IMHO wrong somehow. At home, for example, I hung the following code: that is, the script is displayed only on the blog (I also have other sections), and in the notes we send the address of the note, otherwise it’s just the main blog. Let's see how it will work now. That, in fact, is all. I personally have no more questions. I'm glad if at least someone else comes in handy. Original - here
if ($page_curr == 'blog') {
if ($id>0)
print "";
else
print "";
}
?>