DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
overLIB¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | René Fritz |
Changed: | 2003-06-23T14:49:31 |
Author: | René Fritz |
Email: | r.fritz@colorcube.de |
Info 3: | |
Info 4: |
overLIB¶
Extension Key: overlib
Copyright 2000-2002, René Fritz, <r.fritz@colorcube.de>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: overLIB 1
Introduction 1
Users manual 1
Configuration 2
Reference 2
Known problems 3
Introduction¶
overLIB is a JavaScript library (by Erik Bosrup) to show tooltips on HTML pages. This extension provide overLIB itself and a PHP library to create tooltips easily from PHP.
This extension is only useful for PHP developers!
overLIB is a third party library (independent from TYPO3) and uses it's own license. For license check and further documentation of overLIB go to http://www.bosrup.com/web/overlib/
Users manual¶
Have a look at the extension Tooltip Tag (cc_typotag_tooltip) which is a good example for overlib usage.
Example code¶
Here's example code how to use the PHP class tx_overlib. The examples goes through an array of records and creates and returns an array with links including tooltips.
The red lines are calls of the class tx_overlib. Green lines show configuration that will be passed to the tx_overlib functions.
First of all the tx_overlib class needs to be included:
require_once(t3lib_extMgm::extPath("overlib")."class.tx_overlib.php");
A function of our example class:
/**
* returns an array of glossary terms
*/
function main($shortArr,$conf){
$conf["termMinLength"]=$conf["termMinLength"]?$conf["termMinLength"]:3;
$conf["linkTermAppend"]=$conf["linkTermAppend"]?$conf["linkTermAppend"]:'<span style="color:#b00">*</span>';
tx_overlib::setDefaults($conf["overlibDefaults."]);
tx_overlib::includeLib();
if (!is_array($shortArr)) {
$shortArr = array();
}
$shortRows = $this->getList($conf);
if (count($shortRows)) {
$config = $conf["overlibConfig"];
$aTagParams = $conf["ATagParams"];
reset($shortRows);
while(list(,$row)=each($shortRows)) {
$caption = $conf["overlibFixedCaption"] ? $conf["overlibFixedCaption"]: ($conf["overlibCaption"] ? $row["term"] : "");
$desc = $row["tooltip"]?$row["tooltip"]:$row["description"];
$desc=trim(implode("<br \>",t3lib_div::trimExplode(chr(10),htmlspecialchars($desc),0)));
if (strlen($row["term"])>=$conf["termMinLength"] AND $desc) {
if ($conf["linkWholeTerm"]) {
$shortArr[$row["term"]]=tx_overlib::linkToolTip($row["term"].$conf["linkWholeTermAppend"], t3lib_div::slashJS($desc), $aTagParams,$caption,$config);
} else {
$shortArr[$row["term"]]=$row["term"].tx_overlib::linkToolTip($conf["linkTermAppend"], t3lib_div::slashJS($desc), $aTagParams,$caption,$config);
}
}
}
}
return $shortArr;
}
Please note that the class can be used without making an instance: tx_overlib::includeLib()
Configuration¶
Default values of overLIB can be set by TypoScript:
plugin.tx_overlib.defaults {
ol_fgcolor = "#eeeeee"
ol_bgcolor = "#666666"
}
You can use tx_overlib::setDefaults() (see below) to set your own default values from your plugin. For now it sets also the global default values which may change later so you will be able to use more than one tooltip look on your page.
Reference¶
((generated))¶
TypoScript¶
Property
defaults
Data type
array of strings
Description
See overLIB Documentation for configuration values.
Example:
plugin.tx_overlib.defaults {
ol_fgcolor = "#eeeeee"
ol_bgcolor = "#666666"
}
Default
[tsref:plugin.tx_overlib]
PHP functions in class tx_overlib¶
Function/Property
includeLib()
Data type
Description
Include the overLIB library and other data for page rendering.
Any configuration has to be done before with functions setDefaultValue()/setDefaults().
Default
Function/Property
setDefaultValue()
Data type
Description
Set configuration values of overLIB.
Default
Function/Property
$name
Data type
string
Description
'ol_fgcolor'
Default
Function/Property
$value
Data type
string
Description
'"#eeeeee"'
Default
Function/Property
setDefaults()
Data type
Description
Set configuration values of overLIB per array.
Default
Function/Property
$arr
Data type
array
Description
array('ol_fgcolor' => '"#eeeeee"')
Default
Function/Property
linkToolTip()
Data type
Description
Default
Function/Property
$linkContent
Data type
string
Description
String that should be linked.
Default
Function/Property
$boxContent
Data type
string
Description
The content that should appear inside of the tooltip.
Default
Function/Property
$aTagParams
Data type
string
Description
Additional parameters of the A tag.
Default
“”
Function/Property
$config
Data type
string
Description
overLIB configuration.
'STICKY,WIDTH,250'
Default
“”
Known problems¶
The configuration values which set fonts, colors, and so on, can only be set globally per page. If you want e.g. different colored tooltips on one page you have to pass the corresponding parameters to overLIB in every link.
Changelog¶
rewrite of the overLIB JS code. The JS code is now encapsulated in the var 'overlib'. Should work without changes to your plugins.This was necessary to prevent collision with other JS code.
overLIB - 3