Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HTML output trouble


stryfedll

Recommended Posts

Posted

Heres the code one of my boxes outputs... this problem occurs in each one.

 

<!-- categories //-->

<tr>

<td>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_left.gif" border="0" alt="" width="11" height="14"></td>

<td width="100%" height="14" class="infoBoxHeading">Categories</td>

<td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" border="0" alt="" width="11" height="14"></td>

</tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>

</tr>

<tr>

<td class="boxText">

<a href="URL">Bracelets</a><br>

<a href="URL">Charms</a><br>

<a href="URL">Etc...</a><br>

</tr>

<tr>

<td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"></td>

</tr>

</table>

</td>

</tr>

</table> (Need to remove this from being generated... throws off html)

</td>

</tr>

<!-- categories_eof //-->

 

I don't understand why the bolded part is there. Does anyone know how that gets outputted from includes/boxes/categories.php (for instance)? It seems to get out putted at the bottom of all boxes.

Posted

post the source code of the categories.php someone maybe able to see what's wrong with this.

Posted

<?php

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= "  ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '->';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '<br>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$categories_string = '';

$tree = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $categories_string);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

 

<!-- categories_eof //-->

Posted

As you get these offending tags in all of your boxes you will have to look in the class that contructs all the boxes rather than in the file for a specific box (categories.php for example).

 

Check /catalog/includes/classes/boxes.php - it's not for the faint hearted - but maybe do a search and compare on your file with the same file in the default installation and see if there are any discrepancies.

 

good luck

Posted

THIS IS a bug in osCommerce... ALL default installations have this bug. Check the HTML on others site and see for yourself...

 

http://www.oscommerce.com/shops/live

 

THIS is a bug in includes/classes/boxes.php New infoBox and tableBox and the way tables are generated....

 

It does it anytime YOU use the tableBox class to generate a Table!

 

:(

Posted

Yeah, sure, why not. We're all big boys and girls. If its used in a context that was designed to be offensive (e.g. namecalling) then it could be considered inappropriate then imo

Posted
Can we say that? :o

 

 

Umm.. your section that has

 

<tr>

<td class="boxText">

<a href="URL">Bracelets</a><br>

<a href="URL">Charms</a><br>

<a href="URL">Etc...</a><br>

</tr>

 

 

should have a </td> before the </tr>

 

 

Like all the other sites do.

My Contributions

 

Henry Smith

Posted

it's not a bug at all. The closing tags you are "having trouble" with actually close these open ones further up:

 

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td>

 

If it was a bug then the all the code on every OSC store I've ever built would generate a tag nesting error but I have never seen one. It look like you have removed some HTML somewhere long the line causing your site to display out of whack.

Posted

It does have a </td> before </tr>

 

I messed that part up when breaking up that line.

 

The actual line looks like this:

<td class="boxText"><a href="http://stryfedll.awardspace.com/index.php?cPath=22">Bracelets</a><br><a href="http://stryfedll.awardspace.com/index.php?cPath=27">Charms</a><br><a href="http://stryfedll.awardspace.com/index.php?cPath=25">Earrings</a><br><a href="http://stryfedll.awardspace.com/index.php?cPath=26">Necklaces</a><br><a href="http://stryfedll.awardspace.com/index.php?cPath=21">Rings</a> (8)<br><a href="http://stryfedll.awardspace.com/index.php?cPath=28">Sets</a><br><a href="http://stryfedll.awardspace.com/index.php?cPath=23">Watches</a><br></td>

 

The Problem is the extra </td></tr></table generated at the END of ALL scripts that use the tableBox method of generating tables.

Posted

The box text merely pulls

 

.boxText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }

 

 

from the stylesheet.css though - nothing more, unless you've changed it.

My Contributions

 

Henry Smith

Posted

Its a bug. It closes with </td></tr></table once extra at the end of using the tableBox command. That means, if you have 4 boxes on the left column and you open tables before the column they will all be shut down from the extra generated html.

Posted
Its a bug. It closes with </td></tr></table once extra at the end of using the tableBox command. That means, if you have 4 boxes on the left column and you open tables before the column they will all be shut down from the extra generated html.

 

well - let's agree to disagree on that one ;-)

Posted

NO, Your wrong. Trust me... LOOK. You said that the extra </td></tr></table> was started by

 

<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">

<tr>

<td>

 

But what about the other 5 or 6 (depending on how many columns you use) extra </td></tr></table> commands added at the end of each New infoBox command.?!?! Your being ridiculous. Just look at your code and count how many times the <table> command is used and how many times the </table> command is used!!!! I bet you the </table> command is used "x" ammound of times more than <table> is. X is how many boxes are on the page IE the New infoBox command is used!!

 

You must search and count by right clicking your page in the browser and viewing the source... (e.g. after the php is parsed)

 

it will not show up before the php is parsed.

Posted

As far as I can see it is absolutely fine and correct like this. I'll try to demonstrate by removing some of the code and adding some colour to show you which opening and closing tags belong together.

 

abra

 

Heres the code one of my boxes outputs... this problem occurs in each one.

 

<!-- categories //-->

<tr>

<td>

 

<table>

<tr><td>left corner</td><td>Categories</td><td>right corner</td></tr>

</table>

 

<table>

<tr><td>

<table>

<tr><td>transparent separator img</td></tr>

<tr><td>category links</td></tr>

<tr><td>transparent separator img</td></tr>

</table>

</td></tr>

</table> (Need to remove this from being generated... throws off html)

 

</td>

</tr>

<!-- categories_eof //-->

 

I don't understand why the bolded part is there. Does anyone know how that gets outputted from includes/boxes/categories.php (for instance)? It seems to get out putted at the bottom of all boxes.

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Posted

if there were extra (erroneous) tags being generated in error by OSC then not only would all stores display wrongly but the HTML would generate nesting errors when run through a code validator.

 

As neither of these occur - I suggest that the problem lies with a bug in your store - which after your last post I now have neither the time or inclination to assist you with.

Posted

Had a quick look in your store. It looks as if you took out the main table in <body> that contains 3 <td>s: left column, center part, right column. So now your columns are displayed underneath each other rather than in three tablecells next to each other.

 

abra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Posted

Everytime you edit it... your delete table, td, and tr's

 

and generate this

 

Warning: main(includes/manufacturers.php): failed to open stream: No such file or directory in /home/www/stryfedll.awardspace.com/index.php on line 269

 

Warning: main(): Failed opening 'includes/manufacturers.php' for inclusion (include_path='.:/usr/local/php4/share/pear') in /home/www/stryfedll.awardspace.com/index.php on line 269

My Contributions

 

Henry Smith

Posted

The problem wasn't a bug, it was careless editting of the files.

 

Making un-needed adjustments only create more problems. I saw in most files that you removed the

/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 

That is only a comment, removing it doesn't do anything except cause problems later when upgrading or making modification - you don't know the release date of that file, and it help to identify the contents.

 

When you made your "adjustments" you really ransacked the file. Go easy... make one adjustment, check the effects and then move on.

 

I make a backup of my directory - make changes and check them out. If I botch it up, I re-copy the backup over top and start again. It works as-is and works for thousands of websites - if it breaks after is WAS working, then the problem is between the chair and the keyboard.

My Contributions

 

Henry Smith

Archived

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

×
×
  • Create New...