ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Integration with codeigniter
Posted by vaibhav.malushte on Oct-12-2010 15:44
Hi,
I am trying to integrate chartdir with codeigniter,but no luck.
Can you help me doing this ?

  Re: Integration with codeigniter
Posted by Peter Kwan on Oct-13-2010 01:32
Hi vaibhav,

I have never used codeigniter before and so are not sure how to help. May be you can described what error message or what difficulty you have encountered. I will try my best to help.

For testing, may be you can try to put the following code in your web page using codeigniter:

<img src="/ChartDirector/phpdemo/simplebar.php">

The above code should show a bar chart in your web page. (The "simplebar.php" is a sample code included in ChartDirector, assuming you have put it in "ChartDirector/phpdemo/simplebar.php".) Does it work? If it does not work and you see a broken image symbol (a red X), please kindly inform me what is the error message inside the red X. (See http://www.chartdir.com/forum/download_thread.php?site=chartdir&bn=chartdir_faq&thread=1117817200)

Regards
Peter Kwan

  Re: Integration with codeigniter
Posted by vaibhav.malushte on Oct-13-2010 08:12
Hi Peter,

I can not use <img src="/ChartDirector/phpdemo/simplebar.php"> since Codeigniter is an MVC framework.
I am getting bellow error msg
The Image "http://localhost/cihtml2pdf/dchart/testchart/" can not be displayed, because it contains error.

  Re: Integration with codeigniter
Posted by Peter Kwan on Oct-13-2010 17:41
Hi vaibhav,

The error you see generally means that the output of your script is not an image, so the browser cannot recognize it. To solve the problem, please let me know what is the output of your script. To see the output of a script, please use the following method:

(a) Type "http://localhost/cihtml2pdf/dchart/testchart/" in the browser address bar and press enter. Your browser will then access the URL and show you the result. Please use the IE browser, not the FireFox browser. It is because from experience, IE is better in showing the error message.

(b) If you still see the same error even with IE, or if you see a "red X" (broken image symbol), please create a HTML web page as follows (I suppose even in MVC framework, you can create HTML web page):

<html><body><a href="http://localhost/cihtml2pdf/dchart/testchart/">xxxx</a></body></html>

The above should show a web page containing a link with the text "xxxx". Please use the IE browser, right click on the "xxxx" link, and choose "Save Target As", and save the result as a file. Please include the file in your message, so I can analyse the output.

(c) If what is see is a blank page with nothing, please make sure your PHP is configured to display error message to the browser. (In your "php.ini" to set "display_errors=1" and "error_reporting=E_ALL" and restart your web server. If you are not sure where is your "php.ini", please use phpinfo to find out.)

Alternatively, you can look at the server error log and PHP error log to see if you can find the error message.


There is actually another approach to display the chart. I assume even in a MVC framework, you can use something like:

<img src="http://localhost/mycharts/abc.png">

The method is to create a chart as a file "abc.png" in the web directory "mycharts", and then use the <img> tag to reference the file. The entire code in PHP would be like:

<?php

.... create chart as usual ....

$c->makeChart("/path/to/web/root/mycharts/abc.png");
?>
<img src="http://localhost/mycharts/abc.png">

To use the above method, please make sure the directory "mycharts" is readable and writable by everyone. Also, because multiple users can access the web server at the same time, the filename (shown as "abc.png" above) should be unique for each user.


Hope this can help.

Regards
Peter Kwan

  Re: Integration with codeigniter
Posted by Dave Rowe on Oct-20-2010 09:11
The likely issue is that CodeIgniter is intercepting the request to process it as part of the
MVC framework.  Look for the '.htaccess' file, and add an exclusion to the ChartDirector files
or images.

Specifically, if you're using the Session based charts, you'd want an exclusion to the
'getchart.php' file.

  Re: Integration with codeigniter
Posted by vaibhav.malushte on Oct-20-2010 10:05
Hi Dev,
Thanks for your reply, Yes I think you are right, I have to exclude the chartdir in .htaccess. I cant wait let me try it........
Thanks once again
--Vaibhav

  Re: Integration with codeigniter
Posted by vaibhav.malushte on Oct-20-2010 10:06
Hi Dave,
Thanks for your reply, Yes I think you are right, I have to exclude the chartdir in .htaccess. I cant wait let me try it........
Thanks once again
--Vaibhav

  Re: Integration with codeigniter
Posted by ams on Feb-28-2012 12:40
vaibhav.malushte wrote:

Hi Dave,
Thanks for your reply, Yes I think you are right, I have to exclude the chartdir in .htaccess.
I cant wait let me try it........
Thanks once again
--Vaibhav

Please explain to me how to explode chartdir in .htacces...
thx

  Re: Integration with codeigniter
Posted by Peter Kwan on Feb-29-2012 00:33
Hi ams,

I have never used CodeIgniter before, and am not sure how CodeIgniter work. But based on the information on the Internet, it seems it is common for CodeIgniter installations to use an .htaccess file to rewrite the URLs, the intention probably is to forward URL requests to a CodeIgniter front end (eg. index.php). If it forwards the ChartDirector "getchart.php" or other charting script to the CodeIgniter front end, then the script would not be run, as it is processed by CodeIgniter which does not understand what it means. So you may need to modify your .htaccess file so as not to forward any charting script to CodeIgniter.

Regards
Peter Kwan