1
votes

I want to load awesome.css in my php file. I have a code like this in my php :

<link rel="stylesheet" type="text/css" href="<?php echo base_url('resources/web2/lib/css/awesome.css'); ?>"/>

But when I check the awesome.css file, there is a code which have link to another url :

@font-face{font-family:'FontAwesome';src:url('../resources/web2/lib/font/FontAwesome/fontawesome-webfontf77b.eot?v=3.2.1');src:url('../font/FontAwesome/fontawesome-webfontd41d.eot?#iefix&v=3.2.1') format('embedded-opentype'),url('../font/FontAwesome/fontawesome-webfontf77b.woff?v=3.2.1') format('woff'),url('../font/FontAwesome/fontawesome-webfontf77b.ttf?v=3.2.1') format('truetype'),url('../font/FontAwesome/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');font-weight:normal;font-style:normal;}

And when I load the page in web browser there is an error like this :

downloadable font: download failed (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: http://[::1]/yisc/resources/web2/lib/font/FontAwesome/fontawesome-webfontf77b.eot?v=3.2.1`

Please kindly help me to solved this issue, I really don't understand what happens here.

2

2 Answers

0
votes

Go to config.php and set the baseurl

$config['base_url'] = 'https://stackoverflow.com/';

Its better to take look at Codeigniter Documentation about Base Url


src:url('../font/ depends on the folders you are being. Check Path (computing) in wiki

0
votes

If this is what you actually have in your real code:

    <link rel="stylesheet" type="text/css" 
         href="<?phpechobase_url('resources/web2/lib/css/awesome.css'); ?>"/>`

Something is not quite OK.... the echo Part seems to form one word with base_url

You may consider putting a space between echo and base_url() instead:

    <link rel = "stylesheet" type="text/css" 
         href = "<?php echo base_url('resources/web2/lib/css/awesome.css'); ?>"/>