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
Getting Started: Free Download | Purchase | Install
Reference: Functions | Plugins | Themes | Full Index
Etc.: Display Formatting | Example Code | Affiliates
Expander
Expander is a plugin bundled with CaRP Evolution 4.0.12 and higher. It enables the easy creation of "show more" and "show less" links to toggle between the display of just the first part of the description and the full description.Installation:
To install Expander, if "expander.php" is not already found in your "plugins" folder, upload it to that folder.
Use:
To tell CaRP Evolution to use the Expander plugin, use this code:
CarpLoadPlugin('expander.php');
Configuration:
The Expander plugin has the following settings, which are members of the array $expandercarpconf:
- summary-length:
The number of characters to display in the summary.
Set to zero to only show a "show more" link and no summary.
The default value is 120 characters.
- more:
The text for the "show more" link.
It may contain HTML code.
The default is <i>(show more)</i> (ie. (show more) in italics).
- less:
The text for the "show less" link.
It may contain HTML code.
The default is <i>(show less)</i> (ie. (show less) in italics).
- open-class:
The name of the CSS class of the DIV in which the expanded description is displayed.
The default is "expandercarpopen".
The plugin does not use this class -- it sets it so that if you wish,
you may use this class to control the styling of the description.
- closed-class:
The name of the CSS class of the DIV in which the summary description is displayed.
The default is "expandercarpclosed".
- expander-number-code:
A code that CaRP uses when aggregating feeds to ensure that each item's description has a unique ID.
The default is "<!--expandercarpnum-->".
The code is replaced with a number when the feeds are aggregated.
There is little chance you'll ever need to change this setting.
- method: [Expander >= 1.1]
"expand" to replace the "summary" with the longer description when the "more" link is clicked (this is the default).
"hover" to display the description in a hovering box when the headline link is moused over.
See the example below for additional CSS code required for the "hover" method.
Example Code:
Here's the simplest code required to use the Expander plugin:<?php require_once '/YOUR/PATH/TO/carp/carp.php'; CarpLoadPlugin('expander.php'); CarpCacheShow('http://example.com/the-feed.rss'); ?>
This example that displays up to 80 characters of "summary" by default, and all of the description when the "more" link is clicked. It also changes the text of the "more" link to "(show all)":
<?php require_once '/YOUR/PATH/TO/carp/carp.php'; CarpLoadPlugin('expander.php'); $expandercarpconf['summary-length']=80; $expandercarpconf['more']='<i>(show all)</i>'; CarpCacheShow('http://example.com/the-feed.rss'); ?>
To use the "hover" method [Expander >= 1.1]:
- Add this code somewhere between the <head> and </head> tags in your webpage
(edit the position, colors, etc. as desired -- just be sure to keep the position "absolute" and use a high z-index):
<style type="text/css"> .expandercarpopen { position:absolute; z-index:50000; top:3px; left:15px; width:300px; border:1px solid #999; background-color:#eee; padding:5px 8px; } </style>
- Display the feed with code something like this:
<?php require_once '/YOUR/PATH/TO/carp/carp.php'; CarpConf('iorder','link,desc'); CarpLoadPlugin('expander.php'); $expandercarpconf['method']='hover'; $expandercarpconf['summary-length']=0; CarpCacheShow('http://example.com/the-feed.rss'); ?>