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

CarpRegisterCallback( object, function, phase [, option] );

Register a callback function with CaRP Evolution
GPL Koi Evolution
n/a n/a >=3.3
Description:
This function is used primarily by plugins to register their functions with CaRP. CaRP will then call those functions at specific points during newsfeed processing.

Arguments:
  1. object - If your plugin is object-oriented, pass an actual object instance here. Otherwise, pass an empty string ("" or '').
  2. function_name - Pass the function or object method name of the callback function here.
  3. phase - Pass the name of the phase of CaRP's processing where you want your callback function called here. The phases, and the value of any options you may pass in option for each are:
    • startelement - Called whenever the XML parser starts parsing a new element of the RSS file. option - You may optionally specify the name of an element, or a regular expression to match the name. If you do, yor callback will only be called when the name matches. The element names will be in the form IMAGE^WIDTH, for example, for the WIDTH child element of an IMAGE element. Any enclosing elements up to and including the CHANNEL element for children of the channel, or ITEM element for children of an item will NOT be included in the name. The callback will be told whether it is inside an item or not, so you will be able to tell the difference between channel and item elements.
    • endelement - Called whenever the XML parser finishes parsing a new element of the RSS file. option - You may optionally specify the name of an element, or a regular expression to match the name, as with startelement.
    • characterdata - Called whenever the XML parser passes data from between XML tags to CaRP. option - You may optionally specify the name of an element, or a regular expression to match the name, as with startelement.
    • outputfield - Called whenever CaRP is about to output some data. option - Optionally, you may specify a field name to only have your function called when processing that field. The field name must be one of the valid values for CaRP's cborder/caorder or iorder configuration variables (link, desc, url, image, etc.)
    • handlefield - Similar to outputfield, but used with custom field names which have been registered with CaRP using the CarpMapField function. option - Indicate the name of the custom field.
    • displaychannel - Called just before CaRP displays the channel section of the newsfeed. option - n/a
    • displayitem - Called just before CaRP displays a newsfeed item. option - n/a
    • startprocessing - Called a little after CarpShow, CarpFilter or CarpAggregate is called, but before the remote newsfeed is loaded. option - n/a
    • endprocessing - Called Just before CarpShow, CarpFilter or CarpAggregate completes. option - n/a
    • carpconfreset - Called whenever CarpConfReset is called, just after CaRP's configuration has been reset to its default values, but before any of them have been overridden if the user has a carpconf.php file. option - n/a
  4. option - See the options listed for each phase above.

Return value: none

Usage Example: Refer to one of the plugins included with CaRP Evolution for an example.

Callback Function Prototypes
The prototypes for your callback functions will differ depending on the phase for which they are registered, as follows: