Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

InfoBox question


alexone

Recommended Posts

Posted

Hi everybody,

I don't fully understand how the infoBox class works, that's why I'm asking you about this. I'm using "News Desk" contribution and I have something like that:

 

$latest_news_string = '';

$row = 0;
while ($latest_news = tep_db_fetch_array($latest_news_var_query))  {

$latest_news['newsdesk'] = array(
 'name' => $latest_news['newsdesk_article_name'],
 'id' => $latest_news['newsdesk_id'],
 'date' => $latest_news['newsdesk_date_added'],
);

$latest_news_string .= '<a href="';
$latest_news_string .= tep_href_link(FILENAME_NEWSDESK_INFO, 'newsdesk_id=' . $latest_news['newsdesk_id']);
$latest_news_string .= '">';
$latest_news_string .= $latest_news['newsdesk_article_name'];
$latest_news_string .= '</a>';
$latest_news_string .= "\n";

$info_box_contents = array();
$info_box_contents[] = array('params' => 'class="someClass"',
              'text'  => $latest_news_string);
$row++;
}

 

news are displayed in one cell, but I want them to be displayed in separate rows. How can I do it?

 

Thanks for help.

Alex

 

//Sorry for stupid question.

Posted

this code will generate separate rows/cells for each entry, because the whole thing is inside the while statement. The tablebox class generates a table and for each entry in the array builds a row (with 1 or more td cells depending if the array is md)

Posted
this code will generate separate rows/cells for each entry, because the whole thing is inside the while statement. The tablebox class generates a table and for each entry in the array builds a row (with 1 or more td cells depending if the array is md)

 

if you say so... bu it doesn't and I don't know why.. all content is placed in one cell.. thats why I'm so confused.

 

Any suggestions???

Thx

Alex

Posted

oops you right it wont. I missed that earlier. The array is re-initialized every time :lol: nice bug.

 

Move this line

 

$info_box_contents = array();

 

after the

$row = 0;

 

Should work

Posted
oops you right it wont. I missed that earlier. The array is re-initialized every time :lol: nice bug.

 

Move this line

 

$info_box_contents = array();

 

after the

$row = 0;

 

Should work

 

It works! Thanks a lot! Could you please explain what was the problem?

 

Thanks again.

Best regards.

Alex

Posted

basically it was loading the elements to the same entry, over and over again so you ended up with the last entry of the news desk. The code should accumulate them.

Posted
basically it was loading the elements to the same entry, over and over again so you ended up with the last entry of the news desk. The code should accumulate them.

 

Thanks.

 

Last question. Could you tell me how to create for example two cells per row of content using infoBox?

 

Alex.

Posted

you could do that by using a multi-dimensional array of the box contents

 

$your_box_contents[0][] =

 

You can see the includes\modules\product_listing.php file how it sets up the various columns.

Posted
you could do that by using a multi-dimensional array of the box contents

 

$your_box_contents[0][] =

 

You can see the includes\modules\product_listing.php file how it sets up the various columns.

 

Now I understand.

Thanks again.

 

Regards

Alex.

Archived

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

×
×
  • Create New...