Jump to content

Adding Conditionals in CSS Files (e.g., custom.css)?


Recommended Posts

7 minutes ago, Rikki said:

Yes, you can use logic in CSS files ^_^ 

I must have done it wrong then.

So something like this should work?

{{if \IPS\Dispatcher::i()->application->directory == 'forums' and \IPS\Dispatcher::i()->module->key == 'forums' and \IPS\Dispatcher::i()->controller == 'forums' and in_array(\IPS\Request::i()->id, array(1,2,3))}}


Link to comment
Share on other sites

23 minutes ago, Rikki said:

Ah, no, that won't because CSS files are compiled down when saved, so you can't write logic that depends on anything happening per-page. You can do something like this:

{{if theme.rounded_photos}}

...for example.

Let's say I wanted to call up CSS classes based on the page, member, member group, etc., am I then restricted within templates or blocks?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...