[TYPO3-mvc] How to solve "Duplicate variable declarations!"

Sebastian Schreiber me at schreibersebastian.de
Sun Jul 17 17:44:29 CEST 2011


you are welcome.

Am 17.07.2011 17:41, schrieb Henjo Hoeksma:
> 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
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


-- 
Sebastian Schreiber
(Medieninformatiker)
(TYPO3 Certified Integrator)

Sülzburgstraße 36
D-50937 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 219 / 5302 / 2302



More information about the TYPO3-project-typo3v4mvc mailing list