crmamx Posted April 8, 2011 Share Posted April 8, 2011 I am having a heck of a time with testing my site. I make a change, upload it, test it and it doesn't work. Then I fool around with the code for who knows how long and it still doesn't work. Finally I will clear the cache and many, many times that is the problem. How can I fix this? My cache is set at 50 mb. Also, when I clear it, it clears my search history too and I don't want to do that. Quote Link to comment Share on other sites More sharing options...
gristoi Posted April 8, 2011 Share Posted April 8, 2011 What in particular is not refreshing? Is it php, javascript or css thats causing the issue? Quote Link to comment Share on other sites More sharing options...
Philip Posted April 8, 2011 Share Posted April 8, 2011 I suggest a few add-ons that will really help with development: http://getfirebug.com/ http://chrispederick.com/work/web-developer/ (has a disable cache option, which I almost always have turned on) Both are awesome and can really help when working on websites. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 8, 2011 Share Posted April 8, 2011 You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change. Dynamically produced pages, where each request for the same URL can contain different content, should output headers that prevent caching. There are many ways of accomplishing this, but it should be done globally in a .htaccess file or similar so that you don't need to do it in your code. Quote Link to comment Share on other sites More sharing options...
.josh Posted April 8, 2011 Share Posted April 8, 2011 You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change. Well that's not really the root of the problem. Even if he was saving it on his own computer he would still be testing it through his browser, which would cache the content all the same. Quote Link to comment Share on other sites More sharing options...
crmamx Posted April 8, 2011 Author Share Posted April 8, 2011 What in particular is not refreshing? Is it php, javascript or css thats causing the issue? Usually it is my css file. I suggest a few add-ons that will really help with development: I have Firebug. The other one are you referring to adding is it: Web Developer 1.1.9? You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change. You are right, I spend a lot of time changing, uploading and viewing the changes. But I don't have any other way to do it. I just don't want to install a server and the stuff I need to do it on my computer. This is my only site. If I was a developer, no question I would do it. There are many ways of accomplishing this, but it should be done globally in a .htaccess file or similar so that you don't need to do it in your code. Have no idea even what you are talking about. I will Goggle .htaccess and see what I come up with. Quote Link to comment Share on other sites More sharing options...
crmamx Posted April 8, 2011 Author Share Posted April 8, 2011 What if I set my cache to 0? Isn't that the same as turning it off? What do I lose if I do that? Quote Link to comment Share on other sites More sharing options...
gristoi Posted April 8, 2011 Share Posted April 8, 2011 If its your css that is causing you a problem then you might want to append a random number to the end of the tag. This will force the users browser the refresh to the new script. <link ... href="path/to/my.css?version=1234523123"> if you are using php in the page then you could just try appending the current time to it using the time function <link ... href="path/to/my.css?version=<?php echo time(); ?>"> this will ensure every upload is unique Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 8, 2011 Share Posted April 8, 2011 .htaccess example (modify the list of file extensions to suite your needs) - <IfModule mod_headers.c> # Force no caching for dynamic files <FilesMatch "\.(php|htm|html)$"> Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" Header set Pragma "no-cache" </FilesMatch> </IfModule> Quote Link to comment Share on other sites More sharing options...
crmamx Posted April 8, 2011 Author Share Posted April 8, 2011 .htaccess example (modify the list of file extensions to suite your needs) - <IfModule mod_headers.c> # Force no caching for dynamic files <FilesMatch "\.(php|htm|html)$"> Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" Header set Pragma "no-cache" </FilesMatch> </IfModule> You guys are "insane." Many thanks! Quote Link to comment Share on other sites More sharing options...
crmamx Posted April 9, 2011 Author Share Posted April 9, 2011 if you are using php in the page then you could just try appending the current time to it using the time function <link ... href="path/to/my.css?version=<?php echo time(); ?>"> this will ensure every upload is unique On advice of counsel, I added this. I guess it is the same thing. <link type="text/css" rel="stylesheet" href="css/custom.css?v=<?php echo microtime(); ?>" /> We'll see how it does because it is still driving me crazy. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2011 Share Posted April 9, 2011 If forcing your browser to reload the page isn't having an effect, be advised that a lot of web hosts have set the disk cache life-time to a high value, in an attempt to get as many accounts as possible to work on one server. This will prevent the server from operating on your changed source files until the cached versions of your files have become 'stale' and are read again from the disk. Are you still sure you don't simply want to set up a local development system on your computer? There are several all in one packages that normally only take a few minutes to download and install. Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 10, 2011 Share Posted April 10, 2011 Are you still sure you don't simply want to set up a local development system on your computer? There are several all in one packages that normally only take a few minutes to download and install. I second that! even if it's only for this one site of yours, developing locally is much more fun, because you don't have to wait, it just runs on your own computer. Trust me I am a complete idiot on setting up servers, but than again something like wamp (made for idiots like me ) is set up in about 5 minutes and it works. And from that moment on you can test locally, ones you're done you upload it. (i use wamp and netbeans works almost out of the box) and you don't need a super computer. Quote Link to comment Share on other sites More sharing options...
crmamx Posted April 15, 2011 Author Share Posted April 15, 2011 Ok guys, I am looking at Wamp. Ya'll are just too convincing... Quote Link to comment Share on other sites More sharing options...
cssfreakie Posted April 15, 2011 Share Posted April 15, 2011 yeah it rocks! when you run it just open up your browser and do http://localhost as for you editor, i am not sure what komodo can, but if your able to store files in the www folder of wamp you can directly run them Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.