Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Arrays!


mark27uk3

Recommended Posts

Hi Guys,

 

I must be doing something right for once as I have only one issue to deal with this morning :P

 

I still can not get the hang of putting html inside an array, no matter how many I look at I still have trouble >_<

 

This is the array code from the featured products contrib

 

  if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
   $info_box_contents[] = array('align' => 'left', 'text' => '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '"><font color="#000000">' . TABLE_HEADING_FEATURED_PRODUCTS . '</font></a>');

 

And this is the code I am trying to insert into that array

 

<tr>
           <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="comingsoon"> <b><?php echo TABLE_HEADING_FEATURED_PRODUCTS; ?> </b></td>
             </tr>
             <tr>
               <td colspan="2"><?php echo tep_draw_separator(); ?></td>
             </tr>
</table></td>

 

So basically it will remove the infobox header and link and replace it with the infobox name 'Featured Products' with a seperator line beneath it.

 

Everytime I try to tackle this I end up with either a parse error or my right column ends up underneath the left!

 

A bit of help would be appreciated!

 

Thanks

 

Mark :thumbsup:

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hi Guys,

 

I must be doing something right for once as I have only one issue to deal with this morning  :P

 

I still can not get the hang of putting html inside an array, no matter how many I look at I still have trouble  >_<

 

This is the array code from the featured products contrib

 

 ?if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
? ?$info_box_contents[] = array('align' => 'left', 'text' => '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '"><font color="#000000">' . TABLE_HEADING_FEATURED_PRODUCTS . '</font></a>');

 

And this is the code I am trying to insert into that array

 

<tr>
? ? ? ? ? ?<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td class="comingsoon"> <b><?php echo TABLE_HEADING_FEATURED_PRODUCTS; ?> </b></td>
? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ?<td colspan="2"><?php echo tep_draw_separator(); ?></td>
? ? ? ? ? ? ?</tr>
</table></td>

 

So basically it will remove the infobox header and link and replace it with the infobox name 'Featured Products' with a seperator line beneath it.

 

Everytime I try to tackle this I end up with either a parse error or my right column ends up underneath the left!

 

A bit of help would be appreciated!

 

Thanks

 

Mark :thumbsup:

 

well, the array is not the problem, just separation of constants and variables.

 

 

if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {

$info_box_contents[] =

array(

 

'align' => 'left',

'text' => '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '"><font color="#000000">' . TABLE_HEADING_FEATURED_PRODUCTS . '</font></a>

<table>

<tr>

<td class="comingsoon"> <b>' . TABLE_HEADING_FEATURED_PRODUCTS . ' </b></td>

</tr>

<tr>

<td colspan="2">' . tep_draw_separator() . '</td>

</tr>

</table>'

);

Treasurer MFC

Link to comment
Share on other sites

Thanks Amanda,

 

I changed it slightly to fit it with the rest of the page like so

 

if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
$info_box_contents[] =
array(

'align' => 'left',
'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="comingsoon"> <b>' . TABLE_HEADING_FEATURED_PRODUCTS . ' </b></td>
</tr>
<tr>
<td colspan="2">' . tep_draw_separator() . '</td>
</tr>
</table>'
);

 

Now I have this I should be able to remember what to do next time :blink:

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...