Solved

Please explain this CSS

Posted on 2016-09-05
5
70 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 51

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 108

Accepted Solution

by:
Ray Paseur earned 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to count occurrences of each item in an array.

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now