[TYPO3] EXT programming question

Benjamin Mack bmack at kirix.com
Mon Oct 16 11:42:50 CEST 2006


Hey,

this is a typical PHP expression and has nothing to do with TYPO3. With

   $content = 'My Text';

you always set the $content variable again and override the value stored 
before in the variable. With

   $content .= 'My Text';

which is a shortcut for:

   $content = $content . 'My Text';

you set the variable with the old content AND the appending text.

greetings,
benni.
-SDG-


Rocky wrote:
> Hey,
> 
> In my EXT, I'm listing the records from an external Database table. 
> Below are the code I'm using.
> 
> /------------------snip begin--------------/
> 	foreach ($compr as $key=>$value){
> 		  $content='
>                           <h5>Hello, World!</h5>
>                           <p>'.$key.':'.$value.'</p>
> ';}
> 
> /------------------snip end---------------/
> 
> It only print out the last array item.
> 
> but with the same DB connection the following codes gives me all the items
> 
> /----------snip begin---------------/
> foreach ($compr as $key=>$value){
> 	echo $key."as".$value;	
> }
> /-----------snip end-------------/
> 
> The problem is this is not the typo3 way of out puting the content. Can 
> any of you give a hint on how to show the array items using $content 
> varable in EXT's class file please?
> 
> Thanks in advance!
> Rocky
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> 



More information about the TYPO3-english mailing list