我有一个适用于 cake 2.x 的裁剪工具组件和助手,但现在我需要将此裁剪工具用于 cakephp 1.3 中的一个较旧的项目中。我该怎么做?
组件:
<?php
App::uses('Component', 'Controller');
class JcropComponent extends Component {
public $components = array('Session');
public $options = array(
'overwriteFile' => true,
'boxWidth' => '940'
);
/**
* Constructor
*/
public function __construct(ComponentCollection $collection, $options = array()) {
parent::__construct($collection,$options);
$this->options = array_merge($this->options, $options);
}
?>
帮手
<?php
App::uses('AppHelper', 'View/Helper');
class JcropHelper extends AppHelper {
public $helpers = array('Html','Form','Js');
public $options = array(
'tooltip' => true,
'boxWidth' => '940'
);
public function __construct(View $view, $options = null) {
parent::__construct($view,$options);
$this->options = array_merge($this->options, $options);
}
?>
我试着把它改成这个,它可以显示图像,但是我怎样才能合并选项数组呢?__construct ($options = array())
<?php
class JcropComponent extends Component {
var $components = array('Session');
public $options = array(
'overwriteFile' => true,
'boxWidth' => '940'
);
//public function initialize(&$controller, $settings = array()) {
// $this->controller =& $controller;
//parent::__construct($collection,$options);
//$this->options = array_merge($this->options, $options);
//}
?>
<?php
class JcropHelper extends AppHelper {
var $helpers = array('Html','Form','Js');
public $options = array(
'tooltip' => true,
'boxWidth' => '940'
);
public function __construct($settings = null) {
//parent::__construct($view,$options);
//$this->options = array_merge($this->options, $options);
}
?>