File Structure:
/news.php
/core/init.inc.php
/core/inc/bbc_news_reader.inc.php
When I load news.php I get the following errors:
Warning: include(./inc/bbc_news_reader.inc.php) [function.include]: failed to open stream: No such file or directory in /home/content/74/********/html/core/init.inc.php on line 5
Warning: include() [function.include]: Failed opening './inc/bbc_news_reader.inc.php' for inclusion (include_path='.:/usr/local/php5_3/lib/php') in /home/content/74/********/html/core/init.inc.php on line 5
Fatal error: Call to undefined function fetch_news() in /home/content/74/********/html/news.php on line 18
Here is my Code:
news.php
<?php
include('core/init.inc.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
fetch_news();
?>
</body>
</html>
init.inc.php
<?php
$path = dirname(_FILE_);
include("{$path}/inc/bbc_news_reader.inc.php");
?>
bbc_news_reader.inc.php
<?php // http://feeds.bbci.co.uk/news/rss.xml function fetch_news(){ $data = file_get_contents('http://feeds.bbci.co.uk/news/rss.xml'); echo $data; } ?>What am I doing wrong??