Discussion on CakePHP Tree manage & build multilevel menu plugin

khanhtruong

khanhtruong supports this item

Supported

10 comments found.

Hi, when insert a category I receive the following errors (cakephp v. 2.2.5):

Strict (2048): Declaration of SlugBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 342] Code Context App::load() – CORE/Cake/Core/App.php, line 540 App::load() – CORE/Cake/Core/App.php, line 540 spl_autoload_call – [internal], line ?? class_exists – [internal], line ?? BehaviorCollection::load() – CORE/Cake/Model/BehaviorCollection.php, line 120 BehaviorCollection::init() – CORE/Cake/Model/BehaviorCollection.php, line 67 Model::construct() – CORE/Cake/Model/Model.php, line 737 ReflectionClass::newInstance() – [internal], line ?? ClassRegistry::init() – CORE/Cake/Utility/ClassRegistry.php, line 156 Controller::loadModel() – CORE/Cake/Controller/Controller.php, line 733 Controller::isset() – CORE/Cake/Controller/Controller.php, line 366 Controller::get() – CORE/Cake/Controller/Controller.php, line 404 CategoriesController::admin_add() – APP/Plugin/TreeMenu/Controller/CategoriesController.php, line 90 ReflectionMethod::invokeArgs() – [internal], line ?? Controller::invokeAction() – CORE/Cake/Controller/Controller.php, line 485 Dispatcher::_invoke() – CORE/Cake/Routing/Dispatcher.php, line 186 Dispatcher::dispatch() – CORE/Cake/Routing/Dispatcher.php, line 161 [main] – APP/webroot/index.php, line 92 Strict (2048): Declaration of SlugBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model) [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 342] Code Context App::load() – CORE/Cake/Core/App.php, line 540 App::load() – CORE/Cake/Core/App.php, line 540 spl_autoload_call – [internal], line ?? class_exists – [internal], line ?? BehaviorCollection::load() – CORE/Cake/Model/BehaviorCollection.php, line 120 BehaviorCollection::init() – CORE/Cake/Model/BehaviorCollection.php, line 67 Model::construct() – CORE/Cake/Model/Model.php, line 737 ReflectionClass::newInstance() – [internal], line ?? ClassRegistry::init() – CORE/Cake/Utility/ClassRegistry.php, line 156 Controller::loadModel() – CORE/Cake/Controller/Controller.php, line 733 Controller::isset() – CORE/Cake/Controller/Controller.php, line 366 Controller::get() – CORE/Cake/Controller/Controller.php, line 404 CategoriesController::admin_add() – APP/Plugin/TreeMenu/Controller/CategoriesController.php, line 90 ReflectionMethod::invokeArgs() – [internal], line ?? Controller::invokeAction() – CORE/Cake/Controller/Controller.php, line 485 Dispatcher::_invoke() – CORE/Cake/Routing/Dispatcher.php, line 186 Dispatcher::dispatch() – CORE/Cake/Routing/Dispatcher.php, line 161 [main] – APP/webroot/index.php, line 92 Strict (2048): Non-static method unicode2ascii::utf8_to_ascii() should not be called statically, assuming $this from incompatible context [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 298] Code Context SlugBehavior::_slug() – APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 298 SlugBehavior::beforeSave() – APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 321 ObjectCollection::trigger() – CORE/Cake/Utility/ObjectCollection.php, line 130 call_user_func – [internal], line ?? CakeEventManager::dispatch() – CORE/Cake/Event/CakeEventManager.php, line 246 Model::save() – CORE/Cake/Model/Model.php, line 1674 CategoriesController::admin_add() – APP/Plugin/TreeMenu/Controller/CategoriesController.php, line 92 ReflectionMethod::invokeArgs() – [internal], line ?? Controller::invokeAction() – CORE/Cake/Controller/Controller.php, line 485 Dispatcher::_invoke() – CORE/Cake/Routing/Dispatcher.php, line 186 Dispatcher::dispatch() – CORE/Cake/Routing/Dispatcher.php, line 161 [main] – APP/webroot/index.php, line 92

