Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-01-26 22:51:30

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

I'm installing Xinha on a web page for the first time. I seem to have installed everything correctly, but the text area isn't turning into a Xinha text area. I've specified the name of the field ("field_id_2"). Here's how I'm including Xinha in the head section of the HTML page:


            <script type="text/javascript">
            _editor_url  = "http://www.bigpicweblog.com/dir/xinha/"  // (preferably absolute) URL (including trailing slash) where Xinha is installed
            _editor_lang = "en";      // And the language we need to use in the editor.
            </script>
           
            <script type="text/javascript" src="http://www.bigpicweblog.com/dir/xinha/htmlarea.js"></script>
           
            <script type="text/javascript">
                xinha_editors = null;
                xinha_init    = null;
                xinha_config  = null;
                xinha_plugins = null;
           
                // This contains the names of textareas we will make into Xinha editors
                xinha_init = xinha_init ? xinha_init : function()
                {
                  /** STEP 1 ***************************************************************
                   * First, what are the plugins you will be using in the editors on this
                   * page.  List all the plugins you will need, even if not all the editors
                   * will use all the plugins.
                   *
                   * The list of plugins below is a good starting point, but if you prefer
                   * a must simpler editor to start with then you can use the following
                   *
                   * xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
                   *
                   * which will load no extra plugins at all.
                   ************************************************************************/
           
                  xinha_plugins = xinha_plugins ? xinha_plugins :
                  [
                   "CharacterMap",
                   "ContextMenu",
                   "FullScreen",
                   "ListType",
                   "SpellChecker",
                   "Stylist",
                   "SuperClean",
                   "TableOperations"
                  ];
                         // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  smile
                         if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
           
                  /** STEP 2 ***************************************************************
                   * Now, what are the names of the textareas you will be turning into
                   * editors?
                   ************************************************************************/
           
                  xinha_editors = xinha_editors ? xinha_editors :
                  [
                    "field_id_2",
                    "anotherOne"
                  ];
           
                  /** STEP 3 ***************************************************************
                   * We create a default configuration to be used by all the editors.
                   * If you wish to configure some of the editors differently this will be
                   * done in step 5.
                   *
                   * If you want to modify the default config you might do something like this.
                   *
                   *   xinha_config = new HTMLArea.Config();
                   *   xinha_config.width  = "640px";
                   *   xinha_config.height = "420px";
                   *
                   *************************************************************************/
           
                   xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
           
                  /** STEP 4 ***************************************************************
                   * We first create editors for the textareas.
                   *
                   * You can do this in two ways, either
                   *
                   *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
                   *
                   * if you want all the editor objects to use the same set of plugins, OR;
                   *
                   *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
                   *   xinha_editors["myTextArea"].registerPlugins(["Stylist","FullScreen"]);
                   *   xinha_editors["anotherOne"].registerPlugins(["CSS","SuperClean"]);
                   *
                   * if you want to use a different set of plugins for one or more of the
                   * editors.
                   ************************************************************************/
           
                  xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
           
                  /** STEP 5 ***************************************************************
                   * If you want to change the configuration variables of any of the
                   * editors,  this is the place to do that, for example you might want to
                   * change the width and height of one of the editors, like this...
                   *
                   *   xinha_editors.myTextArea.config.width  = "640px";
                   *   xinha_editors.myTextArea.config.height = "480px";
                   *
                   ************************************************************************/
           
           
                  /** STEP 6 ***************************************************************
                   * Finally we "start" the editors, this turns the textareas into
                   * Xinha editors.
                   ************************************************************************/
           
                  HTMLArea.startEditors(xinha_editors);
                }
           
                window.onload = xinha_init;
           
            </script>


And here's the textarea:

<textarea style='width:100%;' name='field_id_2' id='field_id_2' cols='90' rows='65' class='textarea' onclick='setFieldName(this.name)'></textarea>

How do I fix this? Thanks in advance to all for any info.



-Vik

Offline

#2 2006-01-27 04:31:32

rbw
New member
Registered: 2006-01-27
Posts: 6

Re: Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

A few things:

1.
_editor_url  = "http://www.bigpicweblog.com/dir/xinha/[/b]"
<script type="text/javascript" src="http://www.bigpicweblog.com/dir/xinha/htmlarea.js"></script>

The address in bold doesn't exist, so xinha core isn't included. Simply leave it as it is in newbie guide.

2. in STEP 2 you are initializing textarea, that doesn't exist:

  xinha_editors = xinha_editors ? xinha_editors :
                  [
                    "field_id_2",
                    "anotherOne"
                  ];

it should be

  xinha_editors = xinha_editors ? xinha_editors :
                  [
                    "field_id_2"
                  ];

as textarea with name 'anotherOne' does not exist.

Offline

#3 2006-01-27 04:57:10

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Re: Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

The address in bold doesn't exist, so xinha core isn't included. Simply leave it as it is in newbie guide.

I changed the address when posting this, for security purposes; it seems preferable not to be posting too much about the internal directory structure of your site. The directory I'm using does exist.

