sadapon2008 / simple-file-manager
SimpleFileManager For CakePHP + TinyMCE
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- cakedc/migrations: ~2.3
- composer/installers: *
- slywalker/boost_cake: ~1.0.6
This package is not auto-updated.
Last update: 2024-12-21 17:12:13 UTC
README
Example
1. create upload directory
$ mkdir app/webroot/upload $ chmod a+w app/webroot/upload
2. load plugin
app/Config/bootstra.php:
CakePlugin::load('Migrations'); CakePlugin::load('BoostCake'); CakePlugin::load('SimpleFileManager', array('bootstrap' => true));
3. create database table
$ ./app/Console/cake Migrations.migration run all -p SimpleFileManager
4. example controller & view
app/Controller/PostsController:
<?php App::uses('AppController', 'Controller'); class PostsController extends AppController { public $uses = array('Post'); public $helpers = array('SimpleFileManager.SimpleFileManager'); public function index() { if($this->request->is('post') || $this->request->is('put')) { $this->Post->create(); $this->Post->save($this->request->data); } } }
app/View/Posts/index.ctp:
<?php $this->start('script'); ?> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script src="//tinymce.cachefly.net/4.1/tinymce.min.js"></script> <?php echo $this->SimpleFileManager->script(); ?> <script type="text/javascript"> $(function() { tinymce.init({ selector: 'textarea', plugins: ['image'], file_browser_callback: <?php echo $this->SimpleFileManager->getFileBrowserCallBack(); ?>, width: '620', height: '480', relative_urls : false }); }); </script> <?php $this->end(); ?> <?php echo $this->Form->create('Post'); ?> <?php echo $this->Form->input('content', array('type' => 'textarea')); ?> <?php echo $this->Form->end(); ?>