Strict (2048): Declaration of SlugBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model) [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 342] Code Context if (file_exists($file)) { self::_map($file, $className, $plugin); return include $file; $className = ‘SlugBehavior’ $parts = array( (int) 0 => ‘TreeMenu’, (int) 1 => ‘Model/Behavior’ ) $plugin = ‘TreeMenu’ $package = ‘Model/Behavior’ $file = ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php’ $paths = array( (int) 0 => ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/Model/Behavior/’, (int) 1 => ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/Lib/Model/Behavior/’, (int) 2 => ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/Model/Behavior/’ ) $pluginPath = ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/’ $normalizedClassName = ‘SlugBehavior’ $path = ’/Users/vnt/Sites/vedalabs/blog/app/Plugin/TreeMenu/Model/Behavior/’ App::load() – CORE/Cake/Core/App.php, line 560 App::load() – CORE/Cake/Core/App.php, line 560 spl_autoload_call – [internal], line ?? class_exists – [internal], line ?? BehaviorCollection::load() – CORE/Cake/Model/BehaviorCollection.php, line 120 BehaviorCollection::init() – CORE/Cake/Model/BehaviorCollection.php, line 67 Model::construct() – CORE/Cake/Model/Model.php, line 737 ReflectionClass::newInstance() – [internal], line ?? ClassRegistry::init() – CORE/Cake/Utility/ClassRegistry.php, line 156 Controller::loadModel() – CORE/Cake/Controller/Controller.php, line 733 Controller::isset() – CORE/Cake/Controller/Controller.php, line 366 Controller::__get() – CORE/Cake/Controller/Controller.php, line 404 CategoriesController::admin_add() – APP/Plugin/TreeMenu/Controller/CategoriesController.php, line 90 ReflectionMethod::invokeArgs() – [internal], line ?? Controller::invokeAction() – CORE/Cake/Controller/Controller.php, line 485 Dispatcher::_invoke() – CORE/Cake/Routing/Dispatcher.php, line 186 Dispatcher::dispatch() – CORE/Cake/Routing/Dispatcher.php, line 161 [main] – APP/webroot/index.php, line 92 Strict (2048): Non-static method unicode2ascii::utf8_to_ascii() should not be called statically, assuming $this from incompatible context [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 298] Code Context App::import(‘Vendor’, ‘TreeMenu.unicode2ascii’); $replacement = $this->settings[‘replacement’]; $slug = unicode2ascii::utf8_to_ascii($title, $replacement); $title = ‘Sesto Fiorentino’ $replacement = ’_’ SlugBehavior::_slug() – APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 298 SlugBehavior::beforeSave() – APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 321 ObjectCollection::trigger() – CORE/Cake/Utility/ObjectCollection.php, line 130 call_user_func – [internal], line ?? CakeEventManager::dispatch() – CORE/Cake/Event/CakeEventManager.php, line 246 Model::save() – CORE/Cake/Model/Model.php, line 1674 CategoriesController::admin_add() – APP/Plugin/TreeMenu/Controller/CategoriesController.php, line 92 ReflectionMethod::invokeArgs() – [internal], line ?? Controller::invokeAction() – CORE/Cake/Controller/Controller.php, line 485 Dispatcher::_invoke() – CORE/Cake/Routing/Dispatcher.php, line 186 Dispatcher::dispatch() – CORE/Cake/Routing/Dispatcher.php, line 161 [main] – APP/webroot/index.php, line 92

Open SlugBehaviour.php line 313 and replace by “function beforeSave(Model $model) {”. If error still occur, open TreeMenu/Model/Category.php and comment variable $actsAs.

Ok now it works.

How do I put the link on the name of the categories in sort categories?

thanks a lot.

Hello your demo site no longer work. Domain is Expired !!!!!!!!!!!

Missing Plugin

Error: The application is trying to load a file from the TreeMenu plugin

Error: Make sure your plugin TreeMenu is in the app\Plugin directory and was loaded

<?php CakePlugin::load(‘TreeMenu’);

Loading all plugins: If you wish to load all plugins at once, use the following line in your app\Config\bootstrap.php file

CakePlugin::loadAll();

Notice: If you want to customize this error message, create app\View\Errors\missing_plugin.ctp

So I have your version working, and I tried to merge the sort feature in my own tree structure but I cannot manage to have the tree appear on the sort page. getnodes outputs the data encoded for Js correctly but the sort page only displays the root. Any tip or idea ? thanks !

I get this :

 [{"text":"article 2","id":"2","cls":"folder","leaf":false},{"text":"The bla bla","id":"1","cls":"folder","leaf":true},{"text":"An other article","id":"4","cls":"folder","leaf":false},{"text":"A test article","id":"3","cls":"folder","leaf":true},{"text":"Project Team","id":"5","cls":"folder","leaf":true},{"text":"Home","id":"6","cls":"folder","leaf":true}] 
Hi, I’m interested in buying your plugin but I’d like to know if it’s possible to generate a menu like this from within the view:

<ul id="menu-main-nav">
    <li><a href="#"><span><strong>Button 1</strong><span class="navi-description">Sub 1</span></span></a>
        <ul class="sub-menu">
            <li><a href="#"><span>Button 1.1</span></a></li>
            <li><a href="#"><span>Button 1.2</span></a></li>
                <li><a href="#"><span>Button 1.3</span></a></li>
        </ul>
    </li>
    <li class="current_page_item"><a href="#"><span><strong>Button 2</strong><span class="navi-description">Sub 2</span></span></a>
        <ul class="sub-menu">
             <li class="current-menu-item"><a href="#"><span>Button 2.1</span></a></li>
             <li><a href="#"><span>Button 2.2</span></a></li>
             <li><a href="#"><span>Button 2.3</span></a></li>
        </ul>
    </li>
    <li><a href="#"><span><strong>Button 3</strong><span class="navi-description">Sub 3</span></span></a>
        <ul class="sub-menu">
            <li><a href="#"><span>Button 3.1</span></a></li>
        </ul>
    </li>
</ul>
So is it possible to:
- add classes and ids to top- and sub level items;
- add different ‘selected’ classes from the selected item all the way up;
- add tags (like ‘span’ and ‘strong’) to the items;
This all should be possible by passing parameters from within the view because it is different for different themes.

Thanx for your reply.

Sorry for late reply. Currently, the menu was generated like this http://codeshare.io/iPFfX

Strict (2048): Declaration of Category::afterSave() should be compatible with Model::afterSave($created, $options = Array) [APP/Plugin/TreeMenu/Model/Category.php, line 9] Strict (2048): Declaration of SlugBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model, $options = Array) [APP/Plugin/TreeMenu/Model/Behavior/SlugBehavior.php, line 342]

Strict (2048): Declaration of Category::afterSave() should be compatible with Model::afterSave($created, $options = Array) [APP/Plugin/TreeMenu/Model/Category.php, line 9]

Open APP/Plugin/TreeMenu/Model/Category.php replace line 33-34 by

public function afterSave($created, $options = array()) { parent::afterSave($created, $options);

Open APP/Plugin/TreeMenu/Model/Behaviour/SlugBehaviour.php replace line 313 by

function beforeSave(Model $model, $options = array()) {

Sorry for any inconvenience.

Do I need to make the above edits or did you update your download?

Tried all the above code changes and still get when adding : Strict (2048): Declaration of SlugBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model, $options = Array) [APP/Model/Behavior/SlugBehavior.php, line 342]

Using cakephp 2.4.3. within the same error above it shows: Database Error Error: SQLSTATE42000: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AND’ at line 1

SQL Query: UPDATE `LOCALHOST`.`categories` AS `Category` SET `Category`.`lft` = `Category`.`lft` + 19 WHERE `Category`.`lft` BETWEEN AND

Open SlugBehaviour.php line 313 and replace by “function beforeSave(Model $model) {”. If error still occur, open TreeMenu/Model/Category.php and comment variable $actsAs.

khanhtruong,

Good afternoon , it is possible to get the “Click Event ” nodes of tremenu ? I want to use it to browse the site but I do not know that ..

I use superfish menu for this plugin. You can find out more here http://users.tpg.com.au/j_birch/plugins/superfish/

I want to combine two or more tree to show the relationship. For example : i made a work tree and location tree. Both are different tree but i want to link both. Work 1—> location1, Work 1—> location2, Work 1—> location3,

Work 2—> location3, Work 2—> location4,

Work 3—> location1, Work 3—> location3, Work 3—> location4, Work 3—> location5,

Is it possible using this plugin.

aivaco

aivaco Purchased

How do I make the sort tree accesible/visible without being logged? I already deactivate the drag and drop but I need it visible for everyone logged or not logged Thanks!!!

aivaco

aivaco Purchased

I already have the sort view accesible without being logged but I still can’t make it show the tree if I am not logged in…

aivaco

aivaco Purchased

I added the sort to the before filter and it gave me access to the view, but the view is not loading the tree

I think you should learn it more. Also, I had created a CakePHP plugin for authentication, check it out here http://codecanyon.net/item/cakephp-authentication-acl-management-plugin/1325808

by
by
by
by
by
by