Page 1 of 1

Style sheets in modules

Posted: Mon Dec 17, 2007 7:38 pm
by markdarb
Hello,

Is there a way to link to style sheets in modules? As far as I'm aware a link tag has to be put in the head section, but I'm not aware of any way of doing this in modules.

I've seen one module that used link tags within the body, but that's not actually valid XHTML. Link tags are only meant to be in the head section.

So far for the module I'm working on I've done a very crude hack by simply putting the link tag in the site's template, but that's not a particularly desirable way of doing things for obvious reasons.

Using the style attribute isn't practical in this situation.

Thanks,
Mark.

Re: Style sheets in modules

Posted: Mon Dec 17, 2007 8:09 pm
by ianmac
$document = &JFactory::getDocument();

$document->addStyleSheet( $url );

Ian

Re: Style sheets in modules

Posted: Wed Dec 19, 2007 11:35 pm
by ewel
markdarb if I am not mistaken that is code for 1.5. If so, do you know how it is done in 1.1?

Re: Style sheets in modules

Posted: Thu Dec 20, 2007 3:57 am
by markdarb
No I don't know how to do it in 1.1, but since I'm using 1.5 it doesn't matter terribly. Why? Were you offering to tell me how to do it in 1.1 if I need to know, or trying to find out because you don't know?

Thanks,
Mark.

Re: Style sheets in modules

Posted: Thu Dec 20, 2007 7:24 am
by ewel
Trying to find out because I don't know myself!  :) I have not used 1.5 yet..