PHP

I am using XAMPP and learning from online tutorials, i have only vedio not the source code

this is my directory structor

source file-classes(folder):core.php

source file-emails(folder)

source file-inc(folder):autoload.php,config.php, index.php

source file-pages(folder): index.php

source file-template(folder):_header.php;

the code for config.php

<<?php

if(!isset($_SESSION)){
session_start();
}

//site domain name with http

defined(“SITE_URL”)

|| define(“SITE_URL”, “http://”.$_SERVER[‘SERVER_NAME’]);

//directory separator
defined(“DS”)|| define(“DS”, DIRECTORY_SEPARATOR);

// root pat

defined(“ROOT_PATH”)|| define(“ROOT_PATH”, realpath(dirname(FILE).DS."…".DS));

//classes folder

defined(“CLASSES_DIR”)|| define(“CLASSES_DIR”, “classes”);

//defined pages

defined(“PAGES_DIR”)|| define(“PAGES_DIR”, “pages”);

//module folder

defined(“MOD_DIR”)|| define(“MOD_DIR”, “mod”);

//inc folder

defined(“INC_DIR”)|| define(“INC_DIR”, “inc”);

//template folder

defined(“TEMPLATE_DIR”)|| define(“TEMPLATE_DIR”, “template”);
//email path
defined(“EMAILS_PATH”)|| define(“EMAILS_PATH”, ROOT_PATH.DS.“emails”);
//catalogue images path
defined(“CATALOGUE_PATH”)|| define(“CATALOGUE_PATH”, ROOT_PATH.DS.“catalogue”);
//add all above directories to include path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(ROOT_PATH.DS.CLASSES_DIR),
realpath(ROOT_PATH.DS.PAGES_DIR),
realpath(ROOT_PATH.DS.MOD_DIR),
realpath(ROOT_PATH.DS.INC_DIR),
realpath(ROOT_PATH.DS.TEMPLATE_DIR),

    get_include_path()

)));
?>
and the code for autoload.php is

<?php require_once ('config.php'); function __autoload ($class_name){ $class = explode ("_",$class_name); $path=implode ("/",$class).".php"; require_once ($path); } ?>

code for the index.php in the inc folder is

<?php require_once('autoload.php'); $core = new Core(); $core->run(); ?>

code for the pages(folder) index.php is

<?php require_once '_header.php'; ?>

when i am running this last index file it show the error,
and the error is

Warning: require_once(_header.php): failed to open stream: No such file or directory in C:\xampp\htdocs\sebastine\pages\index.php on line 5

Fatal error: require_once(): Failed opening required ‘_header.php’ (include_path=’.;C:\xampp\php\PEAR’) in C:\xampp\htdocs\sebastine\pages\index.php on line 5

please some body help me what i am doing wrong my guess is that i am doing some thing wrong in the config files but i can not find it

Thanks

This : require_once ‘_header.php’;

Should be: require_once(’_header.php’);

or
require_once(‘header.php’); (Depends on how your system is set up)

Hope that helps.

Sponsor our Newsletter | Privacy Policy | Terms of Service