JPGraph the proper path to call in php

Problems with the Windows version of XAMPP, questions, comments, and anything related.

JPGraph the proper path to call in php

Postby micksheff » 06. November 2004 14:33

I need to set to correct path for jpgrath to work, Iam using windows xp. The jpgraph folder is located in

xampp/apachefriends/xampp-htdocs/jpgraph-1.17-beta

Can someone tell me how i should edit the php code below to call the correct path.

<?
include ("$jpgraph_path/jpgraph.php");
include ("$jpgraph_path/jpgraph_line.php");
micksheff
 
Posts: 9
Joined: 03. November 2004 04:00
Location: England

Postby JonathanS » 06. November 2004 17:32

Is that the only code? There's no config file?
Nothing above that to define what $jpgraph_path is?

Try replacing $jpgraph_path with the path from
the root (htdocs) to it is; that'd be /jpgraph-1.17-beta/ it sounds like.

Try it and see :)
JonathanS
 
Posts: 31
Joined: 31. October 2004 02:36

Postby micksheff » 06. November 2004 17:46

JonathanS wrote:Is that the only code? There's no config file?
Nothing above that to define what $jpgraph_path is?

Try replacing $jpgraph_path with the path from
the root (htdocs) to it is; that'd be /jpgraph-1.17-beta/ it sounds like.

Try it and see :)


No theres plenty more coding i just need the correct path, so that I can use the graphs, like on my host server it would be /home/me/public_html/weightlifting/jpgraph-1.17-beta/

Im trying to install this script http://sourceforge.net/projects/wtfo/

This is full code
<?php
include ("./config.inc.php");
include ("$jpgraph_path/jpgraph.php");
include ("$jpgraph_path/jpgraph_line.php");

$query = 'SELECT weight, record FROM weight WHERE user = '.$_SESSION[userid].' ORDER BY record';
$result = mysql_query($query);
$i=0;
while ($row = mysql_fetch_array ($result)) {
$ydata[$i] = $row['weight'];
$xdata[$i] = $row['record'];
$i++;
}

/* SetScale($axtype,$ymin=1,$ymax=1,$xmin=1,$xmax=1) */

// Create the graph. These two calls are always required
$graph = new Graph(800,600,"auto");
$graph->SetScale("linlin");
$graph->img->SetMargin(60,140,60,60);
//$graph->xaxis->SetFont(FONT1,FS_BOLD);
$graph->title->Set("Weight vs Time");
/* $graph->SetScale(1,135,150,1,50); */

// Label every 2:nd tick mark
//$graph->xaxis->SetTickLabels(1);
//$graph->xaxis->SetTextTicks(5,0);

// Setup X-axis labels
$graph->xaxis->SetTickLabels($xdata);
$graph->xgrid->Show(true,false);
$graph->xaxis->SetLabelAngle(90);

// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetLegend("Weight(lbs)");
$lineplot->SetColor("blue");


// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph
$graph->Stroke();
?>
micksheff
 
Posts: 9
Joined: 03. November 2004 04:00
Location: England

Postby JonathanS » 06. November 2004 17:57

Open the config.inc.php file and try to find the variable $jpgraph_path

Find it and edit it to like http://localhost/jpgraph-1.17-beta/
Or maybe /jpgraph-1.17-beta/ ~ depends..

Does it want the full path or the web server path?
JonathanS
 
Posts: 31
Joined: 31. October 2004 02:36

Postby micksheff » 06. November 2004 18:04

JonathanS wrote:Open the config.inc.php file and try to find the variable $jpgraph_path

Find it and edit it to like http://localhost/jpgraph-1.17-beta/
Or maybe /jpgraph-1.17-beta/ ~ depends..

Does it want the full path or the web server path?


Heres the config Im still not sure exactly what to type in
//Path for jpgraph
$jpgraph_path = "/home/web/jpgraph-latest/src";
-------------------------------------------------------------------------------------
<?php
if (array_pop(explode("/",$_SERVER[PHP_SELF] )) == 'config.inc.php') {
die('Are you kidding?');
}

//Start Session
session_name("wtfo");
session_start();

//init vars

//DB
$db_server = "localhost";
$db_user = "root";
$db_password = "";
$db_database = "workout";

//For weight change
$down_icon = 'images/thumb_down.gif';
$same_icon = 'images/cool.gif';
$up_icon = 'images/thumb_up.gif';
$comment_icon = 'images/notebook.gif';

//DB Values for icons
$status_icons[0] = $down_icon;
$status_icons[1] = $same_icon;
$status_icons[2] = $up_icon;

//Site Specific
//This is used in the registration email
//No trailing slash
$sitename = '';

//Path for jpgraph
$jpgraph_path = "/home/web/jpgraph-latest/src";

// Setup DB
$link = mysql_connect($db_server, $db_user, $db_password) or die ("Could not connect");
mysql_select_db ($db_database) or die ("Could not select database");

?>
---------------------------------------------------------------------------------------
micksheff
 
Posts: 9
Joined: 03. November 2004 04:00
Location: England

Postby JonathanS » 06. November 2004 18:28

Try changing it to...

/path/to/your/xampp/htdocs/jpgraph-folder-name/src

Change the 'path to your xampp htdocs' of course;
Also change the 'folder name' part to your own.

If that doesn't work, try simply: /jpgraph-folder-name/src
Again, replacing 'folder name' part to your own.
JonathanS
 
Posts: 31
Joined: 31. October 2004 02:36

Postby micksheff » 06. November 2004 19:04

JonathanS
Thanks very much, got it to work.

//Path for jpgraph
$jpgraph_path = "jpgraph-1.17-beta/src";
micksheff
 
Posts: 9
Joined: 03. November 2004 04:00
Location: England

Postby JonathanS » 06. November 2004 20:32

:) Glad to see it worked
JonathanS
 
Posts: 31
Joined: 31. October 2004 02:36


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 107 guests