This module for the Joomla 2.5 content management system is designed to work exclusively with Cobalt, the content construction kit by MintJoomla. It displays selected Cobalt fields in a variety of layouts, including default list, horizontal list, thumbnails, accordion, tab pane, rotator, and highlighter.
Upload and install as normal using the Joomla installer. Once installed open the Joomla module manager and select the type 'cobalt featured items'. Click on the module name to open its editor.
The options available are shown in the screenshots below.
There are five tabs available: basic parameters, select layout, select records, select fields, and advanced options.
This tab allows you to set some general options, including the number of articles to display, the ordering, how to handle featured articles, and to set some header or footer text for the module. A useful option is 'menu item for linked page'. This option sets a Joomla itemid for the linked page, so you can determine which modules are loaded on that page.
The select layout tab allows you to choose the main options that control how the output will be displayed. You can select a template both for the overall layout of the module and for the individual items. The item layout default is simply to list each of the selected fields. However there are various alternatives available: the extract layout shows an extract from the article html, plus a thumbnail image from the article images; the images layout lists thumbnails of all the images connected to the article; the gallery item layout shows a text extract plus the gallery field (if it exists for the article); the text only field shows an extract from the article html only. The custom layout is intended as an example of how to create your own custom layout using the item fields array (see below for more information on this).
Images are stored in an images array for each item. The module can handle images embedded in html, the Cobalt image field, and the Cobalt gallery field.
The templates are in the module tmpl folder and can be modified either by editing them or using template overriding. See below for more information on this.
This tab also contains various parameters for setting options specific to particular layouts, also size options for the images and items. The Load Style Sheet option should normally be set to yes, because some layouts do require a style sheet to function correctly. However you can set this to no and put the styling in your template stylesheet if you prefer to minimise page load times.
This tab allows you to select the records that will be displayed in the module. You can do this by section, category, or by selecting individual articles to display. These choices are additive, for example, if you select a category 'international news' and also two articles from another category, the module will display a selection from the category plus the two articles. How it picks them will depend on the ordering option you choose on the basic parameters tab.
You can also choose to display records of a particular type using the select record types option. This option will be applied as an additional restriction to the options chosen for the section, category and records parameters. So in our previous example, if you were to choose a type 'news articles', the module would display only news articles from the category and articles selected.
This tab allows you to select the Cobalt fields that you wish to display in the module. You can select either fields or field types. Alternatively you can leave these as the default values to show all field types.
This tab contains the standard Joomla options for setting a module class suffix and caching options. It is a good idea to turn off the module caching while you are setting it up.
If you wish to use your own custom layout this is easy to do. You can drop your own templates into the tmpl folder (for module layouts) and the tmpl/items folder (for item layouts), the module will detect them and allow you to select them in the module options. Alternatively you can use template overriding to customize existing layouts. This is preferable when using the tab pane, accordion, rotator and highlighter layouts, because some extra scripts need to be loaded for these to function correctly, which the module will do based on the layout name.
You can also add a stylesheet for your custom module layout by dropping it into the css folder, if it has the same name as your custom layout the module will detect and load it.
To customize the item layouts you need to know the following:-
Record fields are stored in an array called fields, indexed by the field label. For example if you have a field labelled 'General Main Text' you can print it using the following code:
{codecitation}
<?php if(isset($item->fields['General Main Text'])): ?>
<span style="float:left;position:relative;z-index:0;">
<?php echo $item->fields['General Main Text']; ?><br />
</span>
<?php endif; ?>
{/codecitation}
Or just
{codecitation}
<?php echo $item->fields['General Main Text']; ?>
{/codecitation}
The first version of the code includes a test to see if the field exists for that particular record. It will prevent a PHP warning message being generated if the field does not exist, so is a good idea, but is not essential.
The html for the images for the article are stored in an images array, and can be accessed using the following code:-
{codecitation}
<?php foreach($item->images as $value): ?>
<?php echo $value; ?>
<?php endforeach; ?>
{/codecitation}
This code will output an html image tag for each image. If the article includes a gallery field this can be output using the following:-
{codecitation}
<?php echo $item->gallery; ?>
{/codecitation}
The record read more link can be output using:-
{codecitation}
<?php echo $item->readmore; ?>
{/codecitation}
The module also generates an extract from the article html, which can be output using:-
{codecitation}
<?php echo $item->extract; ?>
{/codecitation}
More help is available from our support forum: http://www.spiralscripts.co.uk/component/option,com_kunena/Itemid,79/func,entrypage/view,entrypage/