Announcement

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

#1 2007-02-23 14:20:28

lo
New member
Registered: 2007-02-23
Posts: 3

Xinha doesn't run with own files

Hello, perhaps somebody can help me.
I unzipped Xinha 0.92beta and installed it on apache. The examples-file always runs, but not my onw scripts. I think i have an error in reasoning, but I can't find it.

I made a file called index.htm with the following code:

<html>
  <head>
    <title>New Document</title>
      <script type="text/javascript">
    _editor_url  = "/admin/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="/admin/xinha/XinhaCore.js"></script>
  <script type="text/javascript" src="/admin/xinha/my_config.js"></script>
  </head>
  <body>
  <textarea id="feld" name="feld" rows="10" cols="50" style="width: 100%">test</textarea>
  </body>
</html>

As you can see the textarea has the id "feld" and is named "feld"
I also made a file called my_config.js with code of the Newbie Guide:

<html>
  <head>
    <title>New Document</title>
    <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(!Xinha.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 :
      [
        'feld'
      ];

      /** 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 Xinha.Config();
       *   xinha_config.width  = '640px';
       *   xinha_config.height = '420px';
       *
       *************************************************************************/

       xinha_config = xinha_config ? xinha_config() : new Xinha.Config();

      /** STEP 4 ***************************************************************
       * We first create editors for the textareas.
       *
       * You can do this in two ways, either
       *
       *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
       *
       * if you want all the editor objects to use the same set of plugins, OR;
       *
       *   xinha_editors = Xinha.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   = Xinha.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.
       ************************************************************************/

      Xinha.startEditors(xinha_editors);
    }

    Xinha._addEvent(window,'load', xinha_init); // this executes the xinha_init function on page load
                                                // and does not interfere with window.onload properties set by other scripts

</script>
  </head>
  <body>
  </body>
</html>


When I call the index.htm in my browsers (IE and FF) I always get the textarea, but no editor toolbar. Has anybody a tip for me. Thanks

Offline

#2 2007-02-23 14:53:48

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Xinha doesn't run with own files

you must not have HTML tags in the my_config.js file (it's a JavaScript file and may thus contain only JavaScript)

<html>
  <head>
    <title>New Document</title>
    <script type="text/javascript">
       .
       .
       .
</script>
  </head>
  <body>
  </body>
</html>

Offline

#3 2007-02-23 16:11:44

lo
New member
Registered: 2007-02-23
Posts: 3

Re: Xinha doesn't run with own files

Thanks for your quick answer. I changed my_config.js,  but the error exists anymore.


now my_config.js looks like:

    xinha_editors = null;
    xinha_init    = null;
    xinha_config  = null;
    xinha_plugins = null;

    xinha_init = xinha_init ? xinha_init : function()
    {
      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(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;

      xinha_editors = xinha_editors ? xinha_editors :
      [
        'feld'
      ];

      xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
      xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
      Xinha.startEditors(xinha_editors);
    }

    Xinha._addEvent(window,'load', xinha_init);

-----------------------------------------------------------------
Must I insert a body onload-Tag?? It seems that the javascripts are not be activated.

Offline

#4 2007-02-23 22:09:56

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Xinha doesn't run with own files

this should be taken care of by

Xinha._addEvent(window,'load', xinha_init);

please try and report if it works with

Xinha.addDom0Event = function(window,'load', xinha_init);

or ultimately

window.onload = xinha_init;

instead.
I have only recently changed this in the Newbie guide thinking it would prevent problems, but if it doesn't work, I'll have to change it back sad

Offline

#5 2007-02-27 05:23:10

lo
New member
Registered: 2007-02-23
Posts: 3

Re: Xinha doesn't run with own files

That also doesn't work.
But I solved the problem by taking the testbed.htm in the examples-dir and modified it. Now xinha runs with own scripts.
Thanks for helping.
But there is another problem.
I tested xinha on two systems.
On the one system I have no editor toolbars with different browsers, but the same scripts run on the other system.
Does anybody know how to fix the problem?
Thanks.

Offline

Board footer

Powered by FluxBB