Forum Moderators: coopster
echo "<tr>
<td valign=\"top\"> <a href=\"<?=tep_href_link('product_info.php?products_id='.$new_products['products_id'])?>\"> <?=tep_image(DIR_WS_IMAGES.$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=\"bd\"')?></a></td>
<td width=\"30\"></td>
<td width=\"236\" valign=\"top\"><br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a class=\"ml3\" href=\"<?=tep_href_link('product_info.php?products_id='.$new_products['products_id'])?>\"> <?=$new_products['products_name']?></a><br style=\"line-height:1px;\"> <br style=\"line-height:10px;\">
<?=preg_replace('/\s\S*$/i', '', substr($new_products['products_description'], 0, 120))?>...<br style=\"line-height:1px;\"><br style=\"line-height:9px;\">
<span class=\"tx4\"><?=$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))?></span><br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a href=\"<?=tep_href_link('product_info.php?products_id='.$new_products['products_id'])?>\"> <?=tep_image_button(\"button_details.gif\");?></a> <a href=\"<?= tep_href_link(\"products_new.php\", \"action=buy_now&products_id=\".$new_products['products_id'])?>\"> <?=tep_image_button(\"button_add_to_cart.gif\");?></a>
</td></tr>"; [edited by: eelixduppy at 9:03 pm (utc) on June 24, 2007]
[edit reason] fixed sidescroll [/edit]
Your syntax for string concatenation is incorrect. As an example of how it should be done, it would look like the following (not showing all the code):
echo "<tr>
<td valign=\"top\"> <a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">". tep_image(DIR_WS_IMAGES.$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=\"bd\"')."</a></td>"; #etc...
Try to format the rest of the string the same way and you should be fine. You may want to refer to the string documentation [us2.php.net] for additional information, as well.
Good luck! :)
How it looks:
<a href=\"<?=tep_href_link('product_info.php?products_id='.$new_products['products_id'])?>\"> <?=tep_image_button(\"button_details.gif\");?></a> <a href=\"<?= tep_href_link(\"products_new.php\", \"action=buy_now&products_id=\".$new_products['products_id'])?>\"> <?=tep_image_button(\"button_add_to_cart.gif\");?></a> And how i made it:
<a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">". tep_image_button(\"button_details.gif\");."</a> <a href=\"".tep_href_link(\"products_new.php\", \"action=buy_now&products_id=\".$new_products['products_id'])."\"> ".tep_image_button(\"button_add_to_cart.gif\");."</a> I get 2 errors:
Warning: Unexpected character in input: '\' (ASCII=92) state=1
Parse error: syntax error, unexpected '/'
Note: Don't remove the semi-colon from the very end, though. :)
here is the new echo fully
echo "<td valign=\"top\"> <a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">". tep_image(DIR_WS_IMAGES.$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=\"bd\"')."</a></td>
<td width=\"30\"></td>
<td width=\"236\" valign=\"top\"><br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a class=\"ml3\" href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id']."\">". $new_products['products_name']."</a><br style=\"line-height:1px;\"><br style=\"line-height:10px;\">
".preg_replace('/\s\S*$/i', '', substr($new_products['products_description'], 0, 120))."...<br style=\"line-height:1px;\"><br style=\"line-height:9px;\">
<span class=\"tx4\">".$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))."</span><br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">". tep_image_button(\"button_details.gif\")."</a> <a href=\"".tep_href_link(\"products_new.php\", \"action=buy_now&products_id=\".$new_products['products_id'])."\"> ".tep_image_button(\"button_add_to_cart.gif\")."</a>
</td></tr>";
echo "
<td valign=\"top\"><a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">". tep_image(DIR_WS_IMAGES.$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=\"bd\"')."</a></td>
<td width=\"30\"></td>
<td width=\"236\" valign=\"top\">
<br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a class=\"ml3\" href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id']."\">". $new_products['products_name']."</a>
<br style=\"line-height:1px;\"><br style=\"line-height:10px;\">"
.preg_replace('/\s\S*$/i', '', substr($new_products['products_description'], 0, 120))."...
<br style=\"line-height:1px;\"><br style=\"line-height:9px;\">
<span class=\"tx4\">".$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']))."</span>
<br style=\"line-height:1px;\"><br style=\"line-height:5px;\">
<a href=\"".tep_href_link('product_info.php?products_id='.$new_products['products_id'])."\">".tep_image_button('button_details.gif')."</a>
<a href=\"".tep_href_link('products_new.php', 'action=buy_now&products_id='.$new_products['products_id'])."\">".tep_image_button('button_add_to_cart.gif')."</a>
</td></tr>";