Re: Use Set::sort

2009-10-10 Thread albe

Thank you Dave, I have fixed it in the simplest way possible:

using the var $order variable in the model.

On 10 Ott, 16:54, "Dave Maharaj :: WidePixels.com"
 wrote:
> Try sort(); or another standard php sorting function.
>
> http://ca3.php.net/manual/en/function.sort.php
>
> -Original Message-
> From: albe [mailto:radialremo...@gmail.com]
> Sent: October-10-09 11:45 AM
> To: CakePHP
> Subject: Re: Use Set::sort
>
> Ok I have found the answer: in my cakephp version there's no sort function
> in the set class!
> How can I sort my array otherwise? Unfortunately I CAN'T update the cakePHP
> version for this specific job.
>
> On 10 Ott, 15:25, albe  wrote:
> > Hi,
> > I have to sort an array and I have found out this simple way:
>
> >http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakep...
>
> > Unfortunately, when I put the sorting code in my apllication's got I
> > got:
>
> > "Fatal error: Call to undefined method Set::sort() in C:\...
> > \controller.php on line 818"
>
> > Maybe the use of the Set class has to be declared... where?
>
> > Thank you in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Use Set::sort

2009-10-10 Thread albe

Ok I have found the answer: in my cakephp version there's no sort
function in the set class!
How can I sort my array otherwise? Unfortunately I CAN'T update the
cakePHP version for this specific job.

On 10 Ott, 15:25, albe  wrote:
> Hi,
> I have to sort an array and I have found out this simple way:
>
> http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakep...
>
> Unfortunately, when I put the sorting code in my apllication's got I
> got:
>
> "Fatal error: Call to undefined method Set::sort() in C:\...
> \controller.php on line 818"
>
> Maybe the use of the Set class has to be declared... where?
>
> Thank you in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Use Set::sort

2009-10-10 Thread albe

Hi,
I have to sort an array and I have found out this simple way:

http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakephp-12/

Unfortunately, when I put the sorting code in my apllication's got I
got:

"Fatal error: Call to undefined method Set::sort() in C:\...
\controller.php on line 818"

Maybe the use of the Set class has to be declared... where?

Thank you in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to add elements to array?

2009-09-17 Thread albe

I know it may be a banal question, but I couldn't find the answer
anywhere.
How can I add elements to an array in a cycle like this:

$test=array;

foreach($posts as $p){
if ($p['Post']['parent_id']==$post_id){

  put $p into the array $test how can I do it?

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



finAllThreaded with parameter $root

2009-09-17 Thread albe

Referring to:

http://groups.google.com/group/cake-php/browse_thread/thread/94ec5a3d33f2a935/ba469c8c052674b8?lnk=gst&q=findAllThreaded&rnum=1#ba469c8c052674b8

Any advice on how is it possible to obtain the same thing without
editing the core?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: findAll with condition on created filed

2009-08-22 Thread albe

I have found a solution in this way:

$conditions['Post.created'] = '>'.$post_created;
$posts_after = $this->Post->findAll($conditions);

On 22 Ago, 10:53, albe  wrote:
> Hi everybody,
>
> I have obtained the created vale for a row of my model in this way:
>
> $post_created = $this->InfodiscPost->field('created', array('Post.id
> ='.$post_id));
>
> Now I want to obtain an array containing all the posts created after
> this one. My attempt was this:
>
> $posts_after = $this->Post->findAll('Post.created > '.$post_created);
>
> but it doesn't seem to work. Is there something wrong in the condition?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



findAll with condition on created filed

2009-08-22 Thread albe

Hi everybody,

I have obtained the created vale for a row of my model in this way:


$post_created = $this->InfodiscPost->field('created', array('Post.id
='.$post_id));


Now I want to obtain an array containing all the posts created after
this one. My attempt was this:


$posts_after = $this->Post->findAll('Post.created > '.$post_created);


but it doesn't seem to work. Is there something wrong in the condition?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: If-else within a foreach cycle

2009-08-21 Thread albe

@ brian:

What I need is to update existing records, and I've got to assign
$value2 as well as $value1... so I need the ELSE branch.
However, Thanks for the effort!

On 21 Ago, 13:56, brian  wrote:
> Oops! I take that back. I just re-read the original post.
>
> On Fri, Aug 21, 2009 at 7:55 AM, brian wrote:
> > I don't think albe is trying to update existing records, though. And,
> > anyway, with your example, $value1 is never assigned.
>
> > On Fri, Aug 21, 2009 at 7:17 AM, delocalizer 
> > wrote:
>
> >> updateAll is the way to go...
> >> eg. $this->Post->updateAll(array('options'=>value2),array('id <>
> >> '=>'$var));
> >> reducing the number of transactions in this case from n(Posts) to just
> >> 2 - one for the matching record and one for all the rest.
>
> >> On Aug 21, 8:45 pm, brian  wrote:
> >>> Almost, but $value_2 will never be assigned. Perhaps the OP could shed
> >>> some light on the bigger picture as there may be a better way to
> >>> approach this.
>
> >>> On Fri, Aug 21, 2009 at 5:07 AM, rich...@home 
> >>> wrote:
>
> >>> > You don't need the else branch in the 2nd example, its taken care of
> >>> > in the read:
>
> >>> > // fetch back the record with an id of $var
> >>> > $post = $this->Post->read(null, $var);
>
> >>> > // update the record
> >>> > $post['Post']['options'] = value1;
>
> >>> > // save the record
> >>> > $this->Post->save($post);
>
> >>> > In the first example, you fetch back a number of records and loop
> >>> > through them looking for one with an id of $var. It's quite likely
> >>> > that id will be unique (its should be a primary key) so there's no
> >>> > need for the loop.
>
> >>> > On Aug 20, 5:21 pm, albe  wrote:
> >>> >> foreach($posts as $p) {
>
> >>> >>         if ($p['Post']['id'] == $var) {
> >>> >>           $p['Post']['options'] = value1;
> >>> >>         } else {
> >>> >>           $p['Post']['options'] = value 2;
> >>> >>         }
> >>> >>         $this->Post->save($p);
>
> >>> >> }
>
> >>> >> This works! I just can't say how much I am grateful for your help!
> >>> >> However I still don't understand why my code was wrong...
>
> >>> >> About your second way:
>
> >>> >> $post = $this->Post->read(null, $var);
> >>> >> $post['Post']['options'] = value1;
> >>> >> $this->Post->save($post);
>
> >>> >> If I use this, where shall i put the ELSE branch?
>
> >>> >> On 20 Ago, 18:00, "rich...@home"  wrote:
>
> >>> >> > Shouldn't that be:
>
> >>> >> > foreach($posts as $p) {
>
> >>> >> >         if ($p['Post']['id'] == $var) {
> >>> >> >           $p['Post']['options'] = value1;
> >>> >> >         } else {
> >>> >> >           $p['Post']['options'] = value 2;
> >>> >> >         }
> >>> >> >         $this->Post->save($p);
>
> >>> >> > }
>
> >>> >> > also, if you are just matching against the id, you could just write 
> >>> >> > it
> >>> >> > as:
>
> >>> >> > $post = $this->Post->read(null, $var);
> >>> >> > $post['Post']['options'] = value1;
> >>> >> > $this->Post->save($post);
>
> >>> >> > and forget about the loop
>
> >>> >> > On Aug 20, 3:26 pm, AD7six  wrote:
>
> >>> >> > > On 20 ago, 15:39, albe  wrote:
>
> >>> >> > > > I have to make a foreach cycle to check every item of a certain 
> >>> >> > > > group.
> >>> >> > > > For each and every item I've got to check a condition and make a 
> >>> >> > > > data
> >>> >> > > > modification depending on this condition.
> >>> >> > > > My code is the following:
>
> >>> >> > > > foreach($posts as $p) {
>
> >>> >> > > >         $this->Post->id = $p['Post']['id']; //consider the posts 
> >>> >> > > > one
> >>> >> > > > by one
>
> >>> >> > > >         if ($this->Post->id == $var) {
> >>> >> > > >           $this->data['Post']['options'] = value1;
> >>> >> > > >         } else {
> >>> >> > > >           $this->data['Post']['options'] = value 2;
> >>> >> > > >         }
>
> >>> >> > > >         $this->Post->save($this->data);
>
> >>> >> > > > }
>
> >>> >> > > > Here is my problem: the modifications are performed correctly 
> >>> >> > > > for the
> >>> >> > > > IF branch, but NEVER for the else branch.
> >>> >> > > > Do you know why this occurs?
>
> >>> >> > > aliens?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Foreach doesn't consider a node

2009-08-21 Thread albe
Thank you very much majna!
I made it with a recursive function like that, now it's ok.

On 21 Ago, 10:55, majna  wrote:
> Use recursion like thishttp://bakery.cakephp.org/articles/view/threaded-lists
>
> On Aug 21, 10:41 am, albe  wrote:
>
> > Hi everybody,
>
> > Thanks to the function findAllThreaded() I've obtained a structure
> > like this:
>
> > Array
> > (
> >     [0] => Array
> >         (
> >             [Post] => Array
> >                 (
> >                     [id] => 55
> >                     [parent_id] => 53
> >                     [title] => ...
> >                     [body] => ...
> >                     [user_id] => 1
> >                     [forum_id] => 1
> >                 )
>
> >             [Forum] => Array
> >                 (
> >                     [id] => 1
> >                     [title] => ...
> >                 )
>
> >             [User] => Array
> >                 (
> >                     [id] => 1
> >                     [username] => ...
> >                 )
>
> >             [children] => Array
> >                 (
> >                     [0] => Array
> >                         (
> >                             [Post] => Array
> >                                 (
> >                                     [id] => 58
> >                                     [parent_id] => 55
> >                                     [title] =>
> >                                     [body] => ...
> >                                     [user_id] => 2
> >                                     [forum_id] => 1
> >                                 )
>
> >                             [Forum] => Array
> >                                 (
> >                                     [id] => 1
> >                                     [title] => ...
> >                                 )
>
> >                             [User] => Array
> >                                 (
> >                                     [id] => 2
> >                                     [username] => ...
> >                                 )
>
> >                             [children] => Array
> >                                 (
> >                                 )
>
> >                         )
>
> >                 )
> >           )
> >      )
>
> > If I try to do a foreach cycle over this structure in this way:
>
> > foreach ($posts as $p) { ... }
>
> > I discover that the cycle considers only the first post (it doesn't
> > consider the child). Which cycle am I supposed to do to consider every
> > item (child, children of the child... and so on)?
> > Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Foreach doesn't consider a node

2009-08-21 Thread albe

Hi everybody,

Thanks to the function findAllThreaded() I've obtained a structure
like this:

Array
(
[0] => Array
(
[Post] => Array
(
[id] => 55
[parent_id] => 53
[title] => ...
[body] => ...
[user_id] => 1
[forum_id] => 1
)

[Forum] => Array
(
[id] => 1
[title] => ...
)

[User] => Array
(
[id] => 1
[username] => ...
)

[children] => Array
(
[0] => Array
(
[Post] => Array
(
[id] => 58
[parent_id] => 55
[title] =>
[body] => ...
[user_id] => 2
[forum_id] => 1
)

[Forum] => Array
(
[id] => 1
[title] => ...
)

[User] => Array
(
[id] => 2
[username] => ...
)

[children] => Array
(
)

)

)
  )
 )

If I try to do a foreach cycle over this structure in this way:

foreach ($posts as $p) { ... }

I discover that the cycle considers only the first post (it doesn't
consider the child). Which cycle am I supposed to do to consider every
item (child, children of the child... and so on)?
Thanks in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tree-structure forum, collect a post and its "dinasty"

2009-08-20 Thread albe

Now I've got another little problem. From findAllThreaded I obtain a
structure like this:

Array
(
[0] => Array
(
[Post] => Array
(
[id] => 55
[parent_id] => 53
[title] => ...
[body] => ...
[user_id] =>...
[forum_id] => 1
)

[Forum] => Array
(
[id] => 1
[title] => ...
)

[User] => Array
(
[id] => 1
[username] => ...
)

[children] => Array
(
[0] => Array
(
[Post] => Array
(
[id] => 58
[parent_id] => 55
[title] =>
[body] => ...
[user_id] =>...
[forum_id] => 1
)

[Infodisc] => Array
(
[id] => 1
[title] => ...
)

[User] => Array
(
[id] => 2
[username] => ...
)

[children] => Array
(
)

)

)

)

)


Now that I have obtained the complete nested level starting from a
post, I obviously want to make operations on each of these post... but
when I try to do foreach($posts_to_move as $p) { ... } I discover that
the cycle takes into consideration only the first level!!!
Please, help me to get out of this endless nightmare...



On 21 Ago, 00:43, albe  wrote:
> Ok, I give myself an answer: the function findAllThreaded has to be
> modified right in the cake/libs/model/model.php file.
> Once done you can finally obtain all the nested items of one element
> of your choice!
>
> On 21 Ago, 00:30, albe  wrote:
>
> > I feel I'm very close... the following one could be the solution:
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/94ec5a3d...
>
> > Only one thing:
> > Where must I write the "hacked" findAllThreaded function?
>
> > On 20 Ago, 23:29, albe  wrote:
>
> > > Thank you very much majna!
> > > ->find('threaded') seems to be perfect for my need... unfortunately it
> > > doesn't work for me (error "Undefined offset").
> > > And my algorithm was wrong... so I've got to get another headache...
>
> > > On 20 Ago, 21:01, majna  wrote:
>
> > > > "what is the way to put an element ?"
> > > > $post_dinasty[] = $p;
>
> > > > try with $posts = $this->Post->find('threaded', array
> > > > ('conditions'=>array('Post.id'=>$post_chose)));http://book.cakephp.org/view/812/find-threaded
>
> > > > On Aug 20, 7:13 pm, albe  wrote:
>
> > > > > Hi,
> > > > > I am working on a forum which discussions are tree-structured (a post
> > > > > may have direct replies).
> > > > > Suppose that I want to collect a post and all of its replies and the
> > > > > replies of its replies and so on...
> > > > > I would like to put each post in an array in this way:
>
> > > > > $posts = $this->Post->findAll();
> > > > >       $posts_dinasty=array();
> > > > >       foreach($posts as $p){
> > > > >         if($p['Post']['id']==$post_chose){ //$post_chose is the post
> > > > > of which I want to collect the dinasty
> > > > >           $post_dinasty = $p;  //(?)what is the way to put an element
> > > > > in the array?
> > > > >         } else {  //altrimenti
> > > > >           foreach($post_dinasty ad $pd){
> > > > >             if($p['Post']['parent_id']==$pd['Post']['id']){  //if I
> > > > > find the father of this post in the posts already collected
> > > > >               $post_dinasty = $p;  //(?) I want to put it in the
> > > > > array in which way?
> > > > >             }
> > > > >          }
> > > > >         }
> > > > >       }
>
> > > > > I think that the algorithm is correct, can you confirm it?
> > > > > What is the way to put the elements in the array?
> > > > > Thank you very much in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tree-structure forum, collect a post and its "dinasty"

2009-08-20 Thread albe

Ok, I give myself an answer: the function findAllThreaded has to be
modified right in the cake/libs/model/model.php file.
Once done you can finally obtain all the nested items of one element
of your choice!

On 21 Ago, 00:30, albe  wrote:
> I feel I'm very close... the following one could be the solution:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/94ec5a3d...
>
> Only one thing:
> Where must I write the "hacked" findAllThreaded function?
>
> On 20 Ago, 23:29, albe  wrote:
>
> > Thank you very much majna!
> > ->find('threaded') seems to be perfect for my need... unfortunately it
> > doesn't work for me (error "Undefined offset").
> > And my algorithm was wrong... so I've got to get another headache...
>
> > On 20 Ago, 21:01, majna  wrote:
>
> > > "what is the way to put an element ?"
> > > $post_dinasty[] = $p;
>
> > > try with $posts = $this->Post->find('threaded', array
> > > ('conditions'=>array('Post.id'=>$post_chose)));http://book.cakephp.org/view/812/find-threaded
>
> > > On Aug 20, 7:13 pm, albe  wrote:
>
> > > > Hi,
> > > > I am working on a forum which discussions are tree-structured (a post
> > > > may have direct replies).
> > > > Suppose that I want to collect a post and all of its replies and the
> > > > replies of its replies and so on...
> > > > I would like to put each post in an array in this way:
>
> > > > $posts = $this->Post->findAll();
> > > >       $posts_dinasty=array();
> > > >       foreach($posts as $p){
> > > >         if($p['Post']['id']==$post_chose){ //$post_chose is the post
> > > > of which I want to collect the dinasty
> > > >           $post_dinasty = $p;  //(?)what is the way to put an element
> > > > in the array?
> > > >         } else {  //altrimenti
> > > >           foreach($post_dinasty ad $pd){
> > > >             if($p['Post']['parent_id']==$pd['Post']['id']){  //if I
> > > > find the father of this post in the posts already collected
> > > >               $post_dinasty = $p;  //(?) I want to put it in the
> > > > array in which way?
> > > >             }
> > > >          }
> > > >         }
> > > >       }
>
> > > > I think that the algorithm is correct, can you confirm it?
> > > > What is the way to put the elements in the array?
> > > > Thank you very much in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tree-structure forum, collect a post and its "dinasty"

2009-08-20 Thread albe

I feel I'm very close... the following one could be the solution:

http://groups.google.com/group/cake-php/browse_thread/thread/94ec5a3d33f2a935/ba469c8c052674b8?lnk=gst&q=findAllThreaded&rnum=1#ba469c8c052674b8

Only one thing:
Where must I write the "hacked" findAllThreaded function?

On 20 Ago, 23:29, albe  wrote:
> Thank you very much majna!
> ->find('threaded') seems to be perfect for my need... unfortunately it
> doesn't work for me (error "Undefined offset").
> And my algorithm was wrong... so I've got to get another headache...
>
> On 20 Ago, 21:01, majna  wrote:
>
> > "what is the way to put an element ?"
> > $post_dinasty[] = $p;
>
> > try with $posts = $this->Post->find('threaded', array
> > ('conditions'=>array('Post.id'=>$post_chose)));http://book.cakephp.org/view/812/find-threaded
>
> > On Aug 20, 7:13 pm, albe  wrote:
>
> > > Hi,
> > > I am working on a forum which discussions are tree-structured (a post
> > > may have direct replies).
> > > Suppose that I want to collect a post and all of its replies and the
> > > replies of its replies and so on...
> > > I would like to put each post in an array in this way:
>
> > > $posts = $this->Post->findAll();
> > >       $posts_dinasty=array();
> > >       foreach($posts as $p){
> > >         if($p['Post']['id']==$post_chose){ //$post_chose is the post
> > > of which I want to collect the dinasty
> > >           $post_dinasty = $p;  //(?)what is the way to put an element
> > > in the array?
> > >         } else {  //altrimenti
> > >           foreach($post_dinasty ad $pd){
> > >             if($p['Post']['parent_id']==$pd['Post']['id']){  //if I
> > > find the father of this post in the posts already collected
> > >               $post_dinasty = $p;  //(?) I want to put it in the
> > > array in which way?
> > >             }
> > >          }
> > >         }
> > >       }
>
> > > I think that the algorithm is correct, can you confirm it?
> > > What is the way to put the elements in the array?
> > > Thank you very much in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tree-structure forum, collect a post and its "dinasty"

2009-08-20 Thread albe

Thank you very much majna!
->find('threaded') seems to be perfect for my need... unfortunately it
doesn't work for me (error "Undefined offset").
And my algorithm was wrong... so I've got to get another headache...

On 20 Ago, 21:01, majna  wrote:
> "what is the way to put an element ?"
> $post_dinasty[] = $p;
>
> try with $posts = $this->Post->find('threaded', array
> ('conditions'=>array('Post.id'=>$post_chose)));http://book.cakephp.org/view/812/find-threaded
>
> On Aug 20, 7:13 pm, albe  wrote:
>
> > Hi,
> > I am working on a forum which discussions are tree-structured (a post
> > may have direct replies).
> > Suppose that I want to collect a post and all of its replies and the
> > replies of its replies and so on...
> > I would like to put each post in an array in this way:
>
> > $posts = $this->Post->findAll();
> >       $posts_dinasty=array();
> >       foreach($posts as $p){
> >         if($p['Post']['id']==$post_chose){ //$post_chose is the post
> > of which I want to collect the dinasty
> >           $post_dinasty = $p;  //(?)what is the way to put an element
> > in the array?
> >         } else {  //altrimenti
> >           foreach($post_dinasty ad $pd){
> >             if($p['Post']['parent_id']==$pd['Post']['id']){  //if I
> > find the father of this post in the posts already collected
> >               $post_dinasty = $p;  //(?) I want to put it in the
> > array in which way?
> >             }
> >          }
> >         }
> >       }
>
> > I think that the algorithm is correct, can you confirm it?
> > What is the way to put the elements in the array?
> > Thank you very much in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Tree-structure forum, collect a post and its "dinasty"

2009-08-20 Thread albe

Hi,
I am working on a forum which discussions are tree-structured (a post
may have direct replies).
Suppose that I want to collect a post and all of its replies and the
replies of its replies and so on...
I would like to put each post in an array in this way:

$posts = $this->Post->findAll();
  $posts_dinasty=array();
  foreach($posts as $p){
if($p['Post']['id']==$post_chose){ //$post_chose is the post
of which I want to collect the dinasty
  $post_dinasty = $p;  //(?)what is the way to put an element
in the array?
} else {  //altrimenti
  foreach($post_dinasty ad $pd){
if($p['Post']['parent_id']==$pd['Post']['id']){  //if I
find the father of this post in the posts already collected
  $post_dinasty = $p;  //(?) I want to put it in the
array in which way?
}
 }
}
  }

I think that the algorithm is correct, can you confirm it?
What is the way to put the elements in the array?
Thank you very much in advance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: If-else within a foreach cycle

2009-08-20 Thread albe

Please if anyone has an idea of the reason that could produce this
result let me know...
I've checked hundreds of times the code.

On 20 Ago, 16:26, AD7six  wrote:
> On 20 ago, 15:39, albe  wrote:
>
>
>
> > I have to make a foreach cycle to check every item of a certain group.
> > For each and every item I've got to check a condition and make a data
> > modification depending on this condition.
> > My code is the following:
>
> > foreach($posts as $p) {
>
> >         $this->Post->id = $p['Post']['id']; //consider the posts one
> > by one
>
> >         if ($this->Post->id == $var) {
> >           $this->data['Post']['options'] = value1;
> >         } else {
> >           $this->data['Post']['options'] = value 2;
> >         }
>
> >         $this->Post->save($this->data);
>
> > }
>
> > Here is my problem: the modifications are performed correctly for the
> > IF branch, but NEVER for the else branch.
> > Do you know why this occurs?
>
> aliens?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: If-else within a foreach cycle

2009-08-20 Thread albe

foreach($posts as $p) {

if ($p['Post']['id'] == $var) {
  $p['Post']['options'] = value1;
} else {
  $p['Post']['options'] = value 2;
}
$this->Post->save($p);

}

This works! I just can't say how much I am grateful for your help!
However I still don't understand why my code was wrong...

About your second way:

$post = $this->Post->read(null, $var);
$post['Post']['options'] = value1;
$this->Post->save($post);

If I use this, where shall i put the ELSE branch?


On 20 Ago, 18:00, "rich...@home"  wrote:
> Shouldn't that be:
>
> foreach($posts as $p) {
>
>         if ($p['Post']['id'] == $var) {
>           $p['Post']['options'] = value1;
>         } else {
>           $p['Post']['options'] = value 2;
>         }
>         $this->Post->save($p);
>
> }
>
> also, if you are just matching against the id, you could just write it
> as:
>
> $post = $this->Post->read(null, $var);
> $post['Post']['options'] = value1;
> $this->Post->save($post);
>
> and forget about the loop
>
> On Aug 20, 3:26 pm, AD7six  wrote:
>
> > On 20 ago, 15:39, albe  wrote:
>
> > > I have to make a foreach cycle to check every item of a certain group.
> > > For each and every item I've got to check a condition and make a data
> > > modification depending on this condition.
> > > My code is the following:
>
> > > foreach($posts as $p) {
>
> > >         $this->Post->id = $p['Post']['id']; //consider the posts one
> > > by one
>
> > >         if ($this->Post->id == $var) {
> > >           $this->data['Post']['options'] = value1;
> > >         } else {
> > >           $this->data['Post']['options'] = value 2;
> > >         }
>
> > >         $this->Post->save($this->data);
>
> > > }
>
> > > Here is my problem: the modifications are performed correctly for the
> > > IF branch, but NEVER for the else branch.
> > > Do you know why this occurs?
>
> > aliens?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



If-else within a foreach cycle

2009-08-20 Thread albe

I have to make a foreach cycle to check every item of a certain group.
For each and every item I've got to check a condition and make a data
modification depending on this condition.
My code is the following:

foreach($posts as $p) {

$this->Post->id = $p['Post']['id']; //consider the posts one
by one

if ($this->Post->id == $var) {
  $this->data['Post']['options'] = value1;
} else {
  $this->data['Post']['options'] = value 2;
}

$this->Post->save($this->data);
}

Here is my problem: the modifications are performed correctly for the
IF branch, but NEVER for the else branch.
Do you know why this occurs?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Related drop-down list

2009-08-17 Thread albe

Hello everybody!
I have to realize a form with two drop-down lists related.
Let me explain: the first d.d.l. takes its data directly from the
database and the data on the second d.d.l. change depending on the
choice that the user performs on the first d.d.l.
I'd like to do this without make any loading after the first choice
(without pressing any button... when the user chooses something from
the first d.d.l the contents of the second changes "automagically").
Is it possible in cake?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Translate Query into find

2009-08-16 Thread albe

$_this_id = $this->Post->field(
'forum_id',
array('Post.discussion_id' => $id)
);

Thank you very much brian! Now this works for me...
Anyhow, I'd like to know how is it possible that the form indicated on
CakeBook doesn't work

LINK: http://book.cakephp.org/view/807/find-first
FUNCTION: $alsoLastCreated = $this->Article->find('first', array
('order' => array('Article.created DESC')));
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to obtain a number from a query that provides a COUNT

2009-08-16 Thread albe

I'd like to use Cake as Cake. The problem is that the find method
doesn't work for me and I've got no idea why this happens!
When I use it and I try to print the results I get errors of this
kind:

Notice: Undefined offset: 0 in C:\Program Files\...\model\datasources
\dbo_source.php on line 1283
Notice: Undefined offset: 0 in C:\Program Files\...\model\datasources
\dbo_source.php on line 1285

Do you have any clue?

On 8 Ago, 09:59, Walther  wrote:
> You shouldn't be using the Query method unless you are doing very very
> custom queries. Which your not.
>
> At the moment you have the overhead of CakePHP, but your not actually
> using the framework.
>
> I think you should read through the entire CakeBook (Again if you've
> already done so) and concentrate on the models section, all your
> answers are right there.
>
> On Aug 7, 11:15 am, albe  wrote:
>
> > I have found a solution in this way:
>
> > $post['Post']['haswarnings'] = count($this->Warning->query("SELECT  *
> > FROM `db`.`warnings` WHERE `post_id` ='".$post_id."'"));
>
> > Thank you, anyhow!
>
> > On 7 Ago, 01:32, albe  wrote:
>
> > > Hi everybody!
> > > maybe my problem is banal but I really don't know how to solve it:
>
> > > I wrote a query in a controller and put the result in a variable, in
> > > this way:
>
> > > $variable['Model']['field'] = ($this->Model2->query("SELECT COUNT
> > > ( * )...");
>
> > > The result of the query is something like this:
>
> > > Array
> > > (
> > >     [0] => Array
> > >         (
> > >             [0] => Array
> > >                 (
> > >                     [COUNT( * )] => 1
> > >                 )
>
> > >         )
>
> > > )
>
> > > Since I have to use this result in the relative view in order to make
> > > comparisons (if $variable.Model.field > 0) I need the PURE NUMBER,
> > > cleaned by the structure posted above.
> > > Otherwise the comparisons wouldn't be correct!
> > > Thank you in advance...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Translate Query into find

2009-08-16 Thread albe

UP

On 16 Ago, 11:55, albe  wrote:
> Hello everybody,
> I have this query:
>
> $_this_id = $this->Post->query("SELECT DISTINCT `forum_id` FROM
> `db`.`posts` WHERE `discussion_id` ='".$id."'");
>
> That gives me a result like this:
>
> Array
> (
>     [0] => Array
>         (
>             [posts] => Array
>                 (
>                     [forum_id] => 1
>                 )
>
>         )
>
> )
>
> But I want to obtain only the numeric result! (1)
>
> I've tried to use the find function in this way:
>
> $_this_id = $this->Post->find('first', array('conditions' =>array
> ('Post.discussion_id'=>$id), 'fields'=>array('Post.forum_id')));
>
> But when I try to print the result:
>
> pr($_this_id);
>
> I get a lot of errors of this kind:
>
> Notice: Undefined offset: 0 in C:\...\model\datasources\dbo_source.php
> on line 1283
>
> What is the reason?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Translate Query into find

2009-08-16 Thread albe

Hello everybody,
I have this query:

$_this_id = $this->Post->query("SELECT DISTINCT `forum_id` FROM
`db`.`posts` WHERE `discussion_id` ='".$id."'");

That gives me a result like this:

Array
(
[0] => Array
(
[posts] => Array
(
[forum_id] => 1
)

)

)

But I want to obtain only the numeric result! (1)

I've tried to use the find function in this way:

$_this_id = $this->Post->find('first', array('conditions' =>array
('Post.discussion_id'=>$id), 'fields'=>array('Post.forum_id')));

But when I try to print the result:

pr($_this_id);

I get a lot of errors of this kind:

Notice: Undefined offset: 0 in C:\...\model\datasources\dbo_source.php
on line 1283

What is the reason?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to obtain a number from a query that provides a COUNT

2009-08-07 Thread albe

I have found a solution in this way:

$post['Post']['haswarnings'] = count($this->Warning->query("SELECT  *
FROM `db`.`warnings` WHERE `post_id` ='".$post_id."'"));

Thank you, anyhow!

On 7 Ago, 01:32, albe  wrote:
> Hi everybody!
> maybe my problem is banal but I really don't know how to solve it:
>
> I wrote a query in a controller and put the result in a variable, in
> this way:
>
> $variable['Model']['field'] = ($this->Model2->query("SELECT COUNT
> ( * )...");
>
> The result of the query is something like this:
>
> Array
> (
>     [0] => Array
>         (
>             [0] => Array
>                 (
>                     [COUNT( * )] => 1
>                 )
>
>         )
>
> )
>
> Since I have to use this result in the relative view in order to make
> comparisons (if $variable.Model.field > 0) I need the PURE NUMBER,
> cleaned by the structure posted above.
> Otherwise the comparisons wouldn't be correct!
> Thank you in advance...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to obtain a number from a query that provides a COUNT

2009-08-07 Thread albe

The matter is a view of a forum site that has to show an alert for
every post that has been warned by one or more user.
I have a "posts" table and a "warnings" table. The warning table
contains (*user_id,*post_id,reason)
When the view shows all the posts of a discussion I want them to have
an alert beside if they have been warned.
The "function view" that permits to shows the posts contains a foreach
cycle, so I need to make the query each and every round of the cycle
to control the amount of the warnings for that specific post

foreach ($levels as $post_id) {
...
$post['Post']['haswarnings'] = ($this->Warning->query("SELECT COUNT
( * ) FROM `db`.`warnings` WHERE `post_id` ='".$post_id."'"));
...
}

How can I do otherwise?

On 7 Ago, 07:01, John Andersen  wrote:
> Hi,
>
> What are you trying to count? Can't you use the count method in the
> model class?
>
> Please show some more information on the SQL statement!
>
> Enjoy,
>    John
>
> On Aug 7, 2:32 am, albe  wrote:
>
> > Hi everybody!
> > maybe my problem is banal but I really don't know how to solve it:
>
> > I wrote a query in a controller and put the result in a variable, in
> > this way:
>
> > $variable['Model']['field'] = ($this->Model2->query("SELECT COUNT
> > ( * )...");
>
> > The result of the query is something like this:
>
> > Array
> > (
> >     [0] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [COUNT( * )] => 1
> >                 )
>
> >         )
>
> > )
>
> > Since I have to use this result in the relative view in order to make
> > comparisons (if $variable.Model.field > 0) I need the PURE NUMBER,
> > cleaned by the structure posted above.
> > Otherwise the comparisons wouldn't be correct!
> > Thank you in advance...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to obtain a number from a query that provides a COUNT

2009-08-06 Thread albe

Hi everybody!
maybe my problem is banal but I really don't know how to solve it:

I wrote a query in a controller and put the result in a variable, in
this way:

$variable['Model']['field'] = ($this->Model2->query("SELECT COUNT
( * )...");

The result of the query is something like this:

Array
(
[0] => Array
(
[0] => Array
(
[COUNT( * )] => 1
)

)

)

Since I have to use this result in the relative view in order to make
comparisons (if $variable.Model.field > 0) I need the PURE NUMBER,
cleaned by the structure posted above.
Otherwise the comparisons wouldn't be correct!
Thank you in advance...

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



Re: Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-21 Thread albe

Ok, at this point

http://book.cakephp.org/view/645/Acts-As-a-Requester

I've got to "add some groups and users using the baked forms" so I
type on my browser

http://localhost/simpleacl/groups/add

and I put the name of the group that I want to create on the form but
when I hit submit button I see:

"Please correct errors below."

right over the form... But I don't see any error...

On Apr 20, 4:44 pm, Jon Bennett  wrote:
> Hi Able,
>
> > The main problem is that, when I set the app folder's path with
>
> > cake bake project
>
> > it changes automatically few seconds after and it returns to be
>
> I'm not sure, I don't use bake or the console often, and have only had
> real success in a production environment, not locally.
>
> try without bake or the console, all you need is the DB tables set up,
> everything else can be done via the web.
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-20 Thread albe

The main problem is that, when I set the app folder's path with

cake bake project

it changes automatically few seconds after and it returns to be

...\cake\console (the default value).

How is it possible?!

On Apr 20, 1:58 pm, Jon Bennett  wrote:
> > Ok, I'm going to try to keep on with the tutorial.
> > Once I've created baked Models and Controllers, I've got to create the
> > views but which actions should I declare?
> > The tutorial simply doesn't tell that...
> >http://book.cakephp.org/view/642/Preparing-our-Application
>
> Why not work with an existing app? Eg, if you have the blog app
> working, apply ACL to the admin functions of that rather than start
> afresh.
>
> Cheers,
>
> Jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-20 Thread albe

Ok, I'm going to try to keep on with the tutorial.
Once I've created baked Models and Controllers, I've got to create the
views but which actions should I declare?
The tutorial simply doesn't tell that...
http://book.cakephp.org/view/642/Preparing-our-Application

On Apr 19, 8:47 pm, Jon Bennett  wrote:
> > Yes, I already tried the blogtutorialand all worked well and I can
> > use phpmyadmin correctly.
>
> Ok, sounds like a command line issue, are you able to use Bake
> successfully? I've been usingACLfor a quite a while now, and haven't
> had to touch the console at all, so perhaps just keep on with thetutorialon 
> the cake book.
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-19 Thread albe

Yes, I already tried the blog tutorial and all worked well and I can
use phpmyadmin correctly.

On Apr 19, 3:50 pm, Jon Bennett  wrote:
> Hi,
>
> This doesn't sound specific to ACL, more likely something screwy with
> your apache config (or at least the info you're giving it).
>
> Can you access cake and the db via the browser?
>
> hth
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-19 Thread albe

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



Simple acl tutorial (Class DATABASE_CONFIG) not found

2009-04-17 Thread albe

Hi,
I'm trying to follow the "Simple ACL" tutorial but I've got a problem
just after the database configuration with cake bake.
The steps I take are the following:

- I copy cake code in my htdocs directory
- I create a database with the 4 table just as wrote on the first page
of the tutorial
- I set the app/config/database.php file with the details of my db
- I launch cake console and it asks me for the path of the app
directory, so I write it
- the console asks me for a database configuration and I follow the
guided procedure to create it (I provide the same database name where
I've created the 4 tables)

after that I got this error:

Fatal error: Class 'DATABASE_CONFIG' not found in C:\Program Files
\Apache Softwa
re Foundation\Apache2.2\htdocs\simpleacl\cake\console\libs\tasks
\db_config.php o
n line 265

Why there's a reference to that file? My db configuration is on
another file (app/config/database.php)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe

I found the error! Andrade you were right...
I had "AllowOverride All" but I forgot to delete the # from the line:

LoadModule rewrite_module modules/mod_rewrite.so

Thank you everybody anyway ;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe

I found the webroot folder and it contains .htaccess.

On Mar 27, 10:59 am, albe  wrote:
> @ programguru:
>
> this is my posts_controller.php file, located in app/controllers
>
>  class PostsController extends AppController {
>
>         var $name = 'Posts';
>         function index() {
>                 $this->set('posts', $this->Post->find('all'));
>         }
>
> }
>
> ?>
>
> @ Marcelo Andrade:
>
> Yes, my httpd.conf file of Apache is set with AllowOverride All for the
> Directory  Foundation/Apache2.2/htdocs"> that is the location of my cakeblog directory.
> No, I can't see the home page of Cake with message in colours and I DON'T
> have a cakeblog/webroot folder (I only have .htaccess in cakeblog folder and
> in cakeblog/app)
>
> @ Brian:
>
> I get the same error if I point onhttp://localhost/cakeblog/posts/.
> --
> View this message in 
> context:http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727...
> Sent from the CakePHP mailing list archive at Nabble.com.

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



Re: Creating Post Views (Blog tutorial)

2009-03-27 Thread albe


@ programguru:

this is my posts_controller.php file, located in app/controllers


set('posts', $this->Post->find('all'));
}

}
?>


@ Marcelo Andrade:

Yes, my httpd.conf file of Apache is set with AllowOverride All for the
Directory  that is the location of my cakeblog directory.
No, I can't see the home page of Cake with message in colours and I DON'T
have a cakeblog/webroot folder (I only have .htaccess in cakeblog folder and
in cakeblog/app)

@ Brian:

I get the same error if I point on http://localhost/cakeblog/posts/.
-- 
View this message in context: 
http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727150p22738726.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Creating Post Views (Blog tutorial)

2009-03-26 Thread albe


Yes I can view my default page and it tells that the db configuration is
present and that cake is able to connect the db.

@ Hannible Lecter:

Yes, I got a 404 error. My .htaccess is the following



   RewriteEngine on
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]



is there something wrong?


programguru wrote:
> 
> 
> 
> can you view your default CakePHP page @ localhost/ ?
> -- 
> View this message in context:
> http://n2.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp2540235p2540881.html
> Sent from the CakePHP mailing list archive at Nabble.com.
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727150p22730905.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Creating Post Views (Blog tutorial)

2009-03-26 Thread albe


Hello everybody, I had a problem following the tutorial to build a blog on
the Cookbok. When is the 
http://book.cakephp.org/view/336/Creating-Post-Views MOMENT  to create the
View file, I exactly do what's written on the tutorial. I create a file
located in /app/views/posts/index.ctp and containing the code as written in
the code box (whithout any other tags...). The problem is that pointing the
browser at the address at http://localhost/cakeblog/posts/index the file
results NOT FOUND. Can someone help me? Thanks!
-- 
View this message in context: 
http://www.nabble.com/Creating-Post-Views-%28Blog-tutorial%29-tp22727150p22727150.html
Sent from the CakePHP mailing list archive at Nabble.com.


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