Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

add line break


surrfman

Recommended Posts

Tried about every arrangement of <br> <br/> with & without an apostrophe or quotes. not sure what i am not understanding.

 

here is a snipet of my product_info.php file:

 

if (tep_not_null($product_info['products_model'])) { <b/>

$products_name = $product_info['products_name']; <b/>

} <b/> else { <b/>

$products_name = $product_info['products_name'];

}

 

 

Tried adding at spots in red

 

 

I know it's simple.. just eludes me!

 

Thanks,

 

Timmy C

Link to comment
Share on other sites

You're trying to add HTML into a PHP statement. Not quite what you want to do. Try this:

 

$products_name = '<br/>' . $product_info['products_name'] . '<br/>';

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

What do you try to add? Lines break (<br />) or to make text bold? (<b> better <strong>) ?

 

If you try to add a line break after the products name, then it would be better to do it in the html part where the products name is echoed

 

<h1><?php echo $products_name ?><br /></h1>

 

Or even better to style everything in css, don't know exactly what the purpose is

Link to comment
Share on other sites

Guys, thanks for excusing my limited understanding. What I hope to achieve, dropping the product name to the next line under the product model. dropping the line starting with "programmable" under the line ending with "vision"

 

here is the current url view: http://www.discountegauges.com/product_info.php/vdo-vision-programmable-speedometer-437-153-p-33

 

I assume the change must be made in the product_info.php file. tried both suggestions, but resulted in dropping the whole two lines downward on page.

 

I know it is a simple change, I get confused when there is changing data ability as these two lines can do.

 

Thanks a bunch,

 

Timmy C

Link to comment
Share on other sites

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br/>';
} else {
  $products_name = $product_info['products_name'];
}

This will add a break <br/> after the product name only if the product model has something in it. A cleaner implementation might be

$products_name = $product_info['products_name'];
if (tep_not_null($product_info['products_model'])) {
  $products_name .= '<br/>';
}

Link to comment
Share on other sites

Frustrated... nothing seems to get the desired result, Trying to break the line after the word "Vision". I attached an expanded snippet of code to show the <h5> statement. What I think is happening, the $products_name covers the entire VDO-thru #437-153 when I examine the <h5> line. What I think needs to happen is there needs to be an <h5> for both the model "Vision" and the "Programmable" line. I can use Firebug to add a <br> just after "Vision" but don't understand how to make it so in the product_info.php file.

 

<?php

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

$products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'];

} else {

$products_name = $product_info['products_name'];

}

?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

<div>

<h5 style="float: right;"><?php echo $products_price; ?></h5>

<h5><?php echo $products_name; ?></h5>

</div>

 

Thanks for everyone's insight and help,

 

Timmy C

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...