Hello all
I have a strange problem with font-face while using two domain names. One CMSM 1.11.7 “Genovesa” is installed. Two different domain names, one xxx.ch and one xxx.net point to the same CMSMS install. No specific domain name has been declared neither in config.php nor in htaccess.txt.
The fonts are within the same CMSMS folder and are linked from the internal stylesheet like this:
src: url('[[root_url]]/fonts/ag.eot')
But while on the .ch domain the pages appear well, with the fonts, the fonts do NOT appear with the .net domain. Checking the .net stylesheet for the website loaded in the browser, in fact the stylesheet URLs (also those of images) use the .ch domain.
Now the über-strange thing is, checking system informations in CMSMS, the root URL is correct, .ch after logging in via .ch login and .net after looging in via .net.
So why does [[root_url]] create always the .ch domain if its not specified anywhere?
Anyone having the same problem?
[SOLVED] font-face on one domain name failing
[SOLVED] font-face on one domain name failing
Last edited by thomahawk on Mon Nov 03, 2014 6:49 pm, edited 1 time in total.
Re: font-face on one domain name failing
It has to do with with the way CMSMS combines and caches the stylesheets. That is also why you cannot pass variables from the templates to the stylesheets.
You may get away with some smarty conditionals on the template and use two sets of stylesheets depending on which domain is being requested. Something like (not tested):
I'm not sure it will work, or if it is effective, but might be worth a try...
Remember to clear CMSMS cache after changes.
Otherwise you might have to embed the font on the main template instead.
You may get away with some smarty conditionals on the template and use two sets of stylesheets depending on which domain is being requested. Something like (not tested):
Code: Select all
{nocache}
{if $smarty.server.SERVER_NAME == xxx.ch}
{cms_stylesheet name='css4xxx.ch'}
{elseif $smarty.server.SERVER_NAME == xxx.net}
{cms_stylesheet name='css4xxx.net'}
{/if}
{/nocache}
Remember to clear CMSMS cache after changes.
Otherwise you might have to embed the font on the main template instead.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: font-face on one domain name failing
Thank you, Jo Morg. Yes, I cleared the cache several times without success. And strange is, I did the same thing before with other websites: two domain names, one CMSMS installation, and the fonts worked. I don't know what changed since then with CMSMS, but of course I am not happy about it.
Yes indeed, I found the easiest way to solve this is by making the stylesheet a document on the server and include it in the template like this
[literal]
<link href="styles.css" rel="stylesheet" type="text/css" />
[/literal]
But in my opinion CMSMS should (still) have so much flexibility for this to work instantly.
Yes indeed, I found the easiest way to solve this is by making the stylesheet a document on the server and include it in the template like this
[literal]
<link href="styles.css" rel="stylesheet" type="text/css" />
[/literal]
But in my opinion CMSMS should (still) have so much flexibility for this to work instantly.
- paulbaker
- Dev Team Member
- Posts: 1465
- Joined: Sat Apr 18, 2009 10:09 pm
- Location: Maidenhead, UK
- Contact:
Re: font-face on one domain name failing
You shouldn't need to mention the root URL in the stylesheet at all (I don't).
Instead of:
Try:
Instead of:
Code: Select all
src: url('[[root_url]]/fonts/ag.eot')
Code: Select all
src: url('/fonts/ag.eot')
Re: font-face on one domain name failing
Thanks, Paul. Yes, I think the same, it should not be necessary. Previously I always made CSS URLs like url('/path/file') until this stopped working about 2 years ago. The solution was either include the full http://www.domain.com/path URL or [[root_url]]
I don't know how you do it to have it working without [[root_url]], but I just checked with a recent CMSMS 1.11.11, freshly installed and it is still so that without [[root_url]], links dont work from the internal stylesheet.
I don't know how you do it to have it working without [[root_url]], but I just checked with a recent CMSMS 1.11.11, freshly installed and it is still so that without [[root_url]], links dont work from the internal stylesheet.
Re: font-face on one domain name failing
On the other hand what might work is:
edit: Had one period too many....
Code: Select all
src: url('../fonts/ag.eot')
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
- paulbaker
- Dev Team Member
- Posts: 1465
- Joined: Sat Apr 18, 2009 10:09 pm
- Location: Maidenhead, UK
- Contact:
Re: font-face on one domain name failing
Hmm, I don't either.thomahawk wrote:I don't know how you do it to have it working without [[root_url]],
Example - I just grabbed this from a stylesheet within CMSMS from a working site (1.11.11):
Code: Select all
background-image: url(/uploads/images/SiteStructure/SeaAndSky.png);
Re: font-face on one domain name failing
Okay, I have it fixed. I had to do this in order to have the internal stylesheet working for both domains
url('../../../fonts/fontx.eot');
Before finding this, I made the font-face styles into an external css file. It worked too.. I thought... until today I found all pages except the frontpage, missing the fonts.
Then I thought maybe looking at the CSS in the browser via Firefox plugin Web Developer may help figure this out. I saw the location of the css is like
http://www.domain.ch/tmp/cache/stylesheet_combined_6534567fff576665hhg3bb.css so I came up with ../../../ before the font path and it worked.
Why don't you have the same problem? I don't know. You are just lucky. I don't think its a hosting server thing, the path /tmp/cache/ is certainly typical for CMSMS.
url('../../../fonts/fontx.eot');
Before finding this, I made the font-face styles into an external css file. It worked too.. I thought... until today I found all pages except the frontpage, missing the fonts.
Then I thought maybe looking at the CSS in the browser via Firefox plugin Web Developer may help figure this out. I saw the location of the css is like
http://www.domain.ch/tmp/cache/stylesheet_combined_6534567fff576665hhg3bb.css so I came up with ../../../ before the font path and it worked.
Why don't you have the same problem? I don't know. You are just lucky. I don't think its a hosting server thing, the path /tmp/cache/ is certainly typical for CMSMS.