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 Expander plugin in action

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:


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]:
  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>
  2. 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');
    ?>