Can't get the include path correct

Links for php scripts

Moderators: macek, egami, gesf

jellis00
New php-forum User
New php-forum User
Posts: 20
Joined: Fri Nov 11, 2011 12:47 pm

Can't get the include path correct

Postby jellis00 » Thu Nov 17, 2011 1:38 am

I have a .php page installed on my website at http://www.lodestarassoc.com/iChip/iChip.php . I have included the scripts shown below in the code on this page. I am trying to include the use of a libchart.php file that is located in a sub-directory that is also located in the iChip folder, but from the error messages I am getting on the server side, it appears I don't have the path to this libchart.php file correct in the syntax. Therfore it isn't creating the line chart that the libchart.php file is suppose to create on the web page.

Can anyone look at the error messages shown on my sebsite page and this script code and tell me what I am doing wrong?

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 content="text/html" charset="utf-8" http-equiv="refresh" content="150" />
<title>iChip.php</title></head>

<body>
<?php
include('/include-1.txt');
include('/include-2.txt');
include('/include-3.txt');
include('/include-4.txt');
$myFile = "include-2.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo "<br />";
echo "<br />";
$temperature_array[0] = "50";
$temperature_array[1] = "55";
$temperature_array[2] = "60";
$temperature_array[3] = "65";
echo "TemperaturePoint0 - " . $temperature_array[0] . "<br />";
echo "TemperaturePoint1 - " . $temperature_array[1] . "<br />";
echo "TemperaturePoint2 - " . $temperature_array[2] . "<br />";
echo "TemperaturePoint3 - " . $temperature_array[3] . "<br />";
echo "Current temperature is " . $theData . " degrees F";
?>
<?php
include ('/libchart/classes/libchart.php');

   $chart = new LineChart(500, 250);

   $serie1 = new XYDataSet();
   $serie1->addPoint(new Point("06-01", 273));
   $serie1->addPoint(new Point("06-02", 421));
   $serie1->addPoint(new Point("06-03", 642));
   $serie1->addPoint(new Point("06-04", 799));
   $serie1->addPoint(new Point("06-05", 1009));
   $serie1->addPoint(new Point("06-06", 1106));
   
   $serie2 = new XYDataSet();
   $serie2->addPoint(new Point("06-01", 280));
   $serie2->addPoint(new Point("06-02", 300));
   $serie2->addPoint(new Point("06-03", 212));
   $serie2->addPoint(new Point("06-04", 542));
   $serie2->addPoint(new Point("06-05", 600));
   $serie2->addPoint(new Point("06-06", 850));
   
   $dataSet = new XYSeriesDataSet();
   $dataSet->addSerie("Product 1", $serie1);
   $dataSet->addSerie("Product 2", $serie2);
   $chart->setDataSet($dataSet);
   
   $chart->setTitle("Sales for 2006");
   $chart->render("generated/demo4.png");

?>
</body>

</html>
 :help:

lonelygirl86
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 09, 2012 12:05 am

Re: Can't get the include path correct

Postby lonelygirl86 » Mon Jan 09, 2012 6:02 pm

remove the / in the include function. make it just like this

Code: Select all

include_once('libchart/classes/libchaart.php');


something like that. And, please check your directory structure. check where did you put your file.


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest