Re: findAllThreaded hack with root doesn't work

2008-02-12 Thread Adam Royle

Hi Anna,

I tested your code and everything works as expected on my end. I am
using latest 1.2 so whether this has anything to do with it, I don't
know. You might need to pass null instead of an empty string, but this
didn't make a difference in my version.

By the way, I'm guessing (hoping) that you didn't overwrite the core
files within cake. You should be overriding the method in your model.

Cheers,
Adam

On Feb 12, 9:38 pm, Anna P <[EMAIL PROTECTED]> wrote:
> Hi! I used hack for findAllThreaded function from this group - I
> replaced cake's function with:
>
> function findAllThreaded($root = null, $conditions = null, $fields =
> null, $sort = null) {
> return $this->__doThread(Model::findAll($conditions, $fields,
> $sort), $root);
>
> }
>
> I need this function to display posts on a forum:
> //forums_controller.php:
> function topic($id) {
>  $this->set('posts',$this->Post->findAllThreaded());
>
> }
>
> The problem is - when I supply root's ID ( $this->Post->findAllThreaded($id)) 
> , function doesn't find any children. If I
>
> leave $this->Post->findAllThreaded() with no root ID specified - it
> finds all children.
> If I specify fields I want to find, for example:
> $this->Post->findAllThreaded('','','Post.id,Post.parent_id,Post.title'));
>
> it finds nothing and returns empty array.
>
> What is wrong?
> Thanks in advance!
>
> PS. Maybe someone knows any FORUM TUTORIAL for cakephp? It's a bit
> time consuming to write it all by myself.. Cheers!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



findAllThreaded hack with root doesn't work

2008-02-12 Thread Anna P

Hi! I used hack for findAllThreaded function from this group - I
replaced cake's function with:

function findAllThreaded($root = null, $conditions = null, $fields =
null, $sort = null) {
return $this->__doThread(Model::findAll($conditions, $fields,
$sort), $root);
}

I need this function to display posts on a forum:
//forums_controller.php:
function topic($id) {
 $this->set('posts',$this->Post->findAllThreaded());
}

The problem is - when I supply root's ID ( $this->Post-
>findAllThreaded($id)) , function doesn't find any children. If I
leave $this->Post->findAllThreaded() with no root ID specified - it
finds all children.
If I specify fields I want to find, for example:
$this->Post-
>findAllThreaded('','','Post.id,Post.parent_id,Post.title'));
it finds nothing and returns empty array.

What is wrong?
Thanks in advance!


PS. Maybe someone knows any FORUM TUTORIAL for cakephp? It's a bit
time consuming to write it all by myself.. Cheers!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---