[TYPO3-Solr] Using tx_solr_viewhelper_AbstractSubpartViewHelper

Heiko Kromm | Paints h.kromm at paints.de
Fri Oct 28 11:28:56 CEST 2011


Hi Ingo, 

with the templates I made a mistake. I will get the correct subpart. 
The problem is, that you can't add a simple value to a variable like this: 
$template->addVariable('mytest', 'Testcontent'); 
You have to submit an array like this: 
$template->addVariable('mytest', array('var1'=>'Test','var2'=>'Test2')); 

This is because of the getVariableMarkers method in tx_solr_template. 
There is a preg_match_all, which only allows markers of the kind <marker>.<subvalue>. 
preg_match_all( 
'!###(' . $variableMarker . '\.[A-Z0-9_-]*)\###!is', 
$subpart, 
$match 
); 
$markers = array_unique($match[1]); 

I think there should be a different regexp or a hint on the addVariable method. 

Regards 
Heiko 




Von: "Heiko Kromm | Paints" <h.kromm at paints.de> 
An: "Apache Solr search for TYPO3 project" <typo3-project-solr at lists.typo3.org> 
Gesendet: Freitag, 28. Oktober 2011 10:27:51 
Betreff: Re: [TYPO3-Solr] Using tx_solr_viewhelper_AbstractSubpartViewHelper 

Hi Ingo, 

this is my execute method: 
public function execute(array $arguments = array()) { 
$template = clone $this->template; 
t3lib_div::devLog('template Content','solr',1,array($this->template->getTemplateContent())); 
t3lib_div::devLog('template Content Cloned','solr',1,array($template->getTemplateContent())); 
$template->addVariable('mytest', 'Testvariable'); 
return $template->render(); 
} 

As you can see I checked the template content for the template and the cloned template. 
While $this->template has template content, the cloned template has no template content. It's completely empty. 

Regards 
Heiko 




Von: "Ingo Renner" <ingo at typo3.org> 
An: typo3-project-solr at lists.typo3.org 
Gesendet: Donnerstag, 27. Oktober 2011 12:50:27 
Betreff: Re: [TYPO3-Solr] Using tx_solr_viewhelper_AbstractSubpartViewHelper 

Am 26.10.11 19:08, schrieb Heiko Kromm | Paints: 



> 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### 

that should work. Maybe you can post the code or the extension? 



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 
_______________________________________________ 
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