Tutorial: Feed your sites by blogging!
Are you also the kind of webmaster with 5, 10 or even 20 web sites with the plan of making a living only through your own sites?
- How do you make sure that the content on all your sites are always fresh with related information?
- How can you make sure that new pages you write are indexed in the search engines faster then ever?
- How can you drastically increase your visitor traffic to new information you write?
- And how do you manage all this by simply writing a page and clicking one button and it's done?
I have the solution, it is called feeding your sites from your blog.
To see an example I give you NetMarketing.us, the data on the right are coming from a feed from my blog, total automatically. This also makes the articles unique. In a later blog post I will give you all the feeds I have so you can see it.
I give you here the tutorial.
- Categorize all your web sites in different categories.
- Then make a blog and I personally recommend using Wordpress.
- Create categories on the blog that fits your sites. You can make some subcategories called "Articles".
- Then make some posts.
- Save the following in a file called rss.inc on the same directory were you have the page to get the feed:
- Then open the URL you want to have the feed and add something like:
- To change the style of the feed just add the classes itemtitle and itemdescription to your CSS file. Or just change the last part of the script which is the HTML output, you can even have tables with background etc.
- Then do the same on your other sites.
<?php
/*
Created by Global Syndication's RSS Parser
http://www.globalsyndication.com/rss-parser
Modified by Jim Westergren
*/
set_time_limit(0);
####### The below URL is for your feed:
$file = "https://www.jimwestergren.com/category/online-marketing/articles/feed/";
$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;
function startElement($parser, $name, $attrs) {
global $rss_channel, $currently_writing, $main;
switch($name) {
case "RSS":
case "RDF:RDF":
case "ITEMS":
$currently_writing = "";
break;
case "CHANNEL":
$main = "CHANNEL";
break;
case "IMAGE":
$main = "IMAGE";
$rss_channel["IMAGE"] = array();
break;
case "ITEM":
$main = "ITEMS";
break;
default:
$currently_writing = $name;
break;
}
}
function endElement($parser, $name) {
global $rss_channel, $currently_writing, $item_counter;
$currently_writing = "";
if ($name == "ITEM") {
$item_counter++;
}
}
function characterData($parser, $data) {
global $rss_channel, $currently_writing, $main, $item_counter;
if ($currently_writing != "") {
switch($main) {
case "CHANNEL":
if (isset($rss_channel[$currently_writing])) {
$rss_channel[$currently_writing] .= $data;
} else {
$rss_channel[$currently_writing] = $data;
}
break;
case "IMAGE":
if (isset($rss_channel[$main][$currently_writing])) {
$rss_channel[$main][$currently_writing] .= $data;
} else {
$rss_channel[$main][$currently_writing] = $data;
}
break;
case "ITEMS":
if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
$rss_channel[$main][$item_counter][$currently_writing] .= $data;
} else {
$rss_channel[$main][$item_counter][$currently_writing] = $data;
}
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
// output HTML
### This is the channel title which is not needed #### print ("<div class="channelname">" . $rss_channel["TITLE"] . "");
if (isset($rss_channel["ITEMS"])) {
if (count($rss_channel["ITEMS"]) > 0) {
#### In the line under this one is a number, 10, that number is how many posts to display on the feed.
for($i = 0;$i < 10;$i++) {
if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
print ("n<div class="itemtitle"><a href="" . $rss_channel["ITEMS"][$i]["LINK"] . "">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a>");
} else {
print ("n<div class="itemtitle">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
}
print ("<div class="itemdescription">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />"); }
} else {
print ("<b>There are no articles in this feed.</b>");
}
}
?>
On the lines were you see ###, those are instructions. To get the URL of your feed just go to the category you want to give feed and add /feed/after that URL.
<strong>Latest articles on online marketing by Jim Westergren:</strong>
<br /><br />
<?php include("rss.inc"); ?>
When you do a blog post you can have it into several categories and on your feeds you can for example only take those in the Article category so you don't get any low quality posts on the feeds.
If you write a description on "Excerpt" of the post then that is displayed on the feed.
There is also a way to have several feeds from the same blog from different categories on the same web page by just having a different name on the rss.inc and changing the following words on the script: startElement, endElement and characterData. You can see an example here.
When you have set this up on let's say 10 sites, you will see how incredible this is.
Good luck!
Other posts
- My Recommendations for a Happy Life
- Budget 100 - an old school magic format
- My Favorite Board Games and How I Play Them
- Switching from Windows PC to Mac and why I switched back
- Creating The Space War - The Card Game of My Dreams
- 24 Characteristics That Geniuses Have in Common
- Setting up and Managing a MySQL Server
- Canasta - The Great Card Game
- Annual report number 13 + 14: My Success
- Selling my SEO business TodaysWeb
He is the Founder of DomainStats and N.nu. Read his full about page.