...po co sie tak wczuwac w role moderatora, proponuje odpowiedziec odrazu, bedzie mniej postow nie na temat:)
<?php
$b = array( 'firma1', 'firma2', 'firma3' ); $c = array( 'a@a.pl', 'b@b.pl', 'c@c.pl' ); $d = array( '123', '456', '789' );
'company' => $b,
'mail' => $c,
'phone' => $d );
$html = '{@wiersze}
<tr>
<td colspan=4> </td>
</tr>
<tr>
<td>{id} </td>
<td>{company}</td>
<td><a href=\"mailto:{mail}\">{mail}</a></td>
<td>{phone}</td>
</tr>
{/@wiersze}';
function getRows( $html, $x )
{
$new = '';
$lin = '';
preg_match_all( '/({@wiersze})(.*?)({/@wiersze})/is', $html, $matches );
for( $i = 0; $i < count( $x['id'] ); $i++ ) {
foreach( $match[2] as $a => $k )
{
echo '{'. $match[2
][$a] .'}' .' - '. $x[$k][$i] .'<br />'; //wynik prawidlowy
$arrName[] = '{'. $match[2][$a] .'}';
$arrValue[] = $x[$k][$i];
$new = str_replace( $arrName, $arrValue, $matches[2
][0
] ); }
$lin .= $new;
}
echo $lin; // tworzy 3 wiersze, ale dane sa wszedzie takie same! }
echo '<table border=1 width=300>';
getRows( $html, $x );
?>
Proponuje skopiowac kod i przetestowac u siebie:)