[TYPO3-german] indexed search Suchergebnisliste "Mehr" Link

Chris Bernhard chris at dreamride.de
Mon Feb 1 17:50:15 CET 2010


Okay, hat sich erledigt!
Eine andere Extension hatte bereits die tx_indexedsearch erweitert,
somit haben sich beide Extensions überlagert!

Danke und beste Grüße,

Chris

Am 01.02.2010 16:05, schrieb Chris Bernhard:
> Hi zusammen,
>
> hab mich jetzt dazu entschlossen, das Ganze via XCLASS zu machen.
>
> Hier ist also meine Klasse in meiner Extension:
>
> class ux_tx_indexedsearch extends tx_indexedsearch {
> var $prefixId = 'ux_tx_indexedsearch'; // Same as class name
> var $scriptRelPath = 'class.ux_tx_indexedsearch.php'; // Path to this
> script relative to the extension dir.
> var $extKey = 'tx_cbmorelink'; // The extension key.
> var $pi_checkCHash = true;
>
> /**
> * The main method of the PlugIn
> *
> * @param string $content: The PlugIn content
> * @param array $conf: The PlugIn configuration
> * @return The content that is displayed on the website
> */
>
> function prepareResultRowTemplateData($row, $headerOnly) {
>
> // Initialize:
> $specRowConf = $this->getSpecialConfigForRow($row);
> $CSSsuffix = $specRowConf['CSSsuffix']?'-'.$specRowConf['CSSsuffix']:'';
>
> // If external media, link to the media-file instead.
> if ($row['item_type']) { // External media
> if ($row['show_resume']) { // Can link directly.
> $title = '<a
> href="'.htmlspecialchars($row['data_filename']).'">'.htmlspecialchars($this->makeTitle($row)).'</a>';
>
> // INSERTED BY CHRIS
> $more = '<a href="'.htmlspecialchars($row['data_filename']).'">Mehr</a>';
> } else { // Suspicious, so linking to page instead...
> $copy_row = $row;
> unset($copy_row['cHashParams']);
> $title =
> $this->linkPage($row['page_id'],htmlspecialchars($this->makeTitle($row)),$copy_row);
>
> // INSERTED BY CHRIS
> $more =
> $this->linkPage($row['page_id'],htmlspecialchars($this->makeTitle($row)),$copy_row);
>
> }
> } else { // Else the page:
>
> // Prepare search words for markup in content:
> if ($this->conf['forwardSearchWordsInResultLink']) {
> $markUpSwParams = array('no_cache' => 1);
> foreach ($this->sWArr as $d) {
> $markUpSwParams['sword_list'][] = $d['sword'];
> }
> } else {
> $markUpSwParams = array();
> }
> $title =
> $this->linkPage($row['data_page_id'],htmlspecialchars($this->makeTitle($row)),$row,$markUpSwParams);
>
> // INSERTED BY CHRIS
> $more = $this->linkPage($row['data_page_id'],'Mehr',$row,$markUpSwParams);
> }
>
> $tmplContent = array();
> $tmplContent['title'] = $title;
> // INSERTED BY CHRIS
> $tmplContent['morelink'] = $more;
> $tmplContent['result_number'] = $this->conf['show.']['resultNumber'] ?
> $row['result_number'].': ' : '&nbsp;';
> $tmplContent['icon'] =
> $this->makeItemTypeIcon($row['item_type'],'',$specRowConf);
> $tmplContent['rating'] = $this->makeRating($row);
> $tmplContent['description'] =
> $this->makeDescription($row,$this->piVars['extResume'] &&
> !$headerOnly?0:1);
> $tmplContent = $this->makeInfo($row,$tmplContent);
> $tmplContent['access'] = $this->makeAccessIndication($row['page_id']);
> $tmplContent['language'] = $this->makeLanguageIndication($row);
> $tmplContent['CSSsuffix'] = $CSSsuffix;
>
> // Post processing with hook.
> if ($hookObj =
> $this->hookRequest('prepareResultRowTemplateData_postProc')) {
> $tmplContent =
> $hookObj->prepareResultRowTemplateData_postProc($tmplContent, $row,
> $headerOnly);
> }
>
> return $tmplContent;
> }
> }
>
> In meiner ext_localconf.php steht folgendes:
>
> <?php
> if (!defined ('TYPO3_MODE')) {
> die ('Access denied.');
> }
>
> $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/pi/class.tx_indexedsearch.php']
> = t3lib_extMgm::extPath($_EXTKEY).'class.ux_tx_indexedsearch.php';
>
> ?>
>
> Wenn ich nun die Extension installiere, bleibt der Bildschirm nach
> erfolgter Suche leer. Hat vielleicht jemand ne Idee, wie man die
> prepareResultRowTemplateData Funktion überschreiben kann?
>
> Rein theoretisch müsste es ja so funktionieren...
>
> Vielen Dank und beste Grüße,
>
> Chris
>
> Am 01.02.2010 13:56, schrieb Chris Bernhard:
>> Hi mal wieder :-)
>>
>> Hab jetzt die ganze Sache folgendermaßen gelöst. Quick and dirty:
>>
>> function prepareResultRowTemplateData($row, $headerOnly) {
>>
>> // Initialize:
>> $specRowConf = $this->getSpecialConfigForRow($row);
>> $CSSsuffix = $specRowConf['CSSsuffix']?'-'.$specRowConf['CSSsuffix']:'';
>>
>> // If external media, link to the media-file instead.
>> if ($row['item_type']) { // External media
>> if ($row['show_resume']) { // Can link directly.
>> $title = '<a
>> href="'.htmlspecialchars($row['data_filename']).'">'.htmlspecialchars($this->makeTitle($row)).'</a>';
>>
>>
>> // INSERTED BY CHRIS
>> $more = '<a href="'.htmlspecialchars($row['data_filename']).'">Mehr</a>';
>> } else { // Suspicious, so linking to page instead...
>> $copy_row = $row;
>> unset($copy_row['cHashParams']);
>> $title =
>> $this->linkPage($row['page_id'],htmlspecialchars($this->makeTitle($row)),$copy_row);
>>
>>
>> // INSERTED BY CHRIS
>> $more =
>> $this->linkPage($row['page_id'],htmlspecialchars($this->makeTitle($row)),$copy_row);
>>
>>
>> }
>> } else { // Else the page:
>>
>> // Prepare search words for markup in content:
>> if ($this->conf['forwardSearchWordsInResultLink']) {
>> $markUpSwParams = array('no_cache' => 1);
>> foreach ($this->sWArr as $d) {
>> $markUpSwParams['sword_list'][] = $d['sword'];
>> }
>> } else {
>> $markUpSwParams = array();
>> }
>> $title =
>> $this->linkPage($row['data_page_id'],htmlspecialchars($this->makeTitle($row)),$row,$markUpSwParams);
>>
>>
>> // INSERTED BY CHRIS
>> $more =
>> $this->linkPage($row['data_page_id'],'Mehr',$row,$markUpSwParams);
>> }
>>
>> $tmplContent = array();
>> $tmplContent['title'] = $title;
>> // INSERTED BY CHRIS
>> $tmplContent['morelink'] = $more;
>>
>> .....
>>
>> Bei nem Update von Typo3 ist die Sache natürlich wieder futsch.
>> Wie kann ich denn die
>>
>> function prepareResultRowTemplateData
>>
>> mit nem Hook überschreiben? Das leuchtet mir jetzt noch nicht so ganz
>> ein.
>>
>> Vielen Dank und beste Grüße,
>>
>> Chris
>>
>>
>> Am 31.01.2010 20:53, schrieb Chris Bernhard:
>>> Hi zusammen,
>>>
>>> ich möchte in die Suchergebnisliste von Indexed Search
>>> einen "Mehr..." Link integrieren.
>>>
>>> Mit Bordmitteln scheint das ja nicht möglich zu sein,
>>> da der Marker ###TITLE### ja einen kompletten Link rendert.
>>>
>>> Gibts für meine Zwecke bereits einen entsprechenden Marker,
>>> den ich eventuell übersehen habe oder soll ich hierfür
>>> einen kleinen Hook schreiben? Was schlagt Ihr denn vor?
>>>
>>> Dankeschön und beste Grüße vom Chris


More information about the TYPO3-german mailing list