Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

T_String error


AllTheAbove

Recommended Posts

Posted

Ok.. I've finally gotten most of this figured out to do what I want it to.. However, now I am getting this t_string error.

 

I'm a bit lost as to how to fix this bit of a problem. It woud be greatly appreciated if someone could look over this code.. Even better, if someone knows of one of those php fat-checkers (need a free version) that I can use, please direct me in the correct direction.

 

Anyway, here is the error Parse error: parse error, unexpected T_STRING in /www/a/alltheabovew/htdocs/osCommerce/catalog/includes/languages/english/products.php on line 20

 

Here is the code

 

<?php
$the_text = 'Please click on a catagory to continue';
$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top">

if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
$category_links = array_reverse($cPath_array);
for($i=0, $n=sizeof($category_links); $i <$n; $i++) {
$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION 

. " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" 

. (int)$languages_id . "'");
$categories = tep_db_fetch_array($categories_query);
if ($categories['total'] < 1) {
// do nothing, go through the loop
} else {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . 

TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and 

c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, 

cd.categories_name");
break; // we've found the deepest category the customer is in
}
}
} else {
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . 

TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and 

c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, 

cd.categories_name");
}

$number_of_categories = tep_db_num_rows($categories_query);

$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {
$rows++;
$cPath_new = tep_get_path($categories['categories_id']);
$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top"> 
<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], 

$categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] 

. '</a></td>' . "\n";

if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != 

$number_of_categories)) {
$the_text .= ' </tr>' . "\n";
$the_text .= ' <tr>' . "\n";
}
}

// needed for the new products module shown below
$new_products_category_id = $current_category_id;
$the_text .= '</tr></table></td></tr>';

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => $the_text);
new infoBox($info_box_contents);
?>
</td>
</tr>

 

Just as an aside. Right before this error I was getting a strpos error so I removed a couple of lines and this cropped up.

 

Thanks for any help

 

Lori

Posted

$the_text = 'Please click on a catagory to continue';

$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top">

 

error is right in the first two lines after valign="top"> i think there should be a ';

 

$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top">';

 

If you got yourself a free syntax highlighting editor this would have shown up in seconds in glorious technicolour.

 

Sometimes it is better to comment out lines rather than remove them using

 

// this comments a line of text

/*This
comments
a
block of
text*/

 

Also if you get an error it is better to resolve why it is happening rather than just removing code (unless you added it in the first place). The knock on effect may not become apparent until much later and it becomes increasingly difficult to track down bugs.

 

Here endith the lesson :thumbsup:

Posted
$the_text = 'Please click on a catagory to continue';

$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top">

 

error is right in the first two lines after valign="top"> i think there should be a ';

 

$the_text .= '<td align="center" class="smallText" width="' . $width . '" valign="top">';

 

If you got yourself a free syntax highlighting editor this would have shown up in seconds in glorious technicolour.

 

Sometimes it is better to comment out lines rather than remove them using

 

// this comments a line of text

/*This
comments
a
block of
text*/

 

Also if you get an error it is better to resolve why it is happening rather than just removing code (unless you added it in the first place).  The knock on effect may not become apparent until much later and it becomes increasingly difficult to track down bugs.

 

Here endith the lesson :thumbsup:

 

 

Thanks for that. I am getting that strpos error line 20 again and the catagories aren't centered like I want them to be.. *sigh* I will try to find that syntax thing you were talking about. As for removing pieces of code, yes I had added it. It was actually telling it to put itself into an infobox, which I didn't want anyway.

 

Lori

Archived

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

×
×
  • Create New...