If contents of arrays came from database I suggest to use JOIN in your sql:

SELECT jo.*, jon.name  as job_name
FROM job_offers jo
JOIN job_offers_name jon ON jon.idoffer = jo.idoffer


If you can't do like that you can use something like this:

<tr tal:repeat="offers jobOffers">
<td tal:content="offers/name"></td>
<td tal:content="otherArray/${offers/idoffer}/name"></td>
</tr>


But you must have other array indexed by idoffer like:

array(
    '2' => array(/*offer2*/),
    '5' => array(/*offer5*/),
    ....
    'idofferN' => array(/*offerN*/);
)

and you must be certain whether otherArray/${offers/idoffer}/name exists in otherArray.

Regards
Piotr Kroczyński


W dniu 28.06.2011 16:38, Teis Lindemark pisze:

Hi,

I am new to use PHPTal and so far, I like it. It’s great to separate php code and the xhtml code.

One of my list need some data from two arrays. I have one array array1 that I use tal:repeat=”offers jobOffers” and find the content like this: tal:content=”offers/name” for example. One of the columns in the table have the data in another array, with two columns idoffer and name. The first array also have idoffer (offers/idoffer). But what I need here is that otherarray/name is placed in the row where offers/idoffer and otherarray/idoffer is equal.

I can’t figure this out and have been stuck here for a while.

Hope someone can help me with this one.

Teis


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to