Hi, I'm having some trouble getting the contents of an array to display...any help would be appreciated. I've tried looking at the docs on php.net but haven't been able to solve this one.
The array being display is for an FAQ help file. The help file is being INCLUDEd, and then I'm trying to run a foreach over the array to get any created FAQ SUBJECT and REPONSES to display.
First the help file where the array is created:
<?
$VAR['MODULEHELP']=array();
$VAR['MODULEHELP']['faq']['default'][]=array(
"SUBJECT"=>"What are F.A.Q.?",
"RESPONSE"=>"F.A.Q. is an internet acronym for Frequently Asked Questions."
);
$VAR['MODULEHELP']['faq']['default'][]=array(
"SUBJECT"=>"Should I place a F.A.Q. page on my site?",
"RESPONSE"=>"Having a F.A.Q. page can be extremely beneficial to your website. In addition to providing a ".
"simple method of answering your customers questions, FAQ pages are often the top incoming pages on a website."
);
// print "this is the help file."; // this is a test line
?>
Now this is the file where I'm trying to include the help file (above) and run a foreach on the array to get the SUBJECT and RESPONSES to display properly. Currently the code as shown here displays the "HELP" heading (HTML) and then the word "faq" where I'm printing the array. Not sure where that's coming from, but it's not right!!
<?
?>
<html>
<head>
<title>Help</title>
<link rel="stylesheet" href="styles/default.css" type="text/css" >
<style>
body {margin:5px;padding:0px}
</style>
</head>
<body>
<h3>Help</h3>
<?
// check to see if admin, if not display 404, if yes, continue
if(csUtil::isContentAdmin()==false){
print "ERROR 404 -- Page Not Found";
} else {
// if admin, check to see if help file exists for selected module, if yes include file and run loop, if no, display 404
if(file_exists(CSF_DIR."/modules/".$_GET['hm']."/help.php")) {
include(CSF_DIR."/modules/".$_GET['hm']."/help.php");
foreach($VAR['MODULEHELP'] as $subject=>$response)
{
print "$subject<br>";
//print "$response";
}
} else {
// print 404 error if no help file found
print "ERROR 404 -- Help File Not Found";
}
}
?>
</body>
</html>
Thanks in advance for any help!