Edward G-Jones
Edward G-Jones

Reputation: 585

Check for whether or not a hyperlink is a file

So I need to be able to tell whether or not a link leads to a file. Now I've been able to manually hardcode some css for file links on pages however there is also a site wide search which results don't produce any way to differentiate between link types.

Is there some sort of php library function I can call that will distinguish the difference? Or is there some sort of clever work around that I can use?

Upvotes: 0

Views: 53

Answers (1)

Harri
Harri

Reputation: 2732

No, not a reliable way. "File" and "page" are a same thing, both are just files. Another one happens to be HTML (or eventually will spit out HTML) and other one happens to be something else.

What you could do is create css selectors like

a[href$=".pdf"] {color: red;}

which will make all a elements whose href attribute value ends with .pdf to be colored red.

Upvotes: 2

Related Questions