collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 315
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: custom Block styling in one theme only  (Read 14845 times)

0 Members and 1 Guest are viewing this topic.

Offline ncoded

  • Semi Newbie
  • *
  • Posts: 33
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
custom Block styling in one theme only
« on: December 09, 2015, 07:17:53 AM »
I made a custom .windowbg4 that I am using with a block in a custom theme that I am working on. All good, except when I switch back to the SMF Default Curve theme, this custom class is applied instead of the native .windowbg3.

This is true whether I place my custom class in portal.css or index.css within mycustom theme, while when switching to the SMF Default there is no styling (as expected, since this class is not defined there).

Is there a way to make the custom class apply only in a particular theme?

One idea I had was to modify the index or portal css in the SMF Default theme so that no matter which one is applied, the native .windowbg3 is applied. Anyone with a better idea?
SMF 2.0.11 | UTF-8 Language packs | GoDaddy Unix Shared Premium | SMF 2.1 b2 | Coppermine Gallery 1.5.38 | SimplePortal 2.3.6

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: custom Block styling in one theme only
« Reply #1 on: December 09, 2015, 02:28:37 PM »
As far as I know windowbg4 is not used anywhere in SMF/SP, so it's not declared in any css at least in the default theme.
As such, if your block outputs something like:
Code: [Select]
<div class="windowbg4">something</div>then that "something" will basically have no style applied (except for those inherited from the parent tags).

Are you by any chance expecting that on the default theme instead of:
Code: [Select]
<div class="windowbg4">something</div>a
Code: [Select]
<div class="windowbg3">something</div>is created?

Offline ncoded

  • Semi Newbie
  • *
  • Posts: 33
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: custom Block styling in one theme only
« Reply #2 on: December 09, 2015, 09:15:40 PM »
Thank you for your reply.

I apologize for the misunderstanding; let me try to rephrase my story.

I know that .windowbg3 is defined and used in the default (Curve) theme and from there it is also picked up by SP. But I am designing a custom theme based on Curve and I want to use a different Default Body Class for certain custom HTML blocks. For these blocks I can define my own body class, which I call .windowbg4

All is good so far, my blocks have the customization that I desireas long as I show my custom theme. The problem is, these customizations  will also be applied to the blocks if I switch to Curve (because SP uses the same blocks in both themes).

So my question would be: is there a way to use .windowbg3 for these blocks in Curve, and my own .windowbg4 in my custom theme (and only there)?

SMF 2.0.11 | UTF-8 Language packs | GoDaddy Unix Shared Premium | SMF 2.1 b2 | Coppermine Gallery 1.5.38 | SimplePortal 2.3.6

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: custom Block styling in one theme only
« Reply #3 on: December 09, 2015, 10:34:41 PM »
ncoded,

You can have it check which theme and use that condition to edit the custom class accordingly.
Another idea is that you can create a windowbg4 class in the default css file & duplicate the windowbg3 class attributes into it.


Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: custom Block styling in one theme only
« Reply #4 on: December 10, 2015, 08:19:35 AM »
Another idea is that you can create a windowbg4 class in the default css file & duplicate the windowbg3 class attributes into it.
Ugh, simply add .windowbg4 next to .windowbg3, much shorter and less confusing.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: custom Block styling in one theme only
« Reply #5 on: December 10, 2015, 08:28:25 AM »
An example of your html block would help quite a lot, because I'm still guessing here.
So I suppose you have something like the following in your block:
Code: [Select]
<div class="windowbg4">some content</div>if this is the case, then yo ucan just do:
Code: [Select]
<div class="windowbg3 windowbg4">some content</div>then define the css in your theme like for example:
Code: [Select]
.windowbg3.windowbg4 {
     attribute: here;
}
do note windowbg3 and windowbg4 are separated just by a dot, without any space.

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: custom Block styling in one theme only
« Reply #6 on: December 10, 2015, 09:17:12 AM »
That, too. :)
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline ncoded

  • Semi Newbie
  • *
  • Posts: 33
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: custom Block styling in one theme only
« Reply #7 on: December 10, 2015, 07:34:39 PM »
I have tried to attach two images: in the Custom you should notice the square borders around the blocks (as I defined them in my .windowbg4). Any styling is though non-existent in Curve (I guess because my styling is not defined in index.css or portal.css for Curve). This creates a situation where the themes look too markedly different. In the larger scheme of things, I will have at least four slightly different themes to choose from, mostly just for color-coordination.

So now what happens is that in the way I have these stylings and settings, if I use Curve the blocks are missing their styling (.windowbg), whereas if I use Custom then my borders show.

What I really am after is that whichever theme I use, my Custom theme shows properly color-coordinated. Imagine, if you wish, several sports clubs, each with their signature color; whichever club you're in, the club colors appear in the theme - but otherwise all stays the same.

Maybe the best way would be to do conditional css loading, but not sure how that works. Another way is to do lots of css duplicates, basically not allowing the program to fall back on any non-defined styling. Or there may be other ways to deal with this...
SMF 2.0.11 | UTF-8 Language packs | GoDaddy Unix Shared Premium | SMF 2.1 b2 | Coppermine Gallery 1.5.38 | SimplePortal 2.3.6

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: custom Block styling in one theme only
« Reply #8 on: December 10, 2015, 09:42:14 PM »
Just open your Curve index.css and add .windowbg4 next to .windowbg3 like this:
Code: [Select]
.windowbg3, .windowbg4
{
css code here
}
It will become same as windowbg3 in Curve theme, and it will work with custom windowbg4 in custom theme.

Otherwise, you just need to add a new .windowbg4 class and define its properties manually.
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis

Offline emanuele

  • Developer
  • *
  • Posts: 293
Re: custom Block styling in one theme only
« Reply #9 on: December 11, 2015, 02:12:07 AM »
Is there a way to make the custom class apply only in a particular theme?

One idea I had was to modify the index or portal css in the SMF Default theme so that no matter which one is applied, the native .windowbg3 is applied. Anyone with a better idea?
From your first post you were after the exact opposite to me. ;)

Of course, the way is to add new css to the theme you want, I don't see any other way.

Offline ncoded

  • Semi Newbie
  • *
  • Posts: 33
  • Gender: Male
  • SMF Version: 2.0.11
  • SP Version: 2.3.6
Re: custom Block styling in one theme only
« Reply #10 on: December 11, 2015, 11:16:47 AM »
I found that doing as Ninja suggested was the best and easiest solution for me, quick testing seems to produce what I want, so I'm sticking with it.

Once again, thanks to all!
SMF 2.0.11 | UTF-8 Language packs | GoDaddy Unix Shared Premium | SMF 2.1 b2 | Coppermine Gallery 1.5.38 | SimplePortal 2.3.6

Offline ♦ Ninja ZX-10RR ♦

  • Spammer Hammer
  • Support
  • *
  • Posts: 1193
  • Gender: Male
  • Sniper Legends
    • Virtual Interactive Games Entertainment™
  • SMF Version: 2.0.13
  • SP Version: 2.3.6
  • Elkarte Version: 1.0.6
Re: custom Block styling in one theme only
« Reply #11 on: December 11, 2015, 11:23:36 AM »
Glad it worked out, feel free to post again if you have more doubts :)

Regards
Have you tried SimplePortal Documentation before asking? ;)
F.A.Q.  English Support  |  Blocks Support
Fancy Feature idea ?!  |  Blocks Requests
Themes & Graphics

? My job! ?No PMs for support unless it's a paid request. Thank you! :)#OpIsis