Building a News Aggregating Site in Joomla!

Exclusive offer: get 50% off this eBook here
Joomla! 1.5 Site Blueprints

Joomla! 1.5 Site Blueprints — Save 50%

Tailor-made plans for easily building powerful and exciting Joomla! sites

$23.99    $12.00
by Timi Ogunjobi | May 2010 | Joomla! Content Management Open Source PHP Web Development

Bad news is always good news for the press. This is why Vaughan Pyre has decided to take advantage of this fact and creates a website that will aggregate bad news and weird happenings from all over the world. In this article by Timi Ogunjobi, author of Joomla! 1.5 Site Blueprints, the content of the site will be entirely derived from Really Simple Syndication (RSS) feeds from several sources (each feed being automatically fetched and its items displayed on the website).

Weird Hap'nins requirements will be the need to:

  • Get external feed sources and allocate them to menu links on the website
  • Create the means to automatically fetch and display article items located in the feeds
  • Display the latest content from all feed sources on the front page

(For more resources on Joomla!, see here.)

The completed news aggregation site will look similar to the example shown in the following screenshot:

Joomla! 1.5 Site Blueprints

Build Weird Hap'nins

Vaughan Pyre is a very ambitious webpreneur. What he really hopes for is a website that is completely self-maintaining, and on which he can place some Google AdSense blocks. Clicks from the visitors to his site will ensure that he makes lots of money. For this, he needs a site where the content updates regularly with fresh content so that visitors will keep coming back to click on some more Google ads. Vaughan's ultimate objective is to create several of these websites.

Template

The template chosen is Midnight by BuyHTTP, which is a template that fits the theme of this unique website.

Extensions

This is, surprisingly, a very simple site to build, and much of the requirements can be actually be achieved by using the native News Feeds component. However, the News Feeds component will only list the title links to the external feed items, whereas what Vaughan wants is that the feeds are pulled into the site as articles. Therefore, we will be using an automatic article generator component. There are several of such components on the Joomla! extensions site, but almost all of them are commercial. Vaughan is a skinflint and will not pay to buy any script, so what we are looking for is free component. That is why we have chosen the following:

  • 4RSS—aggregates RSS feeds and creates articles from them
  • JCron Scheduler—used for cron jobs management and scheduling to simulate cron jobs through the Joomla! frontend interface at preset intervals

Indeed, were it not for the fact that Vaughan needs the content to automatically be updated, we needn't use any extension other than the 4RSS component.

Other extensions

The core module that will be used for this site is:

  • Main Menu module—creates the primary navigation functionality for the site pages

Sections and categories

New sections and categories will need to be created so that incoming article feeds will be correctly routed according to their description.

A new section will be created that we will call Feed. Under this section, we shall have three categories—Bad News, More Bad News, and Weird News.

Create a new section

We intend to create a section that will be named Feed. In order to do this, perform the following steps:

  1. Navigate to the Section Manager from the Control Panel, and then click on the New icon at the top right-hand side, in order to create a new section.
  2. On the next page, add the name of the section, and then save your changes.

Joomla! 1.5 Site Blueprints

Create new categories

To create a new category, perform the following steps:

  • Navigate to the Category Manager page from the Control Panel.
  • On the following page, create a new category in the same way as we created the new section. However, remember to set the Section to Feed.

Joomla! 1.5 Site Blueprints

Joomla! 1.5 Site Blueprints Tailor-made plans for easily building powerful and exciting Joomla! sites
Published: May 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

(For more resources on Joomla!, see here.)

Feed content

Vaughan has decided to initially use eight feeds (which are listed in the following sections), obtained from www.newsfeedmaker.com, for the different categories. It is from these RSS feeds that the articles will be created.

Bad News

The newsfeeds based on "bad news" as the topic of interest on www.newsfeedmaker.com are as follows:

More Bad News

The newsfeeds based on "more bad news" as the topic of interest on www.newsfeedmaker.com are as follows:

Weird News

The newsfeeds based on "weird news" as the topic of interest on www.newsfeedmaker.com are as follows:

Configure the 4RSS component

After uploading the 4RSS component and installing it through Extensions | Install/Uninstall in the administration toolbar, access the component from Components | 4rss. This will provide a page, shown in the following screenshot, on which we shall specify the RSS feeds:

Joomla! 1.5 Site Blueprints

To add a new RSS field, you need to click on the New icon. This will direct you to the Feed Set-Up page shown in the following screenshot:

Joomla! 1.5 Site Blueprints

On this page, we will do the following:

  • Add a specific name to identify each feed item
  • Add the RSS feed URL
  • Select the Section and Category to which articles from the particular feed should go
  • Add keyword(s) if you are targeting only feeds with specific words in them, for SEO purposes
  • Select whether you want the articles from this feed to show on the front page (in our example: Yes)
  • Select whether you want a link inside each article to the original source of the story (in our example: Yes)
  • Select whether you want the articles to be checked for duplicate entries (in our example: Yes)

After we have added all of the feeds, the Feeds Management page should look similar to the example shown in the following screenshot:

Joomla! 1.5 Site Blueprints

Configure JCron Scheduler

Upload the JCron Scheduler component, and install it through Extensions | Install/Uninstall on the administration toolbar.

The function of JCron Scheduler is to simulate cron jobs through the Joomla! frontend interface, at preset intervals, by users who either don't have access to the server crontab or don't want to use it. By default, it also installs and enables the JCron plugin. You need this enabled in order to make the cron jobs run. Therefore, check Extensions | Plugin Manager to ensure that the plugin is enabled.

We will need some information from the 4RSS component in order to make it function with JCron Scheduler—specifically the location of the site's cron script. In order to obtain this location, we return to the 4RSS Feeds Management page and click on the 4RSS Cron tab. On the Set Up Cron page, locate the information that we need, and copy it. In this case, the information is as follows:

C:\wamp\www\weirdjoomla\administrator\com_4rss\cronjob_4rss\cronjob.php

Joomla! 1.5 Site Blueprints

We now open the JCron Scheduler via Components | JCron | Manage Cron Jobs, in order to create a fresh cron job, as shown in the following screenshot:

Joomla! 1.5 Site Blueprints

On this page, we have:

  • Given the cron task a name (4RSS).
  • Selected a task type (Web Address fopen()).
  • Entered a command to run. A sample command is Php –q /home/xxxx/public_html/cronjobs/cronjob.php > /dev>null. Replace /home/xxxx/public_html/cronjobs/ by the actual path of your script. For this project, the following path, which is derived from the cron job script location that we had earlier copied, should be added:

    Php C:\wamp\www\weirdjoomla\administrator\com_4rss\cronjob_4rss\
    cronjob.php /dev>null
  • Created the schedule. The example schedule shown will run the cron script to get fresh articles at midnight, every day, and every month.

Add articles

We now return again to the 4RSS Feeds Management page, select all of the feeds, and click on Post on the top right-hand side, in order to fetch the feeds:

Joomla! 1.5 Site Blueprints

Joomla! 1.5 Site Blueprints Tailor-made plans for easily building powerful and exciting Joomla! sites
Published: May 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

(For more resources on Joomla!, see here.)

Configure the front page

Vaughan needs only five articles on the front page. These articles will be randomly selected from the entire Feeds section. In order to achieve this, the front page will be configured through the Main Menu item that links to it—the Home menu link.

To configure the front page for this display, navigate to the Menu Item Manager page again, and then click on the lone Home menu link, which, as we see from the table, links to the Front Page.

On the next page, we change the parameters to what we need on the front page and then save our changes, as shown in the following screenshot:

Joomla! 1.5 Site Blueprints

Other menus

Our objective is to create menus that link to articles drawn from each of the three different categories. In other words, we want to create the following menu links:

  • Bad News—links to articles from the Bad News category
  • More Bad News—links to articles from the More Bad News category
  • Weird News—links to articles from the Weird News category

In order to do this, again access the Menu Item Manager page from Menus | Main Menu. Create a new menu item by clicking on the New icon. On the next page, select Articles | Category | Category Blog Layout, as shown in the following screenshot:

Joomla! 1.5 Site Blueprints

Set the parameters for the menu link and also for the page to be displayed. The following screenshot shows the settings for the Bad News link:

Joomla! 1.5 Site Blueprints

The other two links—More Bad News and Weird News—are created in the same way.

Finishing up

We now make sure that our Midnight template is selected as Default in Extensions | Template Manager. If we now click on the Preview link, our front page will look similar to the example shown in the following screenshot:

The page for a category view page such as Weird News should look similar to the example shown in the following screenshot:

Summary

In this article, you have learned to:

  • Build a basic site for publishing news feeds, by using the 4RSS component
  • Use the JCron Scheduler component to run regular site tasks

Further resources on this subject:


About the Author :


Timi Ogunjobi

Timi Ogunjobi is a Technical Writer, Web Developer and Open Source Evangelist. Trained as an engineer, Timi has been developing web applications in several frameworks for more than 7 years and has also been writing for more than a decade on a wide variety of topics. Timi is the principal of Websesame – http://www.websesame.com – a software development and Technical writing company. Timi balances his time between programming, reviewing, writing, and contributing to interesting web-based and community projects. When he isn't working (which isn't that often) he enjoys playing jazz guitar and getting involved in outdoor activities principally cricket, golf, and swimming.

Books From Packt


Joomla! 1.5 SEO
Joomla! 1.5 SEO

Joomla! 1.5: Beginner's Guide
Joomla! 1.5: Beginner's Guide

Joomla! E-Commerce with VirtueMart
Joomla! E-Commerce with VirtueMart

Joomla! 1.5 Multimedia
Joomla! 1.5 Multimedia

Joomla! 1.5 Content Administration
Joomla! 1.5 Content Administration

Learning Joomla! 1.5 Extension Development
Learning Joomla! 1.5 Extension Development

Joomla! with Flash
Joomla! with Flash

Joomla! Web Security
Joomla! Web Security


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
e
2
B
F
p
B
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software