Riley
New Member
Posts: 26
inherit
227595
0
Apr 23, 2024 8:30:40 GMT -8
Riley
26
December 2015
rileyy
|
Post by Riley on Jun 21, 2021 22:26:28 GMT -8
I'm using the 'easy way out' and using images for my board list backgrounds, but in doing so the new/old icons have gotten all janky.
I'm sure there's a way but I'm unsure of it personally: what is the best way I could work my coding so that it will show a new class (a background URL property, specifically) depending on if there are any new posts in a board?
Here's a visual example 'cuz I can be rubbish at explaining:
The top is an "old" board, and the bottom with the golden edge is a "new" board - exactly the same coding, apart from the golden one having a different background URL. I'm currently using the class in a <tr> right beneath the {foreach $[board]} {if !$[board.is_redirect]}, but in doing so I kinda shot myself in the foot because I can only use one background class.
Any help would be greatly appreciated! I've been duped for a few days trying to puzzle this together on my off time.
|
|
Kami
Forum Cat
Posts: 40,030
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,030
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Jun 21, 2021 22:31:13 GMT -8
Hey nice to see you again! Is this the same theme from before? It's really nice Yeah, you can put variables within HTML tags! What I usually do is do conditional classes like: <div class="{if $[board.is_new]}NewClass{else}OldClass{/if}"> and then use the style sheets to style each respective class. You can do this for basically every variable that exists, across multiple HTML elements and "parts" for lack of a better word, to create really diverse looks in really granular ways, even from a individual specific board standpoint (though obviously, would be really tedious if you went that route). That said, somethings to note: - if you do this method, you'll have to use SINGLE quotes if your conditional needs to declare a specific string (like $[variable] == 'Name Here'). - nesting conditionals in classes is a bit more hit and miss than nesting them normally, which is already a little hit and miss to start so you'll have to play around. Hope that helps!
|
|
Riley
New Member
Posts: 26
inherit
227595
0
Apr 23, 2024 8:30:40 GMT -8
Riley
26
December 2015
rileyy
|
Post by Riley on Jun 21, 2021 23:05:56 GMT -8
Hey nice to see you again! Is this the same theme from before? It's really nice Yeah, you can put variables within HTML tags! What I usually do is do conditional classes like: <div class="{if $[board.is_new]}NewClass{else}OldClass{/if}"> and then use the style sheets to style each respective class. You can do this for basically every variable that exists, across multiple HTML elements and "parts" for lack of a better word, to create really diverse looks in really granular ways, even from a individual specific board standpoint (though obviously, would be really tedious if you went that route). That said, somethings to note: - if you do this method, you'll have to use SINGLE quotes if your conditional needs to declare a specific string (like $[variable] == 'Name Here'). - nesting conditionals in classes is a bit more hit and miss than nesting them normally, which is already a little hit and miss to start so you'll have to play around. Hope that helps!
Heyhey! And yep, sure is! I bounced back to it after a little break when I hit a wall and had to work on some other things. And yes, that's exactly what I needed! Just tested it out with a new account and it worked perfectly. I wasn't sure how friendly HTML variables were on ProBoards- I'll need to go study what passes and what doesn't at some point.
I'll be sure to keep this in mind if I ever need to do something similar in another part of the forum! (And I'm sure I will, this is a pretty nice workaround some weirder coding). Thank you!
|
|
Kami
Forum Cat
Posts: 40,030
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,030
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Jun 21, 2021 23:17:29 GMT -8
Hey nice to see you again! Is this the same theme from before? It's really nice Yeah, you can put variables within HTML tags! What I usually do is do conditional classes like: <div class="{if $[board.is_new]}NewClass{else}OldClass{/if}"> and then use the style sheets to style each respective class. You can do this for basically every variable that exists, across multiple HTML elements and "parts" for lack of a better word, to create really diverse looks in really granular ways, even from a individual specific board standpoint (though obviously, would be really tedious if you went that route). That said, somethings to note: - if you do this method, you'll have to use SINGLE quotes if your conditional needs to declare a specific string (like $[variable] == 'Name Here'). - nesting conditionals in classes is a bit more hit and miss than nesting them normally, which is already a little hit and miss to start so you'll have to play around. Hope that helps!
Heyhey! And yep, sure is! I bounced back to it after a little break when I hit a wall and had to work on some other things. And yes, that's exactly what I needed! Just tested it out with a new account and it worked perfectly. I wasn't sure how friendly HTML variables were on ProBoards- I'll need to go study what passes and what doesn't at some point.
I'll be sure to keep this in mind if I ever need to do something similar in another part of the forum! (And I'm sure I will, this is a pretty nice workaround some weirder coding). Thank you!
fabulous! proboards is really flexible with its variables, so everything should work as long as the variable behaves in a way you expect it to (eg, don't use a variable that outputs a string to execute and "if it outputs or doesn't output" conditional because it will always output). in all of my themes which range from moderately advanced to "i made my entire forum into an interactive newspaper" complex, the only thing i really had to cobble together with really wonky coding was nesting variables. everything else is really straightforward (including combined conditionals like or / and statements) so it'll shave a lot of hack-y workarounds for like 99.9% of themes (: feel free to lmk if you need anything else!
|
|