2. in STEP 2 you are initializing textarea, that doesn't exist:

Thanks for this suggestion. I tried using the code you posted, but Xinha is not yet activating. What else could it be?

Offline

#4 2006-01-27 05:22:24

rbw
New member
Registered: 2006-01-27
Posts: 6

Re: Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

Your code modification with the changes mentioned above:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript">
            _editor_url  = "xinha/"  // (preferably absolute) URL (including trailing slash) where Xinha is installed
            _editor_lang = "en";      // And the language we need to use in the editor.
            </script>
            
            <script type="text/javascript" src="xinha/htmlarea.js"></script>
            
            <script type="text/javascript">
                xinha_editors = null;
                xinha_init    = null;
                xinha_config  = null;
                xinha_plugins = null;
            
                // This contains the names of textareas we will make into Xinha editors
                xinha_init = xinha_init ? xinha_init : function()
                {
                  /** STEP 1 ***************************************************************
                   * First, what are the plugins you will be using in the editors on this
                   * page.  List all the plugins you will need, even if not all the editors
                   * will use all the plugins.
                   *
                   * The list of plugins below is a good starting point, but if you prefer
                   * a must simpler editor to start with then you can use the following 
                   * 
                   * xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
                   *
                   * which will load no extra plugins at all.
                   ************************************************************************/
            
                  xinha_plugins = xinha_plugins ? xinha_plugins :
                  [
                   "CharacterMap",
                   "ContextMenu",
                   "FullScreen",
                   "ListType",
                   "SpellChecker",
                   "Stylist",
                   "SuperClean",
                   "TableOperations"
                  ];
                         // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  
                         if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
            
                  /** STEP 2 ***************************************************************
                   * Now, what are the names of the textareas you will be turning into
                   * editors?
                   ************************************************************************/
            
                  xinha_editors = xinha_editors ? xinha_editors :
                  [
                    "field_id_2"
                  ];
            
                  /** STEP 3 ***************************************************************
                   * We create a default configuration to be used by all the editors.
                   * If you wish to configure some of the editors differently this will be
                   * done in step 5.
                   *
                   * If you want to modify the default config you might do something like this.
                   *
                   *   xinha_config = new HTMLArea.Config();
                   *   xinha_config.width  = "640px";
                   *   xinha_config.height = "420px";
                   *
                   *************************************************************************/
            
                   xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
            
                  /** STEP 4 ***************************************************************
                   * We first create editors for the textareas.
                   *
                   * You can do this in two ways, either
                   *
                   *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
                   *
                   * if you want all the editor objects to use the same set of plugins, OR;
                   *
                   *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
                   *   xinha_editors["myTextArea"].registerPlugins(["Stylist","FullScreen"]);
                   *   xinha_editors["anotherOne"].registerPlugins(["CSS","SuperClean"]);
                   *
                   * if you want to use a different set of plugins for one or more of the
                   * editors.
                   ************************************************************************/
            
                  xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
            
                  /** STEP 5 ***************************************************************
                   * If you want to change the configuration variables of any of the
                   * editors,  this is the place to do that, for example you might want to
                   * change the width and height of one of the editors, like this...
                   *
                   *   xinha_editors.myTextArea.config.width  = "640px";
                   *   xinha_editors.myTextArea.config.height = "480px";
                   *
                   ************************************************************************/
            
            
                  /** STEP 6 ***************************************************************
                   * Finally we "start" the editors, this turns the textareas into
                   * Xinha editors.
                   ************************************************************************/
            
                  HTMLArea.startEditors(xinha_editors);
                }
            
                window.onload = xinha_init;
            
            </script>
</head>

<body>
<textarea style='width:100%;' name='field_id_2' id='field_id_2' cols='90' rows='65' class='textarea' onclick='setFieldName(this.name)'></textarea>
</body>
</html>

It work. Well, assuming, that xinha path is correct, but that's obivous wink
One more thing, what does function 'setFieldName' does? Maybe it is messing something up?

Offline

#5 2006-01-28 03:53:27

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Re: Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

Thanks, RBW. This was helpful. I found one last thing that's keeping this from working on my CMS. My CMS declares the start of the body section like ths:

<body onLoad="document.forms[0].title.focus();set_catlink();" >

...instead of:

<body>

And that seems to prevent Xinha from activating. If I change it back to just plain:

<body>

...it works fine. My CMS (ExpressionEngine) has hooks to insert the needed Xinha code into the header using an extension, but it doesn't let me change the way the start of the body section is declared. Is there any way to get Xinha to work when start of the body section is declared the way ExpressionEngine likes to do it?

Offline

#6 2006-01-28 13:27:11

Vik
Xinha Community Member
Registered: 2005-12-06
Posts: 18

Re: Newbie Installation Question -- Xinha Doesn't Seem to Find TextArea

I'll start a new thread on this subject, since it's off-topic from the original question.

Offline

Board footer

Powered by FluxBB