CaRP Evolution Box
Web This Site

CaRP: Caching RSS Parser - Documentation


CaRP Interactive FAQ
Getting Started: Free Download | Purchase | Install
Reference: Functions | Plugins | Themes | Full Index
Etc.: Display Formatting | Example Code | Affiliates

See the Flex Format plugin in action

Flex Format

Flex Format is a plugin bundled with CaRP Evolution. It enables you to apply different formatting to individual newsfeed items. For example, you might display the headline and full description for the first three items, the headline and up to 200 characters of the description for the next five, and just the headlines of the rest. You can also vary fonts, colors, and other formatting for different items.
 
Installation:
To install Flex Format, put flexformat.php into the "plugins" folder inside the folder containing carp.php. (If no plugins folder exists, create one.)
 
Use:
To use this plugin, do the following:
  1. Enter the following command into your webpage after "require_once '/path/to/carp.php';":
    CarpLoadPlugin('flexformat.php');
  2. Use CarpConf as usual to set up the formatting of the first item.
  3. Specify any formatting changes you wish to apply for later items as follows:
    FlexFormatConf(item number, option name, value [, skip]);
    • Set item number to 1 for the first newsfeed item, 2 for the second, and so on.
    • All items beginning with the number specified will be affected by the change. option name and value are the same as for CarpConf. Most options related to the appearance of items can be modified using this plugin.
    • skip (available in CaRP Evolution 4.0 and higher only) is an optional parameter. If omitted, it's default value is 0. Setting it to a non-zero number causes FlexFormat to repeat the specified setting, skipping the specified number of items between operations. For example, to make the item titles alternatively bold and non-bold, you could use these settings:
      FlexFormatConf(1, 'ilinkstyle', 'font-weight:bold;', 1);
      FlexFormatConf(2, 'ilinkstyle', '', 1);

Example:
CarpConf('iorder','link,desc');
CarpConf('maxidesc',0);
FlexFormatConf(4,'maxidesc',200);
FlexFormatConf(9,'iorder','link');
FlexFormatConf(9,'bilink','• ');
This example will show the headline link and full description for the first three items. Beginning with item 4, it will truncate the description to 200 characters if it is longer. Beginning with item 9, it will only show the link, and will display a bullet (•) in front of the headline link.