Friday, January 28, 2011

Please help me! almost got crazy...with Tree behavior..

Hi, everyone.
This is second time to post with this kind of content to this group.
My first time post was gone, never appears, and dunno why, so I m
writing the post again.

I just used Tree behavior for category, according to what cakePHP
manual said.
But when I used generatetreelist(), it all times says following:

Warning (512): SQL Error: 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 'generatetreelist' at line 1 [CORE\cake\libs
\model\datasources\dbo_source.php, line 684]
...
$sql = "generatetreelist"
$error = "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 'generatetreelist' at line 1"
$out = null
...
msController::category() - APP\controllers\items_controller.php, line
12
...
Query: generatetreelist

I found that the system actually does not recorgnize what
generatetreelist() is, but do not know what to do...

I created table called lkp_itemcate with following fields:
id, parent_id, lft, rght, name, img_url, level, created, modified

And made Model class following:
class Itemcate extends AppModel {
var $name = 'Itemcate';
var $tablePrefix = 'lkp_';
var $useTable = 'itemcate';

var $actAs = array('Tree');
}

and then used generatetreelist() in controller:

class ItemsController extends AppController {
var $name = 'Items';
var $modelClass = 'Itemcate';
var $uses = array('Itemcate');

function category($act = 'index', $id = null) {
...
$list = $this->Itemcate->generatetreelist(null, null, null,
'   ');
...
}
...
}

Please help me to settle with this issue.
I really can not find what s wrong, googled for 2 hours, but never
find such a case like mine.
Best regards, Raymond.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: