Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Please explain this CSS

Posted on 2016-09-05
5
Medium Priority
?
168 Views
Last Modified: 2016-09-06
Hello!

I've noticed this code when I viewed page source:

<link rel="stylesheet" href="css:style.css" />

Open in new window


It doesn't make sense to me, 'cos it's NOT a valid URL to an external CSS file. The developer said something like this:
"It is reserved for the file > css/custom.css"

They also said:

The missing URL for the custom.css depends on the php code to include the css file.
If there is no css file to load, the code is blank"
>> layouts/theme.config.php

$this->addFile('css', 'css:custom.css');

Open in new window


I found this line of PHP code in template.config.php

$this['asset']->addFile('css', 'css:custom.css');

Open in new window

0
Comment
Question by:Member_2_7970041
5 Comments
 
LVL 1

Expert Comment

by:Stefan Hoffmann
ID: 41785603
Well at least it does not look harmful. It looks odd to me, too, but I do not use Joomla. Maybe this is how they do things.

Anyway - in your place - I'd look at the result. You know, browse to the page and use "show source code" in the browser to check what the html says it does.
The browser (or http://www.telerik.com/fiddler) will probably be able to tell you also, if you produce a HTTP 404 this way. And although we might understand or not understand the PHP - as long as the page itself runs...
1
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41785619
It looks odd to me, too, but I do not use Joomla. Maybe this is how they do things.
Except the author said
I've noticed this code when I viewed page source:
So this is after Joomla has finished in the process - this is the final output sent to the browser - and it is not valid.
One outside chance is there is some javascript that runs and modifies that link after page load but not sure I see the advantage.
1
 
LVL 1

Expert Comment

by:Stefan Hoffmann
ID: 41785740
I have overlooked that. Sorry. Julian is right.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 41785878
I'm almost certain this is an error.  This:
addFile('css', 'css:custom.css');

...should probably be written more like this (note directory separator):
addFile('css', 'css/custom.css');

You may be able to use Chrome Dev Tools to see what the browser is doing with the <link> tag.  My guess is that it would be getting a 404.
0
 

Author Comment

by:Member_2_7970041
ID: 41786684
Thanks all of you for your replies!

At least, it's not harmful for the site (if I understood this part right). It's strange that serious commercial developers from Germany can't understand the wrong code. And when I brought it to their attention, they gave me that explanation, written above. Maybe they know something we don't.
Anyhow, if I have nothing to worry about, then I guess I could close this question.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question