[TYPO3-mvc] How to solve "Duplicate variable declarations!"
Henjo Hoeksma
me at henjohoeksma.nl
Sun Jul 17 17:41:45 CEST 2011
On 2011-07-17 17:32:46 +0200, Sebastian Schreiber said:
> Hi,
> the variable $key is never defined.
> Maybe that´s your problem here.
>
> Am 17.07.2011 17:27, schrieb Henjo Hoeksma:
>> Hi list,
>>
>> for a category structure I created a forViewhelper that gives all the
>> objects back that have the uid of the parents set.
>>
>> Fluid:
>> <c:categoryTree category="{category.uid}" as="subcategory">
>>
>> ViewHelper:
>> /**
>> *
>> * @param integer $category
>> * @param string $as The name of the iteration variable
>> * @return string
>> */
>> public function render($category,$as) {
>> $categoryRepository =
>> t3lib_div::makeInstance('Tx_Peproducts_Domain_Repository_CategoryRepository');
>> // Singleton
>> $categories = $categoryRepository->findByParent($category);
>> foreach($categories as $keyValue => $value){
>> $this->templateVariableContainer->add($as, $value);
>> $this->templateVariableContainer->add($key, $keyValue);
>> $output .= $this->renderChildren();
>> $this->templateVariableContainer->remove($as);
>> $this->templateVariableContainer->remove($key);
>> }
>> return $output;
>> }
>>
>> For one layer this works perfect. I want to add an extra sublayer like this:
>> <c:categoryTree category="{category.uid}" as="subcategory">
>> {subcategory.uid}
>> <c:categoryTree category="{subcategory.uid}" as="subsubcategory">
>> {subsubcategory.uid}
>> </c:categoryTree>
>> </c:categoryTree>
>>
>> This results in a "Duplicate variable declarations!" error.
>> I tried to modify the viewhelper to also give back child categories, to
>> no avail.
>>
>> Can somebody point me in the good direction? I'm kinda stuck here :-(
>>
>> Thanks in advance.
>>
>> Henjo
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
Hi Sebastian,
thanks for your response. Brilliant! How could I have overlooked!
Thanks!
Henjo
More information about the TYPO3-project-typo3v4mvc
mailing list