WAMP + PHP CSS Include wont update with new styles - php

I am stumped. I am using includes to import a style sheet. If I add a new style to the style sheet, generated pages will not display ANY of the new css. If I change an old css rule it WILL display the change. I thought it might be a cached file of some kind, but I have cleared the cache in all testing browsers and the problem persists.
At first I thought it was a WAMP issue, but the problem happens when I move it all live as well so now I am thinking I am doing something wrong with the includes....
<link rel="stylesheet" type="text/css" href="css/foundation.css">
<!-- Included Custom Overides -->
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
<!-- Supersizer CSS -->
And this is simply my include...
<?php require("Includes/HEADER.php"); ?>
Again, all the old CSS works fine, just any new additions to any of the style sheets will not display.
Thanks

<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
Maybe "Custon_Foundation_Overides.css" is a typo and you meant "Custom_Foundation_Overrides.css" or maybe you have to upload the file with correct letters capitalization.

Sounds like a browser cache issue. A simple way to fix this while maintaining good caching practices would be to pass the file make time as a query var to the file.
<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=<?php echo filemtime('css/foundation.css');?>">
This will generate a string like:
<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=1382564850">
This way when you update the file your browser will think its a new file and cache that, but as long as the file remains unchanged it will have the same name and maintain the browser cache.

Related

How to add or update css file in PHPFOX

I am trying to update existing css file but file is not updating, seems phpfox is generating cache. Then I tried to add another css file in template.html.php using following code..
<link rel="stylesheet" type="text/css" href="{param var='core.path'}theme/frontend/freedawn/style/default/css/cus_style.css" />
Html file gets updated but displays error "CSS file not found."
How to add/ update css/js file in PHPFox?
set version number at the end of file for getting a current version.
<link rel="stylesheet" type="text/css" href="style.css?1"/>
Have you tried to clear the cache in Maintenance / Cache Manager? If you modified controller and assets, such as CSS, most probably site will display old cached data and you won't be able to locate your changes.

CSS linking issues

i need some help with linking css to a php file.
This was completed by someone else and now i need to fix it. We have the main css that controls the look and feel of the entire site. The other CSS is just for the accordions page. that needs to be added in.
Current links include:
<!-- CSS Linking -->
<link href="css/template.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/accord.css" rel="stylesheet" type="text/css" />
If i remove the ?php echo from the second one it doesn't work, but if i leave it in there the css/template.css doesn't work.
Basically if both are in there are the same time they one doesn't work. Is there are way to resolve this?
The answer was that in the css of the second file there was an element of code that was overwriting the other file. The people had a body element. This has been removed and now both working together well.

Stylesheet not loading. URL duplicating on click

I have a big prob. We have a site that was working just fine but I was doing some fine tuning and somewhere along the line i messed things up. possibly in the .htaccess file.
My problem is that my css style sheet doesn't load nor do my images. ahh! They are all there.
I emptied my .htaccess file and deleted my robots.txt just to eliminate any blocking but that didn't fix it.
I validated my css file with The W3C CSS Validation Service and it said:
file not found: http://easybuildingproducts.ca/www.easybuildingproducts.ca/style.css
I feel like it has something to do with the fact that the URL is duplicated. It does that now when i click a link to any of my pages. It should be either or not both those links together. Is it possible a google cached my .htaccess or robots.txt when there was a potential redirect error? Is there a loop happening somewhere?
I was in the midst of making a custom 404 error page when this all went down.
www.easybuildingproducts.ca
Easy fix
<link href="www.easybuildingproducts.castyles/inside.css" rel="stylesheet" type="text/css">
That needs to be either one of the following
<link href="/styles/inside.css" rel="stylesheet" type="text/css">
or
<link href="http://www.easybuildingproducts.ca/styles/inside.css" rel="stylesheet" type="text/css">
I looked at the actual website source to find this example. there are quite a lot like it
Change the href to "/style.css" instead of writing your full domain out. Do the same kind of thing for all other resources that failed to load, too.
This will fix your problem, and it will also make your markup compatible if you decide to migrate to a different dsomain name in the future.
Your resources aren't being loaded (css, js, jquery, etc). Take a look at the screenshot taken from my Chrome Dev Tools > Sources tab:
This is because of your resources' file paths. It is definitely not a good idea to reference all of your resources with "www." in the file path.
Change
<link href="www.easybuildingproducts.castyle.css" rel="stylesheet" type="text/css" />
into
<link href="/castyle.css" rel="stylesheet" type="text/css" />

Facebook coding techniques

In an attempt to learn a little bit about Facebook and their coding techniques, I've viewed their source code. Here is one thing that I found:
<link rel="stylesheet" href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yN/r/JUrfX0ucXVq.css" />
<link rel="stylesheet" href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/gpxPzqCou0g.css" />
<link rel="stylesheet" href="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/OWwnO_yMqhK.css" />
My question is about how Facebook composes their directory structure & filenames. Obviously the css files weren't named for readability. Is there a reason behind these random filenames? Could someone provide any information about this? Thanks in advance.
The CSS files are given random filenames to prevent browsers from caching them.
When a browser caches a resource, it will download the file and keep it on the user's computer to prevent the same file from being downloaded multiple times. The problem is that if you change your CSS file and keep the filename the same, a browser will keep using the cached version of the file and won't download the updated version. By giving the CSS files unique names, browsers are forced to download them.
It's similar to doing this with your CSS files:
<link rel="stylesheet" href="style-v1.css" />
<link rel="stylesheet" href="style-v2.css" />
<link rel="stylesheet" href="style-v3.css" />
...

Using LESS css in Codeigniter

Is there a way to implement a LESS stylesheet in a codeigniter project without having to rely on sparks and Carabiner?
In the of my view in CI, I place the link to the LESS file, and the LESS.js file directly underneath, however when I view the site, CI doesn't recognize the .LESS file. I've tried using relative paths as well as hardcoding the the file directories directly, however nothing changes. Is there something I should try adding to my config file to load the LESS files properly?
My file structure for the CI project is as follows
application
controllers
views
system
js
less-1.2.2.min.js
plugins.js
css
style.css
style.less
As for my header, its based off of the html5 boilerplate, to save space I'll only include the relevant info.
application -> views -> layout.php
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet/less" type="text/css" media="screen" href="css/style.less">
<script src="js/less-1.2.2.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<!-- end CSS-->
Are you using mod_rewrite in httpd.conf? If so, you need to make sure that .less files are exempted.
RewriteCond %{REQUEST_URI} !(^alocalfarmCI/index\.php|\.png$|\.gif$|\.less$|\.js$|\.css$|/robots
One way to easily tell if this is your problem, type in a non-existent url within your site that ends in .less. If you see CI's error page, that means /index.php/ was inserted in the url.
If you're running with client-side (javascript) LESS, Codeigniter won't be involved in how LESS operates. Be sure that you've set the rel attribute appropriately when you're linking your LESS file in your views and that the less.js file is being loaded correctly.
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>

Categories