Wednesday, 15 June 2011

php - Can't setup Highchart -



php - Can't setup Highchart -

i trying utilize highchart in cakephp , have followed below tutorial , stackoverflow post on subject.

i still highchart not found.

i downloaded highchartphp , placed 4 files in vendor/highchartsphp

in layout, add together lines actual js files in webroot/js

echo $this->html->script('jquery-1.9.1.min'); // include jquery library echo $this->html->script('highcharts'); // include jquery library

this code

<?php app::import('vendor', 'highchartsphp/highchart'); class chartscontroller extends appcontroller { public function index() { $chart = new highchart(); /////////////////error: class 'highchart' not found $chart->chart = array( 'renderto' => 'container', // div id render chart 'type' => 'line' ); $chart->series[0]->name = 'tokyo'; $chart->series[0]->data = array(7.0, 6.9, 9.5); $this->set( compact( 'chart' ) ); }

in view file

<?php $chart->printscripts(); ?> <script type="text/javascript"> <?php echo $chart->render("chart");?> </script> https://coderwall.com/p/c6yasq using highchartsphp library in cakephp

i can't find more instructions cakephp setup highcharts stuck , highchart not found error. still have missing. has confused me highchartphp doesn't explain how install mvc version cakephp.

how setup highchart works in cakephp ?

i got download zip button link must v3 https://github.com/ghunti/highchartsphp

also error: class 'highchart' not found controller outlined above

that's happens when people don't mention version numbers...

...a year later nobody knows talking anymore. tutorial , question version 1.x.

https://github.com/ghunti/highchartsphp/tree/v1.0

so quick prepare utilize v1, i'm not sure if that's thought it's not maintained anymore.

namespaces , composer

look @ source code of version 2.x , 3.x, using namespaces, , class cannot found when not pointing namespace properly.

as mentioned on projects homepage library should installed via composer, , pretty much libraries using composer generated autoloader needs used, isn't place here explain how utilize composer, extensively covered on net.

https://getcomposer.org/doc/00-intro.md

be sure check out cakephp docs on how utilize composer autoloader cakephp too:

[...]

if you’re installing other libraries composer, you’ll need setup autoloader, , work around issue in composer’s autoloader. in config/bootstrap.php file add together following:

// load composer autoload. require app . 'vendor/autoload.php'; // remove , re-prepend cakephp's autoloader composer thinks // important. // see: http://goo.gl/kkvjo7 spl_autoload_unregister(array('app', 'load')); spl_autoload_register(array('app', 'load'), true, true);

http://book.cakephp.org/.../advanced-installation.html#installing-cakephp-with-composer

php cakephp cakephp-2.3

No comments:

Post a Comment