I have made a lot of style changes to my website by using hooks in the addon/my_changes folder. But everytime I make a change in the code, and i refresh the webpage, it will display the webpage without any of the changes I have made in the hook (a mess). I then have to refresh the page again, and it will display correctly. Does anyone know why this is?
This might be the cache problem. Clean cache from var and compiled folder or use this method to remove the cache
try clearing the template cache. To do it, open in your web browser http://www.your_domain.com/admin.php?cc, where www.your_domain.com is the address of your store and admin.php is a script file for the administration panel of your store which was renamed for security reasons.
If you have your store in Live or Development mode then you should only need to clear your cache when a hook is first created.
Subsequent changes in the hook file will be read in real time. Changes to templates not related to hooks should need the cache flushed if running the store in Live mode. But if in Development mode, the only time a cache flush is required is when a new file is added.
Note that changes to css data SHOULD be detected by your browser as needing to be re-read.
I am running in Development mode, and I regularly clean the cache & compiled folders. I tried http://www.your_domain.com/admin.php?cc,but nothing happens. Any ideas what is causing this? Is it normal for the first reload of a webpage after a css hook adjustment to mess up?
Is it normal for the first reload of a webpage after a css hook adjustment to mess up?
If you're talking about css, this could be browser dependent.
But normally, the browser requests the “change time” of the css file on the server and if it is greater than the “last get” in the browser then the file is downloaded and re-parsed and loaded into the DOM.
But the short answer is NO, it' is not normal.
I have found out what is happening is that on the first refresh after I change CSS code in my file 'my_local_styles' (in my_changes folder), this file doesn't load at all, so I get the webpage without any of my adjustments (looks a complete mess). On the second reload, the file loads as it should, and the webpage looks as it should.
However if I make changes directly in the styles.css file, I don't get this issue and the page loads as it should on the first refresh.
This problem happens in both Firefox & Internet explorer and is going to be a major headache for me, as if I need to change any code when my website is live, visitors are going to see the messed up page, and will have to refresh (if they stick around) to see the way the page should look.
Not sure about your file 'my_local_styles'… Assuming this is really …addons/my_changes/hooks/index/styles.post.tpl which would create a 'link' tag of type=stylesheet/css that uses this filename as a src attribute.
Once a 'hook' is compiled into the cached code, the contents of the hooked file are read dynamically. So you should only need to clear your cache when you first introduce your hooked file (like styles.post.tpl).
Your information doesn't make a lot of sense as described. It sounds like you have something done incorrectly.
I made the styles.post.tpl file first in my_changes/hooks/index folder containing the following code :
Then I created my_local_styles.css file (with my changes to styles.css & styles.base.css) and placed it in the /my_changes folder.
I thought this was the correct way?
Hope you mean that you edited the file referenced in the 'href' attribute of the 'link' tag. I.e. skins/
That's where your additional css properties should be defined.
Yes, i edited my_local_styles.css file which is in the my_changes folder. Every time i edit it i get this problem.
Any changes to that file should be detected by the browser and re-read if the cached version is older than the version on your site.
So I shouldn't have to do 2 refreshes of my browser in order to get the page to display properly?
No you “shouldn't”.