Fork me on GitHub
Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Nominate XOOPS!

Learn XOOPS Core

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $25.00
Net Balance: $23.97
Left to go: $76.03

Donations
Anonymous ($25)Aug-11

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 3.0 4 6 2013 Abuse Android AntiHarvesting AntiMalUser AntiSpam API Apple Battlefield Blocks Bootstrap Captcha cell cent chronolabs CHUNG Clicks content CĂN demo download Dresses facebook Fat Food for free Gateway Google Guide herre Home Honeypot HP html5 Human HỘ iPhone jQuery List Loss mobile module modules Monster new newbb news NHÀ online PARK Payment phone PHP Prevention profile project Protector publisher RESIDENCE responsive review Rights rmcommon Room security Sentry site Smartphone Smarty Smoking Solution Spam stem Studio support tag tags tdmcreate The Theme themes User userlog web weight Wishcraft xoops Xortify XPayment ZendFramework

New Users

Registering user

# 137677

jessygoth

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post



#1 Posted on: 2011/3/11 15:26 Module Development CSS help
I'm trying to find a more elegant way of selecting different CSS stylesheets for one of my modules based on the theme. I don't want to code the module for a specific theme.

What I'd like to do is create a base CSS file in the module directory and then create different CSS files containing the theme colors desired (light, dark, etc).

What I'd really like is to have something like a xoCSSUrl parameter (similar to the xoImgUrl) where I could overload the CSS from a theme's directory (<mytheme>/modules/templates/images). I don't think anything like this exists, does it?

A method similar to this would allow a theme changer to be able to select a new theme and the module's color parameters, etc. would also change automatically. The way it works now there's no easy way to do this without just dumping the module's CSS files into the theme CSS files.

Any other ideas of how to accomplish this 'automatically'?

Top

zyspec
Module Developer
Module Developer
Joined:
2004/9/21 8:28
From USA
Group:
Registered Users
Posts: 876
(Show More) (Show Less)


#2 Posted on: 2011/3/11 20:21 Re: Module Development CSS help
In your theme you should have these three lines...

<link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/xoops.css" />
<
link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_themecss}>" />
<{
$xoops_module_header}>


The first line is the default xoops css, the second line is the theme css and the third is loading the file header.php from the module root directory.

Personally I think the theme CSS should be the last one listed...

You could do some things in the header.php file and perhaps do what you want but I believe the browser will process any CSS files in the order received and if you include a CSS sheet in your header.php file it would overload any other properties from the other two CSS sheets. You might be able to play with the order of these or check for properties with the header.php file and go from there.

Rodney

Top

redheadedrod
Home away from home
Home away from home
Joined:
2008/2/26 10:05
From Grand Rapids, MI
Group:
Registered Users
Posts: 1263
(Show More) (Show Less)


#3 Posted on: 2011/3/11 22:09 Re: Module Development CSS help
Unfortunately your suggestions won't do what I want.

Firstly, I can't control which theme is loaded - since it's a module.

I do load content using $xoTheme->addStylesheet() method in the module.

The issue is that the module can't dynamically switch CSS in the module to 'match' the theme selected.

Top

zyspec
Module Developer
Module Developer
Joined:
2004/9/21 8:28
From USA
Group:
Registered Users
Posts: 876
(Show More) (Show Less)







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]