[Typo3] problem with array of image

Kraft Bernhard kraftb at gmx.net
Wed Apr 13 17:27:40 CEST 2005


ElRicko wrote:

> How I change the URL?
> typo3temp/pics/fafb7ed308.jpg

I guess you mean that URL. Not at all. It gets generated by T3 and is a time md5 hash.
It is made in such a way to be sure never two files have the same name ...



Just for your coding style:

> $arrayUrl = array();
^^^^ unnecessary if :
> $arrayUrl = t3lib_div::trimExplode(',',  $this->internal["currentRow"][$fN], 1);
arrayUrl gets assigned another value later on.

> for($cpt=0;$cpt < count($arrayUrl); $cpt++)
> {
> 	$imgTSConfig['file'] = 'uploads/tx_userimmobilier/'.$arrayUrl[$cpt];
> 	$content =  $content.$this->cObj->IMAGE($imgTSConfig);
> }

I also was used to make such loops before I found out about php construct "each" but even
better: foreach:

foreach ($arrayUrl as $idx => $val) {
	$imgTSConfig['file'] = 'uploads/tx_userimmobilier/'.$val;
}

the statement $idx => $val means assign $idx the key and $val the value of each array element.

It is better to do it this way. Because not always your arrays will start with "0" as first
element.

PS: Contact my offlist for more PHP instructions ...

greets,
Bernhard
-- 
Kraft Bernhard
MOKKA Medienagentur <http://www.mokka.at>
T: +43 - 1 - 895 33 33 - 50



More information about the TYPO3-english mailing list