Zen Cart Logo
Forums / Bug Reports / [Done v2.0] HTMLarea not showing -> fix included

[Done v2.0] HTMLarea not showing -> fix included

Locked

Views: 10,755

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
8 Nov 2006, 6:25 PM
#1
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

[Done v2.0] HTMLarea not showing -> fix included

Hi folks,

I recently came across this issue myself, when installing the cart in sub directory. This error only appears there... for example you have installed your cart in https://www.yourdomainname.com/store/, then you have most likely experience this bug, if you were using htmlarea!

The problem is, the htmleditor should be loaded from a non exisitng location. Zen assumes incorrectly, that all editor files are in https://www.yourdomainname.com/editors/htmlarea, however they are in https://www.yourdomainname.com/store/editors/htmlarea!

**How to fix it? **

Just simply add a base to the javascript inclusion file. Simply replace all occurances of DIR_WS_CATALOG with HTTP_CATALOG_SERVER.DIR_WS_CATALOG in admin/includes/htmlarea.php.

Your file should have looked like this:

<?php
/**
 * @package htmleditors
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: htmlarea.php 4245 2006-08-24 14:07:50Z drbyte $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

define('BR',"\n");

// INSERTS <SCRIPT> TAGS IN <HEAD> FOR HTMLAREA TO BE CALLED
if ($_SESSION['html_editor_preference_status']=="HTMLAREA") {

//define URL and LANG parameters
  echo '<script type="text/javascript">' .BR;
  echo '   _editor_url = "'.DIR_WS_CATALOG . 'editors/htmlarea/";' .BR;
  echo '	_editor_lang = "'.strtolower($_SESSION['languages_code']).'";' .BR;
  echo '</script>' .BR;

//<!-- load the main HTMLArea files -->
  echo '<script type="text/javascript" src="' . DIR_WS_CATALOG . 'editors/htmlarea/htmlarea.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . DIR_WS_CATALOG . 'editors/htmlarea/lang/'.strtolower(DEFAULT_LANGUAGE).'.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . DIR_WS_CATALOG . 'editors/htmlarea/dialog.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . DIR_WS_CATALOG . 'editors/htmlarea/popupdiv.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . DIR_WS_CATALOG . 'editors/htmlarea/popupwin.js"></script>' .BR;

//<!-- load the plugins -->
  echo '<script type="text/javascript">' .BR;
      // WARNING: using this interface to load plugin
      // will _NOT_ work if plugins do not have the language
      // loaded by HTMLArea.

      // In other words, this function generates SCRIPT tags
      // that load the plugin and the language file, based on the
      // global variable HTMLArea.I18N.lang (defined in the lang file,
      // in our case "lang/en.js" loaded above).

      // If this lang file is not found the plugin will fail to
      // load correctly and nothing will work.

  echo '      HTMLArea.loadPlugin("TableOperations");' .BR;
  echo '      HTMLArea.loadPlugin("SpellChecker");' .BR;
  //  echo ' }' .BR;
  echo '</script>' .BR;
} 
?>

and should be changed to:

<?php
/**
 * @package htmleditors
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: htmlarea.php 4245 2006-08-24 14:07:50Z drbyte $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

define('BR',"\n");

// INSERTS <SCRIPT> TAGS IN <HEAD> FOR HTMLAREA TO BE CALLED
if ($_SESSION['html_editor_preference_status']=="HTMLAREA") {

//define URL and LANG parameters
  echo '<script type="text/javascript">' .BR;
  echo '   _editor_url = "'.HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/";' .BR;
  echo '	_editor_lang = "'.strtolower($_SESSION['languages_code']).'";' .BR;
  echo '</script>' .BR;

//<!-- load the main HTMLArea files -->
  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/htmlarea.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/lang/'.strtolower(DEFAULT_LANGUAGE).'.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/dialog.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/popupdiv.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/popupwin.js"></script>' .BR;

//<!-- load the plugins -->
  echo '<script type="text/javascript">' .BR;
      // WARNING: using this interface to load plugin
      // will _NOT_ work if plugins do not have the language
      // loaded by HTMLArea.

      // In other words, this function generates SCRIPT tags
      // that load the plugin and the language file, based on the
      // global variable HTMLArea.I18N.lang (defined in the lang file,
      // in our case "lang/en.js" loaded above).

      // If this lang file is not found the plugin will fail to
      // load correctly and nothing will work.

  echo '      HTMLArea.loadPlugin("TableOperations");' .BR;
  echo '      HTMLArea.loadPlugin("SpellChecker");' .BR;
  //  echo ' }' .BR;
  echo '</script>' .BR;
} 
?>

Have a nice day!

9 Nov 2006, 3:47 AM
#2
ben avatar

ben

New Zenner

Join Date:
Aug 2006
Location:
Melbourne, Australia
Posts:
30
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

My site is installed in a sub-directory and I have not experienced this problem with HTMLarea.

9 Nov 2006, 1:42 PM
#3
masterblaster avatar

masterblaster

Totally Zenned

Join Date:
Aug 2004
Location:
Germany
Posts:
528
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

I just experienced it on three carts (on different servers) so I thought this might be a general problem... But if you ever have the problem, you know how to fix it :)

7 Jan 2007, 12:40 PM
#4
djstern avatar

djstern

New Zenner

Join Date:
Apr 2005
Posts:
66
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

I have the same problem and it didn't work for me. :(

31 Jan 2007, 10:54 PM
#5
michellyaqua12 avatar

michellyaqua12

New Zenner

Join Date:
Jan 2007
Location:
Boston, MA, USA
Posts:
40
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

Thank you!!! HTMLarea was not working for me since I upgraded, but this fixed it!

13 Feb 2007, 11:28 PM
#6
alf avatar

alf

New Zenner

Join Date:
Feb 2007
Posts:
4
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

Hi,

I encoutered a similar bug but the cause seems different.

The same error happens if I install zencart in user space : /home/username/public_html/zencart/
The url looks like this : http://localhost/~username/zencart

If i install zencart in www /var/www/zencart/ it works fine, so i guess there might be some regular expression that fails to deal with the '~' character.
(haven't tracked the code yet)

14 Feb 2007, 4:23 PM
#7
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: [Done v2.0] HTMLarea not showing -> fix included

Hi,

I encoutered a similar bug but the cause seems different.

The same error happens if I install zencart in user space : /home/username/public_html/zencart/
The url looks like this : http://localhost/~username/zencart

If i install zencart in www /var/www/zencart/ it works fine, so i guess there might be some regular expression that fails to deal with the '~' character.
(haven't tracked the code yet)

Assuming the HTMLArea does not track the ~ characters, let's see if we could add it to the DIR_WS_CATALOG without affecting the rest of the cart.

In your admin/includes/htmlarea.php file,

find:

// INSERTS <SCRIPT> TAGS IN <HEAD> FOR HTMLAREA TO BE CALLED
if ($_SESSION['html_editor_preference_status']=="HTMLAREA") {

add below:

if (preg_match("/^[~]$/ix", DIR_WS_CATALOG)) {
$char_replace = preg_replace(DIR_WS_CATALOG, "~".DIR_WS_CATALOG, $char_replace);
} // End of if statement.

Will it add the ~ in front of your username ? (still assuming you're still trying the HTMLArea patch under the ~username folder).

14 Feb 2007, 4:29 PM
#8
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: [Done v2.0] HTMLarea not showing -> fix included

Since I can't edit my post above, I forgot to state to replace all definition names (on that same file)

from: DIR_WS_CATALOG
with: $char_replace

starting from below my added lines.

23 Mar 2007, 1:26 AM
#9
wils avatar

wils

Zen Follower

Join Date:
Apr 2006
Location:
Göteborg
Posts:
124
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

See also http://zen-cart.com/forum/showthread.php?p=347455#post347455 with two suggested very easy fixes to get HTMLAREA to show in 1.3.7.

3 Nov 2007, 5:32 PM
#10
cosmogol avatar

cosmogol

New Zenner

Join Date:
Oct 2007
Posts:
12
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

Thank you masterblaster !

This solved the "HTMLArea not working" problem on my local server using an alias for the Zen-Cart URL (the folder where the store is isn't a subfolder of the server's document root… even if the URL says http://document.root/store/).

:smile:

3 Nov 2007, 6:15 PM
#11
cosmogol avatar

cosmogol

New Zenner

Join Date:
Oct 2007
Posts:
12
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

And this is not specific to HTMLArea…
I get the same issue with TinyMCE, had to change

<script language="javascript" type="text/javascript" src="<?php echo DIR_WS_CATALOG; ?>editors/tiny_mce/tiny_mce_gzip.php"></script>
```at the beginning of editors/tinymce.php to

<script language="javascript" type="text/javascript" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG; ?>editors/tiny_mce/tiny_mce_gzip.php"></script>
14 Nov 2007, 12:50 AM
#12
catbythesea avatar

catbythesea

New Zenner

Join Date:
Jun 2006
Posts:
3
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

Thank you Thank you Thank you masterblaster!

I struggled with this for quite some time before I found your very helpful post! The html editor worked just fine on my previous server (with the same sub-directory structure) without this fix but I couldn't get it to work on the new server no matter what I did. I'm not sure why it is inconsistent across servers but it works now and I am extremely grateful (and so is my shop owner) for your help.

Catherine

22 Dec 2007, 3:29 PM
#13
jacka avatar

jacka

Zen Follower

Join Date:
Nov 2007
Location:
Dallas, Texas USA
Posts:
180
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

I'm still having problems with this after using masterBlaster's fix. I did find a work-around by switching to plain text before saving my changes. However, I'd like to get it right if possible. Using 1.3.8a

Here's my htmlarea.php:

<?php
/**
 * @package htmleditors
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: htmlarea.php 4245 2006-08-24 14:07:50Z drbyte $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

define('BR',"\n");

// INSERTS <SCRIPT> TAGS IN <HEAD> FOR HTMLAREA TO BE CALLED
if ($_SESSION['html_editor_preference_status']=="HTMLAREA") {

//define URL and LANG parameters
  echo '<script type="text/javascript">' .BR;
  echo '   _editor_url = "'.HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/";' .BR;
  echo '	_editor_lang = "'.strtolower($_SESSION['languages_code']).'";' .BR;
  echo '</script>' .BR;

//<!-- load the main HTMLArea files -->
  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/htmlarea.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/lang/'.strtolower(DEFAULT_LANGUAGE).'.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/dialog.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/popupdiv.js"></script>' .BR;
//  echo '<script type="text/javascript" src="' . HTTP_CATALOG_SERVER.DIR_WS_CATALOG . 'editors/htmlarea/popupwin.js"></script>' .BR;

//<!-- load the plugins -->
  echo '<script type="text/javascript">' .BR;
      // WARNING: using this interface to load plugin
      // will _NOT_ work if plugins do not have the language
      // loaded by HTMLArea.

      // In other words, this function generates SCRIPT tags
      // that load the plugin and the language file, based on the
      // global variable HTMLArea.I18N.lang (defined in the lang file,
      // in our case "lang/en.js" loaded above).

      // If this lang file is not found the plugin will fail to
      // load correctly and nothing will work.

  echo '      HTMLArea.loadPlugin("TableOperations");' .BR;
  echo '      HTMLArea.loadPlugin("SpellChecker");' .BR;
  //  echo ' }' .BR;
  echo '</script>' .BR;
} 
?>
25 Feb 2008, 11:04 PM
#14
pe7er avatar

pe7er

New Zenner

Join Date:
Apr 2007
Location:
Nijmegen, Netherlands
Posts:
44
Plugin Contributions:
0

Re: [Done v2.0] HTMLarea not showing -> fix included

I had the same problem with HTMLArea & tinyMCE.
Both editors resulted in JavaScript errors ("is not defined").
My Zen Cart 1.3.7 webshop was installed in a subdirectory.

Thanks to the solutions of masterblaster & Cosmogol both editors are working fine now.
Thanks!