Article focus on a way how to generate RSS XML code for syndication news about currently published articles. User can subscribe for obtaining news about currently posted articles into a RSS readers.
RSS short introduction
RSS (RDF Site Summary or Really Simple Syndication) is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. (wikipedia, 26.12.2020)
By creating RSS feed, we enable to other people gain info about all of our new post. Our goal is to populate newsfeed from the bazaar_item database table to inform about new items available for sell.
To view an RSS feed, users need a RSS newsreader. Some of them are integrated in most of today browsers.
Closer look at RSS
RSS uses as a HTML markup language that uses tags and attributes for content description. Base of RSS is then XML used to describe web content for syndication.
Next picture show output of generated RSS code for advertising new items on our Bazaar app.
Required tags for the channel
title. The title of the channel. Should contains the name.
link. URL of the website that provides this channel.
description. Summary of what the provider is.
one item tag at least, for the content.
Script rss.php for RSS markup generation
Next code provide all functionality for obtaining data about items for sell and generate RSS XML syndication feed for subscribed users.
<a class=“navbar-brand“ href=“https://cdesigner.eu“> Visit us on CDesigner.eu </a>
<a class=“navbar-brand“ href=“rss.php“> Subscribe to newsfeed <img src=“./images/rss.png“ width=“25″> </a>
In our pages is this footer script invoked way as can be visible on next code snippet. After including with requireonce() is invoked function for generating footer with expected with.
… code omitted from index.php …
<?php // footer include code
require_once(‚footer.php‘); // including footer
generate_footer(1060); // function from footer.php for seting width, you can use 580 and 1060px width
With RSS syndication is opened new way for our users to subscribe for getting all new info about products for sell. Short example provide shor introduction to RSS generation and how to implement RSS generator into a code of our page.
Full Bazaar app code for further reference can be obtained from github here.