Creating Interaction in Joomla: Newsfeeds

Newsfeeds share data from other providers. There are two ways to display newsfeeds on a web site:

  • Use the Joomla Newsfeeds component
  • Use the Feed Display module

In this chapter, you will learn to use the Joomla Newsfeeds component. (In Chapter 8, in the discussion on Module Manager, you will learn how to use the Feed Display module to display newsfeeds.)

Before creating a newsfeed, you have to create a category to which the newsfeed will belong. The goal is to categorize similar newsfeeds under the same category.

1. Creating Categories for Newsfeeds

To create a category for a newsfeed, open the Newsfeeds Category Manager. From the menu bar in the administrator window, select Components ➤ Newsfeeds ➤ Categories; the Newsfeeds Category Manager will open, as shown in Figure 6-1. It displays the newsfeed categories provided by default (which you can unpublish if you don’t want them to appear on your web site). You can see that the default newsfeed category provided is the Uncategorized category.

The tools in the Newsfeeds Category Manager toolbar are fairly self-explanatory. As usual, you use Publish to make the selected categories visible on the web site and Unpublish to make the selected categories temporarily invisible (the unpublished categories can be published again any time via the Publish icon). The Trash icon is for permanently deleting a category. The Edit icon is used to edit the information of the category that was entered while creating the category. This information includes the category’s title, access level, image, and description. The New icon is for creating a new category of newsfeeds, and the Help icon is for displaying the help screen from the specified help server (in the Global Configuration settings).

The Newsfeeds Category Manager columns display the respective information. For example, the Title column displays the name of the category. Clicking the name opens the category in edit mode. The Status column shows whether the category is visible on the web site. A check mark signifies that the category is visible on the web site; a red X means that the category is invisible. The Access column displays which level of users can access the category. The options are Public, Registered, and Special. The ID column displays the category’s unique identification number, which is assigned automatically by Joomla for identifying it internally.

To create a category for your newsfeeds, click the New icon in the toolbar. You’ll see a screen that lets you enter information for the new category. The page has four tabs: Category, Publishing, Permissions, and Options (the Category tab is opened by default). The Publishing and Permissions tabs are like the tabs that you have seen earlier: they will display publishing information for the newsfeed category and will help to set permissions for this newsfeed category, respectively.

In the Category tab, enter the information for the new newsfeed category, as shown in Figure 6-2.

In the Title field, specify the name for the new category. In this case, enter Cell Phones. The Alias field, as mentioned previously, is for SEF purposes, and you can leave it blank (Joomla will generate an alias for you from the title by lowercasing it and using hyphens in place of spaces).

The Options tab displays the fields to assign an image to this newsfeed category. After clicking it, you see the page shown in Figure 6-3. Click the Select button to assign an image to represent this newsfeed category; Media Manager will open up.

All the images available in the Media Manager (from the joomla_root/images/stories folder) will be displayed (see Figure 6-4). Select image cellphone1.jpg (assuming that you already loaded it into the Media Manager) and click the Insert button to assign it to the newsfeed category.

After entering the information for the newsfeed category, save it by clicking the Save & Close icon. You’ll see the message Category Successfully Saved, and your Cell Phones category will appear in the list (see Figure 6-5).


2. Creating Newsfeeds

With the newsfeed category created, you can now create a newsfeed for that category. To create a newsfeed, either click the News Feeds link (above the Categories link) or select Components ➤ Newsfeeds ➤ Feeds from the menu bar. The News Feed Manager: News Feeds page will open and display a list of several news feeds provided by default (if any). Currently, the list is empty because no default newsfeeds are provided (see Figure 6-6).

Click the New icon in the toolbar, and you’ll see a screen that lets you enter information for the new newsfeed. The screen contains the following four tabs:

  • New News Feed: Enables entering information for the new newsfeed.
  • Images: Enables assigning image(s) to the newsfeed.
  • Publishing: Displays newsfeed publishing Also enables entering meta keywords and descriptions of the newsfeed.
  • Display: Shows fields that help configure the newsfeed. For example, you can determine the number of articles to be displayed in the newsfeed, cache time for downloading the newsfeed, direction for displaying the newsfeed, and so on.

The New News Feed tab is opened by default. Enter the information for the new newsfeed as shown in Figure 6-7. In the Title field, enter the name of the newsfeed: Cell Phones —Fastest Communication. Although the Alias field can be left blank, enter cell-phones in this field. In the Link field, enter the URL of the web site from which you want to get the newsfeeds (in this case, From the Category drop-down list, select the category to which this newsfeed should belong: Cell Phones. Set the Status field to Published to make this newsfeed appear on the web site.

Click the Display tab to configure the newsfeed, and you’ll see the fields shown in Figure 6-8.

In the Number of Articles box, specify the number of articles that you want to be accessed from the newsfeed web site and displayed on your web site for your visitors (you can leave it at the default of 5). In the Cache Time field, specify the number of seconds the newsfeed will be saved on your server before being downloaded again from the remote newsfeed web site. The default time is 3600 seconds (1 hour). You can increase this time to reduce the network traffic, but it will make your newsfeeds less up to date.

The Language Direction field is used to specify the direction of the newsfeed content. Its three options are as follows:

  • Site Language Direction: The direction of newsfeed text will be based on the language in which your web site content is being For example, if your web site content is being viewed in English, the newsfeed content will move from left to right; if it is being viewed in Hebrew or Arabic, it will move from right to left.
  • Left to Right Direction: The newsfeed content will flow from left to right, regardless of the language in which your web site is
  • Right to Left Direction: The newsfeed content will flow from right to left, regardless of the language in which your web site is

After entering the information for the newsfeed, click the Save & Close icon to save it. You’ll see the message News Feed Successfully Saved, and the newsfeed Cell Phones – Fastest Communication will appear in the News Feed Manager list, as shown in Figure 6-9.

To display a newsfeed, you need to create a menu item and link it to the newsfeed category that you just created. Open the Menu Manager by selecting Menus ➤ Menu Manager. You’ll see a list of all the existing menus. Click the New icon to create a new menu item. You’ll see a screen that lets you enter the information for the menu item. Enter the information as shown in Figure 6-10.

The title you want to appear for the menu item is Newsfeeds, so enter it in the Menu Title field. The Link field will be automatically filled in, depending on the menu item type selected. The Menu Location field is used to decide which menu you want this menu item to appear in. Select Main Menu from the drop-down list. Because you want to display the newsfeeds from the Cell Phones category that you just created, choose the Cell Phones category from the Category combo box.

When you click the Select button from the Menu Item Type field, you’ll see a screen for selecting the menu item type (see Figure 6-11).

You will find the following menu item types under Newsfeeds:

  • List All News Feed Categories: Shows all newsfeed categories within a category.
  • List Feeds in a Category: Shows all newsfeeds within a It shows the links to the newsfeeds in the specified category.
  • Single News Feed: Shows a single newsfeed.

Select the List Feeds in a Category menu item type.

After entering the information for the menu item Newsfeeds, click the Save & Close icon to save it. You’ll see the Newsfeeds title appear in the list of menu items in the Main Menu, as shown in Figure 6-12.

You can now check whether your newsfeed is visible on your web site. Open the browser window, point to the Joomla web site (http://localhost/joomlasite), and click the Refresh button. In the Main Menu, select the Newsfeeds menu item and you’ll see a screen that displays the newsfeed category Cell Phones that you just created (see Figure 6-13).

The Cell Phones newsfeed category displays the newsfeeds under it; in this case, only the newsfeed Cell Phones – Fastest Communication because it is the only newsfeed you’ve created in the Cell Phones category. Click the Cell Phones – Fastest Communication link to get the newsfeed from the specified URL: You’ll get a list of five articles from the remote newsfeed web site, as shown in Figure 6-14.

Source: Harwani B M (2015), Foundations of Joomla!, Apress; 2nd ed edition

Leave a Reply

Your email address will not be published. Required fields are marked *