Hallo,
ich möchte erreichen, dass beim Überfahren eines Glossarbegriffs mit dem Mauszeiger in einem DIV-Container der Randspalte die zugehörige Erläuterung (description) erscheint.
Eine einfache Erweiterung der Glossary-Extension um das folgende Schnipsel führte zwar zu einem ersten Erfolg. Es konnten jedoch keine Links innerhalb des onmouseover-Attributs dargestellt werden, da der Browser mit den verschachtelten Anführungszeichen im HTML-Code nicht klar kommt.
PHP-Code:
$onMouseOverText = $cObj->parseFunc($row['description'],$conf,$ref='< lib.parseFunc_RTE');
$onMouseOver = ' onmouseover="document.getElementById(\'glossary\').innerHTML = \''.$onMouseOverText.'\';"';
// ...
$GLOBALS['TSFE']->register['onMouseOver'] = $onMouseOver;
$before = '<'.$element.$lang.$title.$onMouseOver.'>';
$after = '</'.$element.'>';
Den zweiten Versuch habe ich mit Ajax (xajax) gestartet, um die Erläuterung aus der a21glossary-Datenbank dynamisch nachzuladen. Die Funktion zum Abruf der DB-Inhalte läuft schon. Nun habe ich das Problem, dass die a21glossary-Extension erst angestoßen wird, nachdem die Seite erstellt wurde. Eintrag in ext_localconf.php:
PHP-Code:
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all']['tx_a21glossary'] = 'EXT:a21glossary/class.tx_a21glossary.php:&tx_a21glossary->convertGlossaryWords';
Dadurch bleibt (wahrscheinlich) die Instanzierung des xajax-Objekts innerhalb der Klasse class.tx_a21glossary.php und damit der Eintrag des Java-Scripts in den Header durch folgenden Code innerhalb der Funktion convertGlossaryWords wirkungslos:
PHP-Code:
// instantiate the xajax object and configure it
require (t3lib_extMgm::extPath('xajax') . 'class.tx_xajax.php');
$this->xajax = t3lib_div::makeInstance('tx_xajax');
$this->xajax->decodeUTF8InputOn();
$this->xajax->setCharEncoding('utf-8');
$this->xajax->setWrapperPrefix($this->prefixId);
// Register the names of the PHP functions you want to be able to call through xajax
// $xajax->registerFunction(array('functionNameInJavascript',&$object,'methodName'));
$this->xajax->registerFunction(array('processGlossaryRequest', &$this, 'processGlossaryRequest'));
// If this is an xajax request call our registered function, send output and exit
$this->xajax->processRequests();
// Else create javacript and add it to the normal output
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId] = $this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax'));
Nun meine konkreten Fragen:
- Gibt es noch eine dritten Ansatz zur Lösung das grundlegende Problems?
- Wie kann ich das xajax-Objekt sauber instanzieren?
Vielen Dank im Voraus für die Hilfe
Jochen