[TYPO3-ect] Copying data from the model to teh view....

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Mar 7 13:14:37 CET 2007


R. van Twisk wrote: on 04.03.2007 05:12:

>> in your template
>> <?php
>> $model=$this->get('model');
>> ?>
>> hi <?= $model->get('name');?>
>>

> I don't use phpView, but instead I use smarty.
> So basically I don't want to interact with the view (lib_object)
> but I prefer to operate directly on the dataset.
> 
> I don't think I can do this easily in smarty:

You can.

> {section name=loop value=$model->get('dataSetArray')}
> ....<how to get the row for each loop to show the data????>
> {/section}
>
> Normally I would do this:
> 
> {section name=loop value=$dataSetArray}
>    {$dataSetArray[loop].name}<br />
>    {$dataSetArray[loop].image}<br />
>    {$dataSetArray[loop].otherVar}<br />
> {/section}

Just assign the value first to a var in your template:

	{assign var=dataSet value=$model->get('dataSetArray')}

Then your later loop will work as you already have it.

Works?

Cheers,
Ernesto


More information about the TYPO3-team-extension-coordination mailing list