Can boards have different colors?

Started by Segnali, February 17, 2018, 10:40:15 AM

Previous topic - Next topic

drewactual

I do.. And I own both smfhacks and smfpacks ad handler... But neither suite my needs, and both argue with php7.  I dont need anything that heavy, quite frankly.   Theyre both good in different ways and I'm certain I'll use them on other ventures, but speed, clean, and heavy traffic are my concerns on the page I ised as an example.  This little script is a champ for that.

Gwenwyfar

butch's solution is good, 2.1 already does that by default. But you'll need to use the right variable. I can take a look at it later if no one else does.
"It is impossible to communicate with one that does not wish to communicate"

Segnali

Quote from: Gwenwyfar on April 01, 2018, 10:36:35 PM
butch's solution is good, 2.1 already does that by default. But you'll need to use the right variable. I can take a look at it later if no one else does.

I am stuck at SMF 2.0.5

If I try to upgrade I get errors and after all the mods I added, I really don't want to mess with it.

Illori

if you are still running 2.0.5, you are open to possibly being hacked. you really need to take time to upgrade to 2.0.15 for security and php compatibility.

Segnali

Quote from: Illori on April 02, 2018, 05:06:45 AM
if you are still running 2.0.5, you are open to possibly being hacked. you really need to take time to upgrade to 2.0.15 for security and php compatibility.

I backup once a week. Being hacked cannot be 100% prevented even by running NASA software...

I just need butch's solution to work and it doesn't on my forum  :-\

Kindred

and yet... by running a version 10 releases behind, you are pruposefully exposing your site and your users to potential hack/breaches.

You need to update ASAP
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Steve

Segnali, listen to the man. Why make it easier for hackers?
DO NOT pm me for support!

butch2k

Could you post the index.template.php of your current theme ?

Segnali

Quote from: Steve on April 07, 2018, 10:08:48 AM
Segnali, listen to the man. Why make it easier for hackers?

alright I'll do it ASAP.

P.S. I love your avatar  :)

Segnali

Quote from: butch2k on April 07, 2018, 10:23:25 AM
Could you post the index.template.php of your current theme ?

sure, here it is, thank you

butch2k

Could you try modifying your css like this:

.board_94{
background: #c25 url(../images/theme/backdrop.png) repeat-x;
}
.board_106{
background: #ddd url(../images/theme/backdrop.png) repeat-x;
}

if you need the backdrop image.

else
.board_94{
background: #c25;
}
.board_106{
background: #ddd;
}

Segnali

what do you mean by backdrop image? sorry English is not my first language.

Thank you

Segnali

Quote from: butch2k on April 08, 2018, 06:58:58 AM

.board_94{
background: #c25;
}
.board_106{
background: #ddd;
}


tried the latter with color #0C090A for board #106 but did not work, nor worked #c25 for board #94  :-\

drewactual

humor me?
in your index.template, do:

before:

echo '
</head>


add:

//board color adjustment script
if(( isset($_REQUEST['board']) && $_REQUEST['board'] == '94' )  || ( isset($board) && $board == '94' )) {
  echo '<style> body\{background:#c25\}</style>'; }
if(( isset($_REQUEST['board']) && $_REQUEST['board'] == '106' ) || ( isset($board) && $board == '106' )) {
  echo '<style>body\{background:#ddd\}</style>'; }
//end board color adjustment script


lose the css adjustments...

if you need/want to change colors on more boards, simply copy/paste one of the two lines above and change the board number and the color code... it's really about that simple. 

i don't have means to test it, but this or something very close should do the trick you seek.  the '\' prior to the '{' or '}' is required, i do think, due to it having a specific purpose within php... if this doesn't do what you need, no harm no foul, remove it and go with the CSS once you iron it out... don't get me wrong, i love css and what it can do- but there is little comparison of functionality to just code it in... 

butch2k

 Segnali is it possible to get a link to your board ? I need to have a look to understand what's going on.

Segnali

#35
Quote from: butch2k on April 12, 2018, 05:04:34 PM
Segnali is it possible to get a link to your board ? I need to have a look to understand what's going on.

I created a copy on a test site so we can play with the copy.

http://www.evotrading.it/forum/index.php

The boards # in the css files have been changed in the test copy because the others are for private boards.

New numbers are 98 & 103

Thank you

P.S. I know I need to update the forum software so I will get on this week starting from that copy as well.

Gwenwyfar

You will have to edit your index.template to fix the variable you are using, change:

echo $context['html_headers'];

global $board;
echo '
</head>
<body class="'.(isset($board)?"board_".$board:"").'">';


to

echo $context['html_headers'];

echo '
</head>
<body', (!empty($context['current_board']) ? ' class="board_'. $context['current_board'] .'"' : ''),'>';
"It is impossible to communicate with one that does not wish to communicate"

butch2k

Yes it should work, $board works on my forum probably because it is set by simpleportal at some previous point which might not be the case on pure SMF.

Advertisement: