N
N
Name Imechko2015-11-07 13:29:18
PHP
Name Imechko, 2015-11-07 13:29:18

How to insert a dynamic link to css into the link tag, depending on which URL we are on?

How to insert a dynamic link to css into a tag, depending on which URL we are on?
Let's say there is a code
<link rel="stylesheet" href="ССЫЛКА">. How can I insert dynamics instead of a LINK, which will select the link address itself based on what URL we are on?
All code

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <script src="/core/js/main.js"></script>
  <link rel="stylesheet" href="/core/css/main_admin.css">
  <link rel="stylesheet" href="/core/css/fonts.css">
  <link rel="shortcut icon" type="image/x-icon" href="/core/img/favicon.gif">
  <title>Панель администратора WebMagisters</title>
</head>
<body>
I put it in a separate file and connect it to the rest of the files.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2015-11-07
@Screpka

Why not put all links in the head and make the content dynamic?

S
Sergey Sergey, 2015-11-07
@hahenty

You can make a text config file in which to describe the relationship of links to css files and url.
A handler with a brute-force check.
And if you want something strange, you can precompile the config file into a PHP script, where a tree will be built from associative arrays, according to which the search will be organized by "/" url.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question