Announcement

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

#1 2005-09-07 20:13:57

lagosta
New member
Registered: 2005-09-07
Posts: 1

Getting CSS to work

Hello,

I've just installed Xinha, and it absolutely brilliant - thanks for all the good work!

However there's one thing I can't seem to get to work - CSS. I'd like to be able to import my CSS files so it looks right, and also so users can format the text using them. It sounds like I need to use the Stylist plug-in, but unfortunately I can't get this to work. It appears at the right when I load the example files, but not in my own scripts.

I've tried adding this various code to my config to some CSS in, as suggested by various posts:

-------------------
<?php

$myCSSString = str_replace("\n", "", @implode(" ", @file("../my.css"))); ?>
xinha_config.pageStyle = "@import <? echo $myCSSString; ?>";

-------------

xinha_config.pageStyleSheets = ['http://www.mysite.com/my.css'];

---------------

xinha_config.stylistLoadStylesheet('http://www.mysite.com/my.css', { '.body' : 'body', '.sub_head2' : 'subhead2'});
 
--------------

  xinha_config.pageStyle = HTMLArea._geturlcontent('my.css');

--------------
 
  xinha_config.stylistLoadStyles('p.red_text { color:red }');
 
---------------

config.pageStyle = "@import url(my.css);";

--------------

And various variations of this with absolute/relative paths etc.

Does anyone know how I can get Stylist and my CSS working? Thanks! (config follows)

<script type="text/javascript">
    _editor_url  = "/xinha/";
    _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;

    xinha_init = xinha_init ? xinha_init : function()
    {

      xinha_plugins = xinha_plugins ? xinha_plugins :
      [
       'CharacterMap',
       'ContextMenu',
       'FullScreen',
       'ListType',
       'SpellChecker',
       'Stylist',
       'SuperClean',
       'TableOperations',
       'DynamicCSS'
      ];

             if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;


      xinha_editors = xinha_editors ? xinha_editors :
      [
        'content'
       
      ];
      
       xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();


      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);


      HTMLArea.startEditors(xinha_editors);
    }

    window.onload = xinha_init;
  </script>

Offline

#2 2005-09-08 06:34:04

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Getting CSS to work

where are you putting the command?  It should look something like...

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

 // vvvvvvvvvvvvvv COMMAND HERE vvvvvvvvvvvvvv
 xinha_config.stylistLoadStylesheet('http://www.mysite.com/my.css', { '.body' : 'body', '.sub_head2' : 'subhead2'});
 // ^^^^^^^^^^^ COMMAND HERE ^^^^^^^^^^^

xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);

James Sleeman

Offline

#3 2005-09-16 22:15:26

Chuck
Xinha Community Member
Registered: 2005-02-25
Posts: 29

Re: Getting CSS to work

Well, one thing that stumbled me at first while trying to get the xinha text look like the one outputed in my page was that some id/class markup were (of course) not included, my content was sitting in a <div id="content"> on which I applied the style. I had to "hack" xinha so that the generated html body would be <body id="content"> instead of the empty default one.

Hope this helps solving your issue...

Offline

Board footer

Powered by FluxBB