Announcement

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

#1 2008-03-25 13:07:23

hutting
New member
Registered: 2008-03-25
Posts: 2

stylistLoadStylesheet is not a function

Hi there,
I'm having real problems trying to get the Stylist plugin to work.
Basically I have an out-of-the-box installation of Xinha and I just can't find any decent documentation on how to use it. Most of the examples I've found on the internet suggest things like:

xinha_config.stylistLoadStylesheet(....

However in the default installation, there is no variable called xinha_config set up, only the random _8f etc instances of the Xinha.Config

Below is the code I've managed to hack up but it complains that _8f.stylistLoadStylesheet is not a function however to get to that point it must have  successfully loaded it. So what object should I be calling the stylistLoadStylesheet from?

url=_editor_url+"plugins/Stylist/stylist.js";
if(!Xinha.loadPlugins(["Stylist"],function(){
_8f.generate();
},url)){
return false;
}else{


    
    if(typeof Stylist != 'undefined') {
        
        _8f.stylistLoadStylesheet('/includes/css/site.css');
        
    } 

}

Any help with this would be massively appreciated, I've wasted hours on this sad

Offline

#2 2008-03-25 19:04:31

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

Re: stylistLoadStylesheet is not a function

xinha_config refers to a instance of Xinha.Config  that is passed to the Xinha constructor as explained in the NewbieGuide, which is the recommended way to setup Xinha. The files and some other examples are also in the folder examples of the Xinha distribution. If you read this, I think you will know how it works.

The _8f does not stand for any object but  for "this" in the Xinha (not Xinha.Config) class, as it seems you have taken and adapted this snippet out of the function Xinha.prototype.generate from the compressed source code. This is only internal code you don't have to mess with. In case you are interested in further reading and understandig the source code (now that your already so deep in it smile) you should not take the compressed code of the distribution, but check it out via svn

Offline

#3 2008-03-27 07:48:14

hutting
New member
Registered: 2008-03-25
Posts: 2

Re: stylistLoadStylesheet is not a function

Thanks for the response, however I'm not sure what object stylistLoadStylesheet() belongs to.

If I use something like the following:

var xinha_config = new Xinha.Config();
xinha_config.stylistLoadStylesheet("/includes/css/site.css");

It still says that stylistLoadStylesheet() is not a function, as per above I've tried using the stylistLoadStylesheet() function with every instance of Xinha.Config() I can find but it doesn't work for any of them.

Offline

#4 2008-03-28 23:30:13

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

Re: stylistLoadStylesheet is not a function

Follow the newbie guide.  In step 3 of your init method you would put your call to stylistLoadStylesheet


James Sleeman

Offline

Board footer

Powered by FluxBB