Style sheets in modules

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
markdarb
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Dec 13, 2007 7:30 pm

Style sheets in modules

Post by markdarb » Mon Dec 17, 2007 7:38 pm

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.

User avatar
ianmac
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 237
Joined: Sat Sep 24, 2005 11:01 pm
Location: Toronto, Canada

Re: Style sheets in modules

Post by ianmac » Mon Dec 17, 2007 8:09 pm

$document = &JFactory::getDocument();

$document->addStyleSheet( $url );

Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!

ewel
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Mon Oct 01, 2007 11:35 am

Re: Style sheets in modules

Post by ewel » Wed Dec 19, 2007 11:35 pm

markdarb if I am not mistaken that is code for 1.5. If so, do you know how it is done in 1.1?

markdarb
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Dec 13, 2007 7:30 pm

Re: Style sheets in modules

Post by markdarb » Thu Dec 20, 2007 3:57 am

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.

ewel
Joomla! Apprentice
Joomla! Apprentice
Posts: 37
Joined: Mon Oct 01, 2007 11:35 am

Re: Style sheets in modules

Post by ewel » Thu Dec 20, 2007 7:24 am

Trying to find out because I don't know myself!  :) I have not used 1.5 yet..


Post Reply