Welcome Guest, Not a member yet? Register   Sign In
Handling external application with Codeigniter
#1

[eluser]Solarpitch[/eluser]
Hi,

I'm trying to use an external php charting application (http://www.maani.us/xml_charts/index.php?menu=Tutorial) with the framework. This is a small app I've used many times but not with Codeigniter.

The app requires these files. Once there uploaded to the root directory on the server you can access the chart by going to...

www.mysite.com/sample.html

Code:
* charts.swf
* charts_library -> directory
* AC_RunActiveContent.js
* sample.html
* sample.xml

I'm not sure how this structure would work with Codeigniter. Should the files be contained in the root directory as normal ie. outside of the system folder?

I have it like this at the moment and I created a controller charts.php. This then calls a view that has the js which points to www.mysite.com/AC_RunActiveContent.js

I just need to know if this is the correct way of using an external app as the problem I seem to be having is that it cant find the charts.swf file for some reason... but can if I run it outside of the framework...

www.mysite.com/sample.html
#2

[eluser]Phil Sturgeon[/eluser]
I assume the problem is you are using the default .htaccess with index.php removed and are recieving the CI 404 error when you attempt to view the chart?

Possibly not though, as you haven't really described the problem.

Either way, your files can be anywhere in the webroot, it doesn't matter. Your system folder should not be in the web root though, for security reasons.
#3

[eluser]Solarpitch[/eluser]
I done a bot of searching and found this blog of a guy that shows a step by step process of integrating PHP/SWF Charts with Codeigniter.

http://booleandreams.wordpress.com/2007/...r-maanius/

I'm not sure if there is an easier way to achieve this than what the blog has described as I'm having problems with his integration also.

I don't quite understand what he uses the helper file for? But this might be a good resource for people other people trying to integrate PHP/SWF Charts.
#4

[eluser]Phil Sturgeon[/eluser]
Ahh yes, that will do the trick.

The helper function is there to allow you to pass raw data (arrays, integers, etc in via one big array such as the $chart example) and return HTML. Saves you a whole bunch of work if you are using multiple charts.

Sorry my first answer was not more useful, but you did not give enough information about the actual problem to start with. "it doesnt work" is not too descriptive. :lol:

Glad you got it working. That seems like a very useful post.
#5

[eluser]Solarpitch[/eluser]
Smile I know sorry about that. It's a hard problem to explain and didnt want to waffle on too much.

I didn't get it working yet! I'm still trying to figure out how to implement it with the way its done in the web blog. He doesn't seem to mention anything about the javascript or xml file so I'm a little stumped as what to do with them.

This is confusing also because the site URL definition has a trailing slash, so I wonder why he includes one in the extensions...

Code:
$url = site_url().'/charter/showsummary/';
$charturl = base_url().'/charts/charts.swf';
$chartlib = base_url().'/charts/charts_library';

I'm sure his way is an excellent way to integrate PHP/SWF.. I just need figure it out and see it in action first Smile
#6

[eluser]Solarpitch[/eluser]
Ok managed to get this to work. It's a brilliant example of how to integrate PHP/SWF with Codeigniter.

For anyone thats using the method in the provided blog link above. If you have everything in place and the chart only seems to be loading a blank rectangle but not producing the graph itself, or if the loading animation is constantly spining.

In the charts.php which should no be your graph_helper.php file, look for

Code:
$html.="<EMBED src='".$flash_file.$u."library_path=".$library_path."&php;_source=".$php_source;

and change it to...

Code:
$html.="<EMBED src='".$flash_file.$u."library_path=".$library_path."&xml;_source=".$php_source;

Your basically changing it from php_source= to xml_source= and you should get the graph loading correctly.

Well this solution sorted my problems anyway Smile
#7

[eluser]PaddyX[/eluser]
Anybody struggling to get XML/SWF (a very different beast from PHP/SWF) working I have got a long way there. See my posting dated yesterday and titled Codeigniter with XML/SWF
#8

[eluser]Solarpitch[/eluser]
Hi PaddyX... I've never used XML/SWF only PHP but have you taken a look at the link I provided above? I cant imagine the format of implementation is too different to that in the example. Infact it should be exactly the same except your referencing an xml_source instead of a php_source.

The code will gather the xml data from the source file and embed it into what ever controller you call it from.
#9

[eluser]PaddyX[/eluser]
[quote author="Solarpitch" date="1234385839"]Hi PaddyX... I've never used XML/SWF only PHP but have you taken a look at the link I provided above? I cant imagine the format of implementation is too different to that in the example. Infact it should be exactly the same except your referencing an xml_source instead of a php_source.

The code will gather the xml data from the source file and embed it into what ever controller you call it from.[/quote]

Hi Solarpitch, yes I saw it and referred to it when I was trying to get PHP/SWF integrated a year ago. In fact some of the questions on the blog are from me. I am not an expert but seems to me that XML/SWF has been significantly rengineered, so I don't think that you can just swap in an XML file for the PHP file. For example the charts.php engine has gone and most of the implementation is done through a AC_RunActiveContent.js Javascript file instead. But the perception of reengineering may just be down to my inexpertise. Certainly my implementation of XML/SWF is a lot cleaner than my implementation of PHP/SWF. I have had no need to use a helper file this time around.
#10

[eluser]Unknown[/eluser]
could you show me the code of graph_helper.php???
i download from maani.us,but i did'nt find chart.php.. thq ^^




Theme © iAndrew 2016 - Forum software by © MyBB