1
ksleong
Include CSS Style Sheet Inside A Template
  • 2007/9/18 12:19

  • ksleong

  • Just popping in

  • Posts: 1

  • Since: 2007/8/9 1


Hi,

Template files don't contain tags. If I want to include a separate style sheet in a template file, how can I do that? Thanks!

Leo

2
kaotik
Re: Include CSS Style Sheet Inside A Template
  • 2007/9/18 12:29

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


Just put this at the top of your template:
<link rel="stylesheet" type="text/css" href="<{$xoops_url}>/modules/yourmodule/yourstylesheet.css" />


It will work fine.

Note:
If your building a new module to release here on xoops, I would recommend you use the .item class from the default theme whenever possible. That way your module will adapt to each users theme.

3
vaughan
Re: Include CSS Style Sheet Inside A Template
  • 2007/9/18 14:25

  • vaughan

  • Friend of XOOPS

  • Posts: 680

  • Since: 2005/11/26


if you are wanting a W3C valid template then adding

<link rel="stylesheet" type="text/css" href="<{$xoops_url}>/modules/yourmodule/yourstylesheet.css" />


will make the templates invalid.

you're better to use >

$xoTheme->addStylesheet(XOOPS_URL.'/modules//stylesheet.css');


place that code right after where it says

include XOOPS_ROOT_PATH '/header.php';


in the php file itself. that will then inject the stylesheet into the of the theme during parsing.

including the link in the template itself will also not work fully if you have module cache enabled too. so the $xoTheme method is best..

Login

Who's Online

290 user(s) are online (248 user(s) are browsing Support Forums)


Members: 0


Guests: 290


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits