Hi everyone, I'm trying to create a include line using a variable and path
- this is to display my header
something like
<?php
$site = domain.com
include $site "." "/heading.php";
?>
so it would end up being
<?php include 'http://domain.com/heading.php'; ?>
thanks for any help any1 can give
include variable & text
Moderator: General Moderators
Re: include variable & text
Assuming you're trying to access content from the same site, try this instead:
However if you have to do this many times with many sites, consider a function:
I'm not entirely sure what you're trying to accomplish though, please clarify.
Code: Select all
include('./directory/heading.php');
Code: Select all
function full_url($domain, $path, $filename) {
$url = $domain.$path.$filename;
return $url;
}
$full_url = function($domain, $path,$filename);
include($full_url);