Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

which of these 2 codes is prefered......


Sid04

Recommended Posts

These are for an info box. Both sections of code work fine...just curious if one is prefered over the other...??

 

 

Example 1:

<?php  
  $info_box_contents = array(); 
$info_box_contents[] = array('align' => 'left', 
				  'text'  => MY_TEXT 
			); 
new infoBoxHeading($info_box_contents, false, false); 

$info_box_contents = array();
  $info_box_contents[] = array('align' => 'center',
						   'text'  => tep_image(DIR_WS_IMAGES . 'image.gif')
						);

new infoBox($info_box_contents);
?>

 

 

Second Example:

<?php 
{

  $info_box_contents = array(); 
$info_box_contents[] = array('align' => 'left', 'text'  => MY_TEXT ); 
new infoBoxHeading($info_box_contents, false, false); 

$info_box_contents = array();
$content='<center><img src="images/image.gif"></center>';
$content.= '';	
$info_box_contents[] = array('text' => $content);

new infoBox($info_box_contents);
}
?>

 

Both do the same thing for me....is one better then the other to use for any reason? Thanks!

Link to comment
Share on other sites

Functionally, they are the same. The second one works better if there are a lot of additions to the string in the code. Otherwise, it just increase the complexity of the code and should not be used.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...