Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Another parse error


varnco

Recommended Posts

I've added a mod to modify how the categories are displayed, so the background is colored and changes as one mouses over.

 

However, I get this error:

 

Parse error: parse error in D:\apache\xampp\htdocs\catalog\includes\header.php on line 55

 

This is a partial section of code in header.php. Line 55 is where the javascript has been added. Did I perhaps interrupt a piece of regular coding my inserting the javascript?

 

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
   if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
     $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
   }
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
   if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
     $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
   }
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
   if (STORE_SESSIONS == '') {
     if (!is_dir(tep_session_save_path())) {
       $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
     } elseif (!is_writeable(tep_session_save_path())) {
       $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
     }
   }
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
   if (ini_get('session.auto_start') == '1') {
     $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
   }
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
   if (!is_dir(DIR_FS_DOWNLOAD)) {
     $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
   }
 }

 if ($messageStack->size('header') > 0) {
   echo $messageStack->output('header');
}   
[B]// BOF added by varn menu mod
<script language="javascript" type="text/javascript">
   function menuOver(that) {
       that.oldClassName = that.className;
       that.className += 'over';
       self.status = that.firstChild.href;
   }
   function menuOut(that) {
       if(that.oldClassName) that.className = that.oldClassName;
       else that.className = 'menucontent1';
       self.status = '';
   }
   function menuClick(that) {
       document.location = get_href(that);
       return true;
   }
   function get_href(node)
   {
       if (typeof node.href != 'undefined')
           get_href.href = node.href;
       if (node.childNodes != null)
           for (var i = 0; i < node.childNodes.length; ++i)
               get_href(node.childNodes.item(i));
       return (typeof get_href.href != 'undefined') ? get_href.href : '#';
   }
</script>
// EOF added by varn menu mod[/B]
///////////////////    
///////////////////        
// [0001] BOF: WebMakers.com Added: Center Shop
// This goes before any other table of the shop
//
// Is center Shop ON/OFF ?
///////////////////

   if ( CENTER_SHOP_ON == 'on' ) {

///////////////////   
// [0001] Background Color ON/OFF and CellPadding for around the shop?
///////////////////

     if ( CENTER_SHOP_BACKGROUND_ON == 'on' ) {
?>
   <table width="100%" cellpadding="<?php echo CENTER_SHOP_PADDING; ?>" cellspacing="0" border="0" bgcolor="<?php echo CENTER_SHOP_BACKGROUND_COLOR_OUT; ?>">
     <tr><td>
<?php
     }

 

Last time I had a parse error I had a ' missing...

Link to comment
Share on other sites

i didnt count the lines, could it be this one?

 

// BOF added by varn menu mod

 

Actually, I don't think so. The was my attempt at bolding the coding that I added, so someone wouldn't have to count the lines.

 

The coding I added (which is line 55) starts directly below the line you mention. This is what I added:

 

<script language="javascript" type="text/javascript">

function menuOver(that) {

that.oldClassName = that.className;

that.className += 'over';

self.status = that.firstChild.href;

}

function menuOut(that) {

if(that.oldClassName) that.className = that.oldClassName;

else that.className = 'menucontent1';

self.status = '';

}

function menuClick(that) {

document.location = get_href(that);

return true;

}

function get_href(node)

{

if (typeof node.href != 'undefined')

get_href.href = node.href;

if (node.childNodes != null)

for (var i = 0; i < node.childNodes.length; ++i)

get_href(node.childNodes.item(i));

return (typeof get_href.href != 'undefined') ? get_href.href : '#';

}

</script>

 

Could it be that I have inserted the javascript in between

 

<php?

 

?>

 

and it shouldn't be within the <php? ?> only before or after?

Link to comment
Share on other sites

The solution to my issue was that I was putting javascript in the middle of php coding.

 

I simply took it outside of the

 

?>

 

<?php

 

range and it works like a charm!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...