[TYPO3-Solr] Using tx_solr_viewhelper_AbstractSubpartViewHelper

Heiko Kromm | Paints h.kromm at paints.de
Wed Oct 26 19:08:35 CEST 2011


Hi Ingo, 

could you tell me how I have to assign the variables? 
I did it this way: 
Added variable: 
$template->addVariable('mytest', 'Show Test'); 

Tried to output it in the template 
###MYTEST### 

But there will be no output. 

I debugged the variables in tx_solr_template and the variable is in the $this->variables array . 
My variable is in 
$this->variables['mytest'] 
all the other variables I use are in the results sub array (e.g.). 
$this->variables['results']['searched_for'] 

Regards 
Heiko 



Von: "Ingo Renner" <ingo at typo3.org> 
An: typo3-project-solr at lists.typo3.org 
Gesendet: Mittwoch, 26. Oktober 2011 17:25:16 
Betreff: Re: [TYPO3-Solr] Using tx_solr_viewhelper_AbstractSubpartViewHelper 

Am 25.10.11 17:26, schrieb Heiko Kromm | Paints: 

Hi Heiko, 

> are there any examples on how to use the tx_solr_viewhelper_AbstractSubpartViewHelper? 
> I found the tx_solr_viewhelper_Facet viewhelper, but I don't see how this works. 

That's the only implementation of the subpart view helper currently. 

> I would like to create a viewhelper for my custom indexed elements. I'm thinking about something like this: 
> 
> <!-- ###IF:###RESULT_DOCUMENT.TYPE###|==|myelement### begin --> 
> <!-- ###MYELEM:###RESULT_DOCUMENT.UID###### begin --> 
> <h1>###MYELEM_ITEM.title###</h1> 
> ###MYELEM_ITEM.img### 
> <!-- ###MYELEM:###RESULT_DOCUMENT.UID### ### end --> 
> <!-- ###IF:###RESULT_DOCUMENT.TYPE###|==| myelement ### end --> 
> 
> MYELEM should be my own viewhelper and it should set the variable MYELEM_ITEM with data fetched from the database, depending on the uid submitted to the viewhelper. 

The template object is set in $this->template, like in the facet 
viewhelper, clone it, assign your variables and/or subparts and render 
it. Then return the rendered result. 


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