News:

Join the Facebook Fan Page.

Main Menu

table background?

Started by mack420, January 31, 2020, 05:34:25 PM

Previous topic - Next topic

mack420

ok, so it seems that only members of the site can't see the change made to the background

another member of my site has same problem and it would seem drew who responded to me could see the change and i am assuming he was not signed into an account, so any help with would be greatly appreciated

it doesn't seem to be a cache issue

drewactual

it is a cache issue. 

you may have an expires header in your htaccess or your host may have one in their httpd that sets an extraordinary amount of time on your css file, or, you're using a chopped theme that eliminated the time stamp on css's as SMF does 'out of the box'.  there are several different kinds of cache's and there are several different ways to leverage them, which makes it difficult to accomplish and makes 'cache busting' a big business. 

so you ask me what can be done, and i'll tell you... but... it is a HACK... i can hack like nobody's business but i DON'T LIKE IT. 

1- open your index.template.php for the theme you're using... find the call to css... it'll look something like:
<link rel="stylesheet" type="text/css" href="yourwebsite.com/css/index.css?fnl" />

you see those letters after the '?' ? well, they tell the server to check the time stamp for all practical purposes.... make sure yours has one...

if it doesn't, add it... and save and see what happens...

if it doesn't work, here comes the hack:

2- RIGHT BEFORE THE </head> tag, add another line something like:
<link rel="stylesheet" type="text/css" href="yourwebsite/css/index.css?fnl" />


EXCEPT instead of index.css, name it "booster-custom.css"...

save, close. 

2B:  make a new file on your server that is in the same directory as your themes's css... name that file "booster-custom.css"... INSIDE booster-custom,css add the css code from earlier :
td.post{background-color:#000;color:#fff;}

what we've done is add another call in your header, which makes the server make an additional trip to apply that css... you 'could' hard code the css into the header, BUT- it may or may not 'take' depending on which happens first, as the css applied will be the last one called... calling it in it's own sheet and at the very last moment DOES slow things down a touch, but... it WILL force this new change...

DON'T remove the code from the index.css- leave it there... sooner or later that css will be applied.  it may be sooner... it may be later... every once in a while see if it does- and when it does? remove the booster-custom.css call in the index.template. 

here is the punch line:  if your server is caching or some switch/hub along the way is caching, IT WILL PICK THIS CHANGE UP and cache it too...... which means that will stick just as the problem you have now does.   do you see how this kind of 'hack' can get out of hand?

caches rock... and caches suck. 

good luck, brother.



drewactual

actually, i just looked at your code...

man, no offense- but that is a mess... how many calls is there in that page?  at any rate......

your change needs to happen in a file called ..../Themes/default/css/breeze.min.css.... that is a minimized css without a time stamp check...

add the css snippet to the bottom of that file, and you may as well minimalize it:
td.post{background-color:#000;color:#fff} then save it...

then go to your index.template.php and find the call:
<link href="http://sef4life.com/forum/Themes/default/css/breeze.min.css" rel="stylesheet" type="text/css" />

and make it:
<link href="http://sef4life.com/forum/Themes/default/css/breeze.min.css?fin20" rel="stylesheet" type="text/css" />


in short, the maker of this theme already did what i proposed- they hacked it... in the precise way i said to.... and.... this is why you don't hack- you do it right the first and only time....

mack420

how do i open /Themes/default/css/breeze.min.css

drewactual

are you accessing through cpanel or ftp?  it should be just a matter of locating and opening it?

mack420

i am in my site administration

that is where i edit my theme

i can't find the file you are referring to though

drewactual

ahh.... can you access it through cpanel or ftp?

if not, add this to your index.template.php just before /head... :


<style="text/css">
td.post{background-color:#000!important;color:#fff!important;}
</style>


this is just adding hack to hack... i don't like it... the proper way is to access that min.css file and make the change there... but... this should, uh... 'work'....

mack420

i was able to edit the file through cpanel and added

td.post{background-color:#000;color:#fff}

i can't find the line of code in the index.template.php to replace with the line you gave me

I did find this one though

<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />';

drewactual

that's the php line and yes- the one you modify.. i was posting the 'output' of that code...

it looks like it adds the time stamp- which isn't really- it just tells the server when there is a newer version available.

are you set with the addition of that code?

mack420

what do i add in? the line you gave me previously?

drewactual

the easiest way out of this is to add this line to your index.template.php just before the "</head>" tag. 


<style="text/css">
td.post{background-color:#000!important;color:#fff!important;}
</style>


you should be able to refresh your page and see the changes... unless you have OPCache set up, and if you do you'll have to reset that... lets hope you don't.

mack420

still not working

am i supposed to modify this line

<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />

if so, with what?

drewactual

that line is right. 

it's the call to that minimized css that needs to be updated... add ?fin20 after .css on that line... it appears just before the head closing tag... but, you still gotta get that css change in it however you can.

mack420

that line already has ?fin20 after the .css and the line appears just after the head opening tag, at least that is what I am seeing

is it supposed to be before the head closing tag?

drewactual

it's fine there.  put:

<style="text/css">
td.post{background-color:#000!important;color:#fff!important;}
</style>
AFTER it but before "</head>".   and that should take care of your issue...

mack420

i already have that line

<style="text/css">
td.post{background-color:#000!important;color:#fff!important;}
</style>


just before the closing header tag

should i move up to just after the other line?

mack420

ok, new problem

so i went ahead and moved this line up just after the line that is already there

<style="text/css">
td.post{background-color:#000!important;color:#fff!important;}
</style>


and i saved it and i get a white screen with this message in the left corner

Unable to load the 'main_above' template.

*groans*

i'm ready for bed

mack420

i went to my cpanel to edit my index.template.php file and removed the code i put after the line that was there, so my site loads up again, but i am back at square one with the background color in the table

m4z

Is the theme you're editing the same theme your account is using? ;)
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

mack420


Advertisement: