137 CHAPTER Employing Advanced Content Management Techniques IN THIS CHAPTER Using content display modules Bringing external content into your site Managing content from the front end Syndicating your content I n previous chapters, I discuss the basics of Joomla! content manage- ment. In this chapter, I take a look at some of the more advanced tech- niques that help you create a richer content experience for your visitors and also look at the tools that enable you to set up alternative content man- agement work flows. The modules included with the default system provide numerous options for displaying content on your site. Additionally, functions like the Newsfeeds component, the Feed Display module, and the wrappers allow you to bring external content into your site. This chapter discusses how to integrate these options into your site and make them part of the content mix. Joomla! also enables you to allow visitors to submit articles to your site and to create a workflow around content contributed from the front end. The system provides a number of tools to enable this functionality, thereby giving you another way to add interactivity to your site and build community with your users. This chapter examines front-end content management in depth. Using Content Display Modules The modules included with your Joomla! site provide a variety of options for displaying content on the pages of your site. Although a number of the mod- ules only provide links to your articles, such as the Latest News or the Sections module, others actually display content items on the page. This sec- tion looks at the two key Joomla! modules that provide content display: the Custom HTML module and the Newsflash module. Later in this chapter I also look at the Feed Display module you can use to show Newsfeed output on your pages. Part II: Working with Content and Users 138 Using the Custom HTML module The Custom HTML module is a blank canvas that you can use to display content of your choosing. It is nothing more than an empty container designed to hold text, images, or a mix of the two. The module provides no content of its own, rather it gives you an empty text box and a WYSIWYG edi- tor that allows you to create and edit the content as you see fit. You can either copy and paste con- tent into the module or create it from scratch, complete with full formatting. Cross-Reference The Custom HTML module is discussed in more detail in Chapter 17. One of the most common uses for this module is to create a short excerpt or synopsis of an article or another feature on your site, together with a link to the full article or feature. When used in this fashion, the module functions as a teaser that encourages people to click and explore your site fur- ther. Although it is not possible to automatically display an article or its intro text inside of the module, the Custom HTML module enables you to manually create this. Simply copy and paste part of the article into a module, add a link to the full article; then publish the module where you want the teaser to appear. To make your own teaser module, follow these steps: 1. Log in to the admin system of your site. 2. Click on the option Article Manager, under the Content menu. The Article Manager loads in your browser. 3. Click on the name of the article you want to use as the subject of your teaser mod- ule. The article editing window opens. 4. Copy the portion of the text you want to use as the teaser content in the module. 5. Click the Cancel icon. The Article Editing dialogue closes and returns you to the Article Manager. 6. Click the option Module Manager under the Extensions menu. The Module Manager opens. 7. Click the New icon on the top-right toolbar. The New Module dialogue opens. 8. Click the option Custom HTML. Select the Next icon. The next step of the New Module dialogue opens. 9. Give your new module a name. 10. Select a position for the module. 11. Set the pages upon which the module appears by selecting the menu items from the Menu Selection combo box. 12. Paste the text you copied from the article into the text box. 13. Enter a hard return at the end of the text and then add the words Read more. . . Chapter 7: Employing Advanced Content Management Techniques 139 14. Hyperlink the words Read more. . . to the full article. 15. Click the Save icon on the top-right toolbar. The system creates and save your new module and exit the Module editing window, returning you to the Module Manager. The Newsflash Module provides a different way to reach a similar result. Using the Newsflash module The Newsflash module is used to display the first few sentences of one or more articles. If you’ve loaded the sample data with your Joomla! site, you can see the Module in action, because it is used to display random article content at the top of the pages. Figure 7.1 shows the output as it appears on the default Joomla! site. FIGURE 7.1 The Newsflash Module’s output, shown here as it is implemented in the default site with the sample data installed. Outupt of the Newsflash Module Cross-Reference See Chapter 17 for more information on the Newsflash module. Part II: Working with Content and Users 140 The ability to display at random the first few sentences from articles in a specific content category is only one way that this module can be used. It can also be configured to show part of a single article or part of a group of articles drawn from a specific section and category. The module is configured through the module parameters. The parameters can be set to display any of the following: l The introductory sentences from articles chosen at random from a specific category. The article shown changes each time the page is reloaded. (This configuration is used in the default site.) l The introductory sentences from a specific article, with a read more link to the full article. This configuration is similar to the teaser module used as an example in the previous section. l The introductory sentences from a specific article, without a read more link. l The introductory sentences from multiple articles in a specific category, with read more links to the full articles. l The introductory sentences from multiple articles in a specific category, without read more links. If you elect to use the randomization feature, you will only see one article at a time, in a fixed lay- out. However, if you want to show multiple articles, you can set the number of articles shown and whether they are shown in a horizontal or a vertical layout. Note There are a couple of important limitations that you need to keep in mind when using this module. You cannot set the amount of text that is shown; this is set by the system. Also note that the order of the articles shown is based on their order within the category; if you need to re-order the display in the module, you have to change the order of the articles inside the category; depending on how your site is configured; this may impact the dis- play of content in other areas of the site. Cross-Reference See Chapter 5 for more information on reordering articles within a category. Placing modules inside articles Ordinarily, module output is confined to the spaces around the main content area of your page — the left or right sides, or above or below the main content area. The placement of the modules is defined by their assignment to the Module Position Holders that have been specified in the site’s template. Cross-Reference See Chapter 20 for more information on working with the Module Position Holders inside template files. Chapter 7: Employing Advanced Content Management Techniques 141 In some cases, however, you may want to place a module inside of the content area of a page. If that page contains an article, you can do so. Joomla! makes it possible to put a module directly inside an article; all you need to do is type a bit of code into the text of the article. The result appears similar to what you see in Figure 7.2. FIGURE 7.2 The text area in the editing window shows a Module Position holder embedded in an article, in this case creating a Module Position Holder named “insidearticle.” Module position holder code To insert a module inside of the content area of an article, open the Article Editing dialogue and then follow these steps: 1. Place the cursor where you want the module output to appear. 2. Type the following code {loadposition modulepositionname}, where “moduleposi- tionname” is the name you want to use for this specific Module Position Holder. 3. Click the Save icon at the top right. The system saves the article with the new Module Position Holder in place and exits the Article Editing dialogue, returning you to the Article Manager. Part II: Working with Content and Users 142 4. Click the Module Manager option, under the Extensions menu. The Module Manager loads. 5. Click the name of the module you want to place inside the article. The Module Editing dialogue opens. 6. In the Position field, type the name you gave the Module Position inside the article; in this example, that name would be modulepositionname. 7. Click the Save icon at the top right. The system saves you changes and the Module Editing dialogue closes and returns you to the Module Manager. Note Take special note of the syntax used by the code: {loadposition xxx}, where xxx is the name of the Module Position Holder. You can use any name you want for the Module Position Holder, as long as it is not in use elsewhere. As a general rule, it is better not to use a common name for Module Position Holders placed inside of articles. A unique and distinctive name for the Module Position Holder avoids confusion with traditional Module Position Holders and avoids the necessity to make sure that there is a menu selection for the page; you can simply set the module’s Menu Assignment to All, without fear that the module will show on undesired pages or positions. Tip The capability to place modules inside articles is enabled by the Joomla! Plugin named Content - Load Module. By default, the Content - Load Module Plugin is enabled, but if for some reason it is not, then you need to enable it from the Plugin Manager before you can use this technique. Cross-Reference The Plugin Manager and the Content - Load Module plugin are discussed in more detail in the Chapter 19. Bringing External Content into Your Site Creating content for a site and then keeping that content maintained is one of the biggest chal- lenges of site ownership. Joomla! provides a variety of tools that enable you to bring external con- tent into your site, thereby providing you with fresh and updated content created by others. The various tools and techniques available in the default system are covered in the following sections. Using wrappers A wrapper is an iFrame that allows you to display a web page inside of either a module or the con- tent area of a page. The wrapper essentially creates a page within a page, where the embedded page can be either from your own site, or from an external source. The page that is being wrapped maintains all its functionality, including navigation and other features. Chapter 7: Employing Advanced Content Management Techniques 143 Wrappers are used most frequently to perform one of the following tasks: l Display another page from your Joomla! site — a form, for example. l Display a non-Joomla! page that is located on your server. l Display a page that is located on a different server. l Display output from an application that is located on your server. Caution Although wrappers provide an easy way to display third-party content inside your site, care must be taken to avoid infringing on the intellectual property rights of others. Unless you have the permission of the site owner, displaying the content of other sites inside your site is not appropriate, especially if doing so gives others the impression that the content is yours. To create a wrapper inside of the content area of a page, use the Wrapper Menu Item Type. To wrap a web page and display it inside of a module position, use the Wrapper module. In either case, you can use the configuration options to gain limited control over the appearance of the wrapper. Note, however, that generally you have very little control over what happens within a wrapper unless you also control the web page that is being wrapped. Cross-Reference See Chapter 8 for details on the Wrapper Menu Item Type, and go to Chapter 17 for more information on the Wrapper module. Displaying syndicated content Syndicated content — RSS feeds, Atom feeds, and the like — provide a convenient source of ready-to-use content. Joomla! gives you two methods for bringing syndicated content into your site. To display news feed content within the content area of the page, use the Newsfeed component in conjunction with the Single Feed Layout Menu Item Type. Though the Newsfeed component is most commonly used to aggregate multiple syndicated news feeds and display them based upon categories, you can also use the Menu Item Type named Single Feed Layout to display the contents of a single feed within the content area of a page, as shown in Figure 7.3. Cross-Reference See Chapter 8 for more information on the Newsfeed component. Alternatively, if you want to display feed content in a module position, use Joomla!’s Feed Display module. The Feed Display module is independent of the Newsfeed component. Instead of drawing content from one of the news feeds contained in the Newsfeed component, you input the URL of the news feed into the module parameters. Part II: Working with Content and Users 144 FIGURE 7.3 The result of creating a Single Feed Layout Menu Item Type to display the content of the Joomla! Announcements newsfeed. Cross-Reference Turn to Chapter 17 to find out more about the Feed Display module. Managing Content from the Front End While the vast majority of site administrators manage their site content exclusively through the administration interface, Joomla! does provide the option to manage content from the front end. The technique has limitations, but it is a useful option that some will find attractive. In the follow- ing sections I discuss the pros and cons and how this option can be structured effectively. Understanding advantages and limitations One of the more under-used and under-documented features of Joomla! is the front-end content management functionality. The system is set up by default to allow certain classes of users to be able to submit, edit, and publish content from the front end of the web site. This functionality is . and returns you to the Module Manager. Note Take special note of the syntax used by the code: {loadposition xxx}, where xxx is the name of the Module Position Holder. You can use any name you want. article into the text box. 13 . Enter a hard return at the end of the text and then add the words Read more. . . Chapter 7: Employing Advanced Content Management Techniques 13 9 14 . Hyperlink the. module a name. 10 . Select a position for the module. 11 . Set the pages upon which the module appears by selecting the menu items from the Menu Selection combo box. 12 . Paste the text you copied