Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Please explain this CSS

Posted on 2016-09-05
5
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 59

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn how to dynamically set the form action using jQuery.

721 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