0

Suppose,

My css file is hosted in https://cdn.domain.com/css/style.css

Now my main site is https://www.domain.com Here I have a file in https://www.domain.com/scripts/source/link.php and it only contains the URI of the cdn site:

A: https://cdn.domain.com/

Now, in my index file I want to include that css file but using the link.php file like:

B: <link rel="stylesheet" href="<? include 'scripts/source/link.php'; ?>css/style.css" />

I know the previous code won't work like

C: <link rel="stylesheet" href="https://cdn.domain.com/css/style.css" />

So to achieve C, what should be in A or in B?

mahir
  • 69
  • 1
  • 1
  • 3
  • So you simply want to get the content of `https://www.domain.com/scripts/source/link.php`? Does http://stackoverflow.com/questions/1272228/how-do-i-load-a-php-file-into-a-variable answer your question? – Hirnhamster Sep 03 '14 at 13:50
  • If link.php doesn't contain anything else than `https://cdn.domain.com/` B should work. – idmean Sep 03 '14 at 13:59

1 Answers1

0

Solution:

In section B,

<?php
ob_start();
include "link.php";
$myvar = ob_get_contents();
ob_end_clean(); 
?>

<link rel="stylesheet" href="<? echo $myvar."style.css";?>" />
mahir
  • 69
  • 1
  • 1
  • 3