Forum Moderators: coopster
i am a stay at home mum so i have absolutely zilch knowledge of anything to do with web design code etc... however i have managed to make a half decent cubecart store for my business.
i have just added a mod to change the order of my categories which works perfectly - BUT i now get this error on all of my category pages:
Parse error: syntax error, unexpected T_IF in.....includes/content/viewCat.inc.php on line 1
i have cross referenced existing page with the back up i made before adding the mod but i cannot find any difference in the first 20 lines and i cant see any unclosed brackets etc..
*/if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) ¦¦ eregi(".inc.php",$_SERVER['PHP_SELF'])) {echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";exit;}if(isset($_GET['page'])){$page = treatGet($_GET['page']);} else {$page = 0;}$view_cat = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewCat.tpl");////////////////////////// BUILD SUB CATEGORIES////////if(isset($_GET['catId'])) {$_GET['catId'] = treatGet($_GET['catId']);// build query$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY cat_name ASC";$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY pos";// get category array in foreign innit$resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'");// query database$subCategories = "";$subCategories = $db->select($query);}if(isset($_GET['catId']) && $_GET['catId']>0 && $subCategories == TRUE) {// loop resultsfor ($i=0; $i<count($subCategories); $i++){if(is_array($resultsForeign)){for ($k=0; $k<count($resultsForeign); $k++){if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){$subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];
before this is just the standard cubecart info and copyright bits - would the error be in there?
thanks in advance for any help
esther
the preceding code is this:
<?php/*+--------------------------------------------------------------------------¦ CubeCart v3.0.15¦ ========================================¦ by Alistair Brookbanks¦CubeCart is a Trade Mark of Devellion Limited¦ Copyright Devellion Limited 2005 - 2006. All rights reserved.¦ Devellion Limited,¦ 22 Thomas Heskin Court,¦ Station Road,¦ Bishops Stortford,¦ HERTFORDSHIRE.¦ CM23 3EE¦ UNITED KINGDOM¦ http://www.example.com¦UK Private Limited Company No. 5323904¦ ========================================¦ Web: [cubecart.com¦...] Date: Thursday, 4th January 2007¦ Email: sales (at) cubecart (dot) com¦License Type: CubeCart is NOT Open Source Software and Limitations Apply ¦ Licence Info: [cubecart.com...] --------------------------------------------------¦viewCat.inc.php¦ ========================================¦Display the Current Category+---------------------------------------------------------------- ----------
[edited by: dreamcatcher at 1:02 pm (utc) on Oct. 31, 2007]
[edit reason] Use example.com, thanks. [/edit]
Here is the last few lines of the code you have with the brackets:
if(isset($_GET['catId']) && $_GET['catId']>0 && $subCategories == TRUE) {
// loop results
for ($i=0; $i<count($subCategories); $i++){
if(is_array($resultsForeign)){
for ($k=0; $k<count($resultsForeign); $k++){
if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){
$subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];
}
}
}
}
[edited by: Habtom at 1:03 pm (utc) on Oct. 31, 2007]
<?php
/*
+--------------------------------------------------------------------------
¦ CubeCart v3.0.15
¦ ========================================
¦ by Alistair Brookbanks
¦CubeCart is a Trade Mark of Devellion Limited
¦ Copyright Devellion Limited 2005 - 2006. All rights reserved.
¦ Devellion Limited,
¦ 22 Thomas Heskin Court,
¦ Station Road,
¦ Bishops Stortford,
¦ HERTFORDSHIRE.
¦ CM23 3EE
¦ UNITED KINGDOM
¦ http://www.example.com
¦UK Private Limited Company No. 5323904
¦ ========================================
¦ Web: [cubecart.com...]
¦ Date: Thursday, 4th January 2007
¦ Email: sales (at) cubecart (dot) com
¦License Type: CubeCart is NOT Open Source Software and Limitations Apply
¦ Licence Info: [cubecart.com...]
+------------------------
--------------------------------------------------
¦viewCat.inc.php
¦========================================
¦Display the Current Category
+----------------------------------------------------------------
----------
*/
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) ¦¦ eregi(".inc.php",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
exit;
}
if(isset($_GET['page'])){
$page = treatGet($_GET['page']);
} else {
$page = 0;
}
$view_cat = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewCat.tpl");
////////////////////////// BUILD SUB CATEGORIES////////
if(isset($_GET['catId'])) {
$_GET['catId'] = treatGet($_GET['catId']);
// build query
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY cat_name ASC";
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY pos";
// get category array in foreign innit
$resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'");
// query database
$subCategories = "";
$subCategories = $db->select($query);
}
if(isset($_GET['catId']) && $_GET['catId']>0 && $subCategories == TRUE) {
// loop results
for ($i=0; $i<count($subCategories); $i++){
if(is_array($resultsForeign)){
for ($k=0; $k<count($resultsForeign); $k++){
if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){
$subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];
}
}
}
}
}
?>
you need to check the closing braces at the end, I think I added the right amount
you also want to make sure nothing else from the end of that file was missed in all the pasting
and the following code is from the above as i have it in smart ftp
<?php/*+--------------------------------------------------------------------------
¦ CubeCart v3.0.15¦
========================================
¦ by Alistair Brookbanks
¦CubeCart is a Trade Mark of Devellion Limited
¦ Copyright Devellion Limited 2005 - 2006. All rights reserved.
¦ Devellion Limited,
¦ 22 Thomas Heskin Court,
¦ Station Road,
¦ Bishops Stortford,
¦ HERTFORDSHIRE.
¦ CM23 3EE
¦ UNITED KINGDOM
¦ [devellion.com...]
¦UK Private Limited Company No. 5323904
¦ ========================================
¦ Web: [cubecart.com...]
¦ Date: Thursday, 4th January 2007
¦ Email: sales (at) cubecart (dot) com
¦License Type: CubeCart is NOT Open Source Software and Limitations Apply
¦ Licence Info: [cubecart.com...]
+--------------------------------------------------------------------------
¦viewCat.inc.php
¦ ========================================
¦Display the Current Category
+--------------------------------------------------------------------------
*/if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) ¦¦ eregi(".inc.php",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
exit;
}
if(isset($_GET['page'])){
$page = treatGet($_GET['page']);
} else {
$page = 0;}
$view_cat = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewCat.tpl");
////////////////////////// BUILD SUB CATEGORIES
////////
if(isset($_GET['catId'])) {
$_GET['catId'] = treatGet($_GET['catId']);
// build query
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY cat_name ASC";
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY pos";
// get category array in foreign innit
$resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'");
// query database
$subCategories = "";
$subCategories = $db->select($query);
}
if(isset($_GET['catId']) && $_GET['catId']>0 && $subCategories == TRUE) {
// loop results
for ($i=0; $i<count($subCategories); $i++){
if(is_array($resultsForeign)){
}
for ($k=0; $k<count($resultsForeign); $k++){
}
if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){
}$subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];
}if(empty($subCategories[$i]['cat_image'])){
$view_cat->assign("IMG_CATEGORY",$GLOBALS['rootRel']."skins/".$config['skinDir']."/styleImages/catnophoto.gif");
} else {
$view_cat->assign("IMG_CATEGORY",$GLOBALS['rootRel']."images/uploads/".$subCategories[$i]['cat_image']);
}
$view_cat->assign("TXT_LINK_CATID",$subCategories[$i]['cat_id']);
$view_cat->assign("TXT_CATEGORY", validHTML($subCategories[$i]['cat_name']));
$view_cat->assign("NO_PRODUCTS",
$subCategories[$i]['noProducts']);
$view_cat->parse("view_cat.sub_cats.sub_cats_loop");
} // end loop results$view_cat->parse("view_cat.sub_cats");} // end $subCategories == TRUE
there is more but thought error would be in top bit
I'm skipping all the top junk
<?php
if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) ¦¦ eregi(".inc.php",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";
exit;
}
if(isset($_GET['page'])){
$page = treatGet($_GET['page']);
} else {
$page = 0;}
$view_cat = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/content/viewCat.tpl");
////////////////////////// BUILD SUB CATEGORIES
////////
if(isset($_GET['catId'])) {
$_GET['catId'] = treatGet($_GET['catId']);
// build query
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY cat_name ASC";
$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY pos";
// get category array in foreign innit
$resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'");
// query database
$subCategories = "";
$subCategories = $db->select($query);
}
if(isset($_GET['catId']) && $_GET['catId']>0 && $subCategories == TRUE) {
// loop results
for ($i=0; $i<count($subCategories); $i++){
if(is_array($resultsForeign)){
}
for ($k=0; $k<count($resultsForeign); $k++){
}
if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){
}$subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];
}if(empty($subCategories[$i]['cat_image'])){
$view_cat->assign("IMG_CATEGORY",$GLOBALS['rootRel']."skins/".$config['skinDir']."/styleImages/catnophoto.gif");
} else {
$view_cat->assign("IMG_CATEGORY",$GLOBALS['rootRel']."images/uploads/".$subCategories[$i]['cat_image']);
}
$view_cat->assign("TXT_LINK_CATID",$subCategories[$i]['cat_id']);
$view_cat->assign("TXT_CATEGORY", validHTML($subCategories[$i]['cat_name']));
$view_cat->assign("NO_PRODUCTS",
$subCategories[$i]['noProducts']);
$view_cat->parse("view_cat.sub_cats.sub_cats_loop");
} // end loop results
$view_cat->parse("view_cat.sub_cats");
} // end
$subCategories == TRUE
?>
Warning: Unterminated comment starting line 1 in /home/xvuqvuh/public_html/store/includes/content/viewCat.inc.php on line 1
Parse error: syntax error, unexpected $end in /home/xvuqvuh/public_html/store/includes/content/viewCat.inc.php on line 1