I'm a php noob, so bear with me...
I have two files here. Both are in the SAME directory
I have a config file:
config.php
<?php
date_default_timezone_set('America/Chicago');
define('APP_NAME',"/control");
define('HTTP_SERVER', 'http://localhost/');
define('SITE_NAME', 'http://localhost/');
define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'].APP_NAME);
?>
Then I have my index file:
index.php:
<!DOCTYPE html>
<html>
<head>
<?php
require ('config.php');
echo "<script type='text/javascript' src='".DOCUMENT_ROOT."/scripts/jquery.js"'></script>;
?>
.....THE REST OF MY HTML.....
But I get an error that "DOCUMENT_ROOT" is undefined. Why is it not pulling the value from the config.php file?
Change this line: (missing ending quote "
after </script>
and $
sign in front of DOCUMENT_ROOT
)
I tested the following on my server and the script did load, since I do have jquery.js
on mine.
echo "<script type='text/javascript' src='".DOCUMENT_ROOT."/scripts/jquery.js"'></script>;
to:
echo "<script type='text/javascript' src='$DOCUMENT_ROOT/scripts/jquery.js'></script>";
or:
echo "<script type='text/javascript' src='".DOCUMENT_ROOT."/scripts/jquery.js'></script>";