1
wtravel
custom theme per module

Hi,

I would like to have a different theme for several modules, so that I can have unique background colors per module (to make the site more alive).

How can I get this feature?

Regards,

Martijn

2
wammes
Re: custom theme per module
  • 2003/12/20 9:27

  • wammes

  • Not too shy to talk

  • Posts: 101

  • Since: 2002/1/3 1


Well there was a discussion about how to detect the current module in smarty.
Did some searching and came to this thread. You could use that if statement in your theme so it selects a different style sheet for every module.
I don't recommend modifying the core files, but with some playing with it, it is possible.

3
Herko
Re: custom theme per module
  • 2003/12/20 10:50

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Do a search for the gaining-mass.com site launch news item. In the comments for that item, Draven explains how he made the themes change per module.

By the way, this feature will be added to 2.1, probably not in this form tho.

Herko

4
skalpa
Re: custom theme per module
  • 2003/12/20 12:26

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Other solution (shorter): you can add this php block at the top of your template.
<{php}>
$mod $GLOBALS['xoopsModule'];
$modvar = array( 'dirname' => (isset($mod) ? $mod->getVar('dirname') : 'system') );
$GLOBALS['xoopsTpl']->assign'xoops_module'$modvar );
<{/
php}>


Then you can get the name of the current module using:
<{$xoops_module.dirname}>


And last, if you want to insert a module dependent css, you should create modules/modulename/style.css within your theme folder, and insert it using something like this:
<link rel="stylesheet" href="<{xoops_imageurl}>modules/<{$xoops_module.dirname}>/style.css" />


The good point is that this simulates the next release behavior, so doing like this you'll just have to remove the php block and the link tag from your theme to make it work with the new version.
The bad point is that this might change before the final version (I don't think so actually, but...)

Skalpa.>

5
wtravel
Re: custom theme per module

Hi Skalpa,

I think I should also remove the current css file from theme.html in order to make it work. Otherwise I would have 2 css files with the same Unique ID's and Class names but with different settings.

Quote:


Is this correct?

Martijn

6
studioC
Re: custom theme per module
  • 2003/12/20 13:53

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks skalpa...
i actually use near the same script which you#ve posted days before in order to display different images at the header, and it works fine...

http://xoopsfactory.com

the new release isn#t ready yet...but if it is ready .. there sure will be a newer release..

thanks again...

michael

7
skalpa
Re: custom theme per module
  • 2003/12/20 14:21

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Quote:
I think I should also remove the current css file from theme.html in order to make it work.


Normally you don't have to, but that's where the difficulties appear...
If you keep both css, the values you set in the 2nd one will override the ones in the 1st one. So you should try keeping the xoops_themecss declaration 1st and insert the module specific one after (again, that's the order I used for 2.1).

So, if you do things like this
In style.css:
.
itemHead {padding3pxbackground-color#2F5376; color: #FFFFFF; }

In modules/news/style.css:
.
itemHead background-color#ff0000; }


The news module "itemHead" elements will have a red background, but the color will stay white (as defined in the 1st stylesheet).
As I said this may get a little tricky to manipulate depending on the way you use the stylesheets, but you should really do it like this (define "common" rules in the main css, and (re)define custom properties in the mod css).

Skalpa.>

8
wtravel
Re: custom theme per module

Thanks guys,

That will do the trick

Regards,

Martijn

9
Anonymous
Re: custom theme per module
  • 2004/7/15 1:36

  • Anonymous

  • Posts: 0

  • Since:


I was just thinking today about custom page per module and found this post.

My question: is this still a viable solution or are there other better ways? (not that I would know of any) In other words...this is not part of the core XOOPS functionality right?

And, when you say "top" of your template....where is top exactly? after the tag? does it matter?

Thank you for your assistance

10
wtravel
Re: custom theme per module

Hi,

You can do a search on "themechanger". It is a module that is perfect for having custom themes and even META descriptions and titles for each module.

I use it on my site and it works like a charm.

Regards,

Martijn

Login

Who's Online

333 user(s) are online (277 user(s) are browsing Support Forums)


Members: 0


Guests: 333


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