Absolute url in CSS images url
Permalink
Hi, I am wriframing a custom theme directly in CSS and I am using placehold.it for images placeholder also in CSS backgrounds.
The problem is that I am getting the addresshttp://localtest:8888/themes/custom-theme/http://placehold.it/36x36... in my CSS.
Is there a way to avoid it at least in development env?
The problem is that I am getting the addresshttp://localtest:8888/themes/custom-theme/http://placehold.it/36x36... in my CSS.
Is there a way to avoid it at least in development env?
Hi and thank you for your reply.
Yep, I am trying to get it from placehold.it but that should be fine, it is just like it is meant to be and it works elsewhere.
The issue is that in my CSS file I have the following declaration:
But it is changed (by Concrete5?) to this:
Yep, I am trying to get it from placehold.it but that should be fine, it is just like it is meant to be and it works elsewhere.
The issue is that in my CSS file I have the following declaration:
#support-request h2 { background: transparent url("http://placehold.it/36x36") no-repeat 0 0;}
But it is changed (by Concrete5?) to this:
#support-request h2 { background: transparent url("http://localtest:8888/themes/custom-theme/http://placehold.it/36x36http") no-repeat 0 0;}
Hi carusog
Try to remove the double quotes(""). I think it will work.
Citytech
Try to remove the double quotes(""). I think it will work.
Citytech
I thought about it, but no, same issue. :/
It also adds back double quotes.
Could be some settings in the C5 installation?
It also adds back double quotes.
Could be some settings in the C5 installation?
Try not using the getStyleSheet function.
Like that:
<link rel="stylesheet" href="<?php echo $this->getStyleSheet('layout.css')?>" type="text/css" />
In this code I would replace:
<?php echo $this->getStyleSheet('layout.css')?>
with:
<?php echo $this->getThemePath(); ?>/css/style.css
Try that, although I'm not sure if this will work.
Like that:
<link rel="stylesheet" href="<?php echo $this->getStyleSheet('layout.css')?>" type="text/css" />
In this code I would replace:
<?php echo $this->getStyleSheet('layout.css')?>
with:
<?php echo $this->getThemePath(); ?>/css/style.css
Try that, although I'm not sure if this will work.
And the winner is: "MoonGrab!" :D
It works. I didn't expect the getStyelSheet() function would process the file but, yep, that was the problem.
But, now, the question is "why to process the file to add absolute links to assets"?
It works. I didn't expect the getStyelSheet() function would process the file but, yep, that was the problem.
But, now, the question is "why to process the file to add absolute links to assets"?
Many reasons, but the bottom line is - because it works perfectly.
Rewrites and s#$t.
Don't think about it, just accept it. It's better this way xD
PS: might wanna my answer as a "best answer" so people can find it easily.
Rewrites and s#$t.
Don't think about it, just accept it. It's better this way xD
PS: might wanna my answer as a "best answer" so people can find it easily.
I remember correctly putting the url in single quotes prevents getStyleSheet() from rewriting it
But my memory is fuzzy so I might be wrong.
getStyleSheet is designed to rewrite the urls to point within the theme directory from a relative file and also it is used to fill in the customisations available at Themes->Customize. If you don't use getStyleSheet() those won't apply. So as long as you don't need either of those features you'll be fine.
edit: css braindead
body { background-image: url('http://thisshouldnotberewritten'); }
But my memory is fuzzy so I might be wrong.
getStyleSheet is designed to rewrite the urls to point within the theme directory from a relative file and also it is used to fill in the customisations available at Themes->Customize. If you don't use getStyleSheet() those won't apply. So as long as you don't need either of those features you'll be fine.
edit: css braindead
Citytech