Thank you for the help! I think I have some conceptual confusion about the idea of "page." I am very new to PHP and very very new to HTLM. My background is in C.
I removed the print statement prior to the header setting. That helped!
The reason I have "require MM_Main.php" in index.php (line 12) is because if I do not, I cannot output the text data I want to see using the "show_symbtbl($SymbTbl);" function call (line 13). I get a "Fatal error: Call to undefined function show_symbtbl() in C:\AppServ\www\index.php..." But if I comment out the "require MM_Main.php" in index.php, I do not get the notices. But then also no text.
My goal at this point is to output various data and debug print statements calculated in MM_Main.php (and other php files containing functions required by MM_Main.php). THEN once the text is output to my webpage, to display my graphics on the same webpage. I see webpages with text and images and I am trying to do the same.
Why, even with the notices, are my four images even displaying when image_id is not set? How do I get text and my images to output to the same webpage?
Thank you for sharing your experience and time!
My index.php file:
Code: Select all
<!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>My PHP Catastrophe</title>
</head>
<body>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require("MM_Main.php"); // cut this & next line, no warnings, graphics ok. But fatal error error if try to output text data
show_symbtbl($SymbTbl); // function to output text data, from array. function needs MM_Main.php
?>
<p>
<img src="MM_Main.php?image_id=1" border="0">
<img src="MM_Main.php?image_id=2" border="0">
<img src="MM_Main.php?image_id=3" border="0">
<img src="MM_Main.php?image_id=4" border="0">
</p>
</body>
</html>
code from MM_Main.php, my main program for file handling, reading, data calculations, image building. The image_id code is at the end. The four images are in the image resources: $CrwdMvImg1...$CrwdMvImg4
Code: Select all
<?php
# This is the main module for all Market Mirror PHP code.
ini_set('display_errors', 1);
error_reporting(E_ALL);
# All required PHP files for Market Mirror
require("MM_Define.php");
require("MM_Matrix.php");
require("MM_Data.php");
require("MM_Calc.php");
require("MM_Display.php");
//require("MM_Output.php");
$Symbol = "USDJPY";
$LeadTF = "10MIN";
$SymbLTF = $Symbol."_".$LeadTF;
$SymbTbl = array(); $SlowAry = array(); $MedmAry = array(); $FastAry = array();
load_symbtbl($SymbTbl);
$SlowMaxBar = get_data($SlowAry, "SLOW", $Symbol, $SymbTbl, $SymbLTF);
$MedmMaxBar = get_data($MedmAry, "MEDM", $Symbol, $SymbTbl, $SymbLTF);
$FastMaxBar = get_data($FastAry, "FAST", $Symbol, $SymbTbl, $SymbLTF);
$AllMaxBar = max($SlowMaxBar, $MedmMaxBar, $FastMaxBar);
// Cycle through the rows of each array for all calcs
for ($Row = BAR1; $Row <= $AllMaxBar; $Row++) {
// Calc slow array values
if ($Row <= $SlowMaxBar) {
calc_TR($SlowAry, $Row, $Prec);
calc_RR($SlowAry, $Row, $Prec);
calc_CrwdMv($SlowAry, $Row, $Prec);
calc_CMPlot($SlowAry, $Row);
}
}
//Using a given FAST bar number, get the two parents barnumber
$FastBar = 2000;
get_context($FastBar, $SlowAry, $MedmAry, $FastAry, $SlowMaxBar, $MedmMaxBar, $FastMaxBar,
$SymbLTF, $SymbTbl, $MedmParentBar, $SlowParentBar);
$CrwdMvImg1 = display_CrwdMv($SlowAry, $MedmAry, $FastAry, $SlowParentBar, $MedmParentBar, $FastBar);
$FastBar = 2200;
get_context($FastBar, $SlowAry, $MedmAry, $FastAry, $SlowMaxBar, $MedmMaxBar, $FastMaxBar,
$SymbLTF, $SymbTbl, $MedmParentBar, $SlowParentBar);
$CrwdMvImg2 = display_CrwdMv($SlowAry, $MedmAry, $FastAry, $SlowParentBar, $MedmParentBar, $FastBar);
$FastBar = 2400;
get_context($FastBar, $SlowAry, $MedmAry, $FastAry, $SlowMaxBar, $MedmMaxBar, $FastMaxBar,
$SymbLTF, $SymbTbl, $MedmParentBar, $SlowParentBar);
$CrwdMvImg3 = display_CrwdMv($SlowAry, $MedmAry, $FastAry, $SlowParentBar, $MedmParentBar, $FastBar);
$FastBar = 2600;
get_context($FastBar, $SlowAry, $MedmAry, $FastAry, $SlowMaxBar, $MedmMaxBar, $FastMaxBar,
$SymbLTF, $SymbTbl, $MedmParentBar, $SlowParentBar);
$CrwdMvImg4 = display_CrwdMv($SlowAry, $MedmAry, $FastAry, $SlowParentBar, $MedmParentBar, $FastBar);
header("Content-Type: image/png");
if ($_GET["image_id"] == 1) imagepng($CrwdMvImg1);
else if ($_GET["image_id"] == 2) imagepng($CrwdMvImg2);
else if ($_GET["image_id"] == 3) imagepng($CrwdMvImg3);
else if ($_GET["image_id"] == 4) imagepng($CrwdMvImg4);
?>