Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Messed up layout again after update
Previous Page
Author « Topic »
Page: of 2

insight
ECT Moderator

USA
4479 Posts

Posted - 05/02/2022 :  15:28:42  
quote:
I'm no server boffin & if any of the more knowledgeable people regarding htaccess rules see anything adrift please pipe up.

Well, since you asked, I wouldn't do any of that. Trying to prevent css and javascript being cached in the browser might be convenient for your occasional updates but downloading all that content for every page load is going to hurt your performance, you want stuff to be cached for a really long time if it hasn't changed. Instead, do this:

In your document head you'll have a couple of lines where ectcart.css and ectcart.jss are called. Append a query string to them with a unique number (or anything, really) like this (add the part in red):
<link rel="stylesheet" href="css/ectcart.css?ver=1">
<script src="js/ectcart.js?ver=1"></script>

and then increment that number whenever you update the site. The next time the page is fetched the browser will look for the new version instead of relying on cached data.

On a Unix/Linux server, you can also automate that with something like this:
<link rel="stylesheet" href="css/ectcart.css?ver=<?php echo filemtime('css/ectcart.css'); ?>">
<script src="js/ectcart.js?ver=<?php echo filemtime('js/ectcart.js'); ?>"></script>

which will print the Unix timestamp of when the file was last modified. Update the file and the timestamp will change, forcing the browser to fetch a fresh copy.

Peter


Professional ecommerce web hosting services
Shared hosting Windows & Linux | Dedicated servers | Domains | SSL
Ecommerce Templates specialists since 2003
https://servelink.com

Mikelli
Ecommerce Template Guru

USA
1613 Posts

Pre-sales questions only
(More Details...)

Posted - 05/02/2022 :  17:15:30  
[red]make a backup of your current known functioning .htaccess file.[/red]

Yes made that mistake before, thus my reluctancy.

Michael

midvalleydrifter001
Ecommerce Template Expert

USA
935 Posts

Posted - 05/02/2022 :  18:04:07  
Great info Peter

Thanks

<link rel="stylesheet" href="css/ectcart.css?ver=<?php echo filemtime('css/ectcart.css'); ?>">
<script src="js/ectcart.js?ver=<?php echo filemtime('js/ectcart.js'); ?>"></script>


I did this and made a small change to one of the css files and re-uploaded but I didn't see the change in timestamp.

www.slixprings (DOT) com

Did I miss something?

Patrick

Edited by - midvalleydrifter001 on 05/02/2022 18:14:00

insight
ECT Moderator

USA
4479 Posts

Posted - 05/03/2022 :  09:10:23  
Hi Patrick

<link rel="stylesheet" href="css/ectcart.css?ver=<?php echo filemtime('css/ectcart.css'); ?>">

The file name highlighted in red there, needs to be the file name of the file you want to fetch the 'last modified' timestamp for. So the example above is correct and a change to ectcart.css will result in an updated timestamp. That works as expected on your site.

However, your other CSS lines are referring back to ectcart.css also, so this line that you have:

<link rel="stylesheet" href="css/ectstylebase.css?ver=<?php echo filemtime('css/ectcart.css'); ?>">

is only going to update the timestamp when you update ectcart.css, not ectstylebase.css. You want that one to update when you update ectstylebase.css, so that line should look like this:

<link rel="stylesheet" href="css/ectstylebase.css?ver=<?php echo filemtime('css/ectstylebase.css'); ?>">

Same with the others and the javascript. Does that make sense?

Peter


Professional ecommerce web hosting services
Shared hosting Windows & Linux | Dedicated servers | Domains | SSL
Ecommerce Templates specialists since 2003
https://servelink.com

Vince
Administrator

42849 Posts

Posted - 05/03/2022 :  09:55:34  

midvalleydrifter001
Ecommerce Template Expert

USA
935 Posts

Posted - 05/03/2022 :  09:59:49  
Thanks for pointing out my omission Peter.

I made the changes but have one that still won't update.

When doing an "Inspect" on the page that I made a small css change to I have to Ctrl+F5 to see the changes.

css/ectstyledetails3.css?ver=20220418

This is how I have it listed:

<link rel="stylesheet" href="css/ectstyledetails3.css?ver=<?php echo filemtime('css/ectstyledetails3.css'); ?>">



Edited by - midvalleydrifter001 on 05/03/2022 10:05:32

insight
ECT Moderator

USA
4479 Posts

Posted - 05/03/2022 :  10:19:50  
That's because you have that line duplicated in your rendered code, once in the head and once originating from the includes file.

Peter


Professional ecommerce web hosting services
Shared hosting Windows & Linux | Dedicated servers | Domains | SSL
Ecommerce Templates specialists since 2003
https://servelink.com

midvalleydrifter001
Ecommerce Template Expert

USA
935 Posts

Posted - 05/03/2022 :  17:31:42  
Thanks for the heads up on those duplicate files Peter.

Pretty sure I have it all lined out now.

Thank you so much.

Patrick
Page: of 2 « Topic »  
Previous Page
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000