[TYPO3-Solr] ViewHelper

Heiko Kromm | Paints h.kromm at paints.de
Wed Aug 31 17:07:51 CEST 2011


Hi Ingo, 

thanks for your answer. 
Using the hook works. I've build a class, which extends tx_solr_ViewHelperProvider, which returns the key and an instance of my ViewHelper 

class tx_myaddviewhelper implements tx_solr_ViewHelperProvider { 

public function getViewHelpers() { 
$myViewHelpers = array( 
'daterange' => t3lib_div::makeInstance('tx_my_viewhelper_daterange'), 
); 

return $myViewHelpers; 
} 

} 

This class is added to the hook in my ext_localconf: 
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['pi_results']['addViewHelpers'][] = 'EXT:myext/class. tx_myaddviewhelper .php:& tx_myaddviewhelper '; 

Now I can use the ViewHelper with the name daterange. 

Before I build my own date-ViewHelper. There is a data-ViewHelper in the solr-Extension, but it needs a timestamp. In my resultset I don't have the timestamp, but the UTC-Time from solr. ( 2011-08-24T19:35:00Z ) 
Is there a way to get a timestamp in the resultset instead the UTC-Time, so I may use your date-ViewHelper? 

Thanks 
Heiko 



Von: "Ingo Renner" <ingo at typo3.org> 
An: typo3-project-solr at lists.typo3.org 
Gesendet: Mittwoch, 31. August 2011 13:01:44 
Betreff: Re: [TYPO3-Solr] ViewHelper 

Am 26.08.11 15:43, schrieb Heiko Kromm | Paints: 

Hello Heiko, 

> is it possible to create own ViewHelpers? 
> I want to add a daterange to the searchbox and would like to use a viewhelper there. 

should be possible. Please check tx_solr_Template 

addViewHelper() 
addViewHelperIncludePath() 
addViewHelperObject() 

In tx_solr_pluginbase_PluginBase check initializeTemplateEngine() 
There's a hook to add your tx_solr_ViewHelperProvider (interface). 

The method also shows how to add your viewhelpers. You need to hook into 
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$this->getPluginKey()]['addViewHelpers'], 
where is resolved per EXT:solr plugin: pi_results, pi_search, and some 
more in EAP... 

Please let me know if that works for you and how you did it in the end 
since I only prepared the extension to be extendable in that area but 
never really tested it yet. 

HTH 
Ingo 


-- 
Ingo Renner 
TYPO3 Core Developer, Release Manager TYPO3 4.2, Admin Google Summer of Code 

TYPO3 - Open Source Enterprise Content Management System 
http://typo3.org 

Apache Solr for TYPO3 - 
Open Source Enterprise Search meets Open Source Enterprise CMS 
http://www.typo3-solr.com 
_______________________________________________ 
TYPO3-project-solr mailing list 
TYPO3-project-solr at lists.typo3.org 
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-solr 


More information about the TYPO3-project-solr mailing list