Re: related to Session-setFlash

2009-08-21 Thread Dr. Loboto

Yes.

On Aug 21, 8:53 am, kdubya kenwin...@winanstech.com wrote:
 On Aug 19, 9:01 am, zaboo adambartholo...@gmail.com wrote:

  Don't echo $this-Session-setFlash()

  On Aug 19, 8:27 am, Chander Bhan gotob...@gmail.com wrote:

   I always get the digit 1 in the next line of the message sent through
   Session-setFlash from controller, need help

 I don't understand this answer. I have been having the same problem
 (the number 1 being displayed on the line after the flash message).
 Here is the code snippet from my controller:

   function edit($id = null) {
     $this-set('schema', $this-Item-_schema);
     if (!$id  empty($this-data)) {
       $this-Session-setFlash(__('Invalid Item', true));
       $this-redirect(array('action'='index'));
     }

 And here is the code from the view:

 ?php echo $session-flash();?

 Are you saying that in the view the code should be:

 ?php $session-flash();?

 Is that correct?

 Thanks,
 Ken
--~--~-~--~~~---~--~~
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: Differing validation on add and edit methods

2009-08-21 Thread Bert Van den Brande

Hi,

what I do when updating User details without a password is simply
removing the validation in the controller before the model 'save'
method is called  :

unset($this-User-validate['password']);


Friendly greetings,
Bert

So by default I validate it,

On Fri, Aug 21, 2009 at 7:59 AM, DavidHdjhollingwo...@gmail.com wrote:

 Thinking about it further the use of 'on' = 'create' isn't going to
 do it for me because there will be a separate update facility. I guess
 I could

 1. Pass the password through the edit view in a hidden field, or
 2. When editing the user details (but not the password) get the
 current password from the database and inject it into the data, which
 I think would be much more secure than option 1

 I guess that would work. Then I can use the same validation in all
 cases.

 David

 On Aug 20, 8:17 pm, majna majna...@gmail.com wrote:
 You can set password validation only for 
 add:http://book.cakephp.org/view/127/One-Rule-Per-Field
 using 'on' = 'create', // or: 'update'

 Or hack like unset($this-Model-validate['password'] :)

 On Aug 20, 6:58 pm, DavidH djhollingwo...@gmail.com wrote:

  Hi

  Is there a simple way to do this? I have a UsersController and User
  method that does a dose of validation on the username and passwords
  fields (as per this excellent tutorialhttp://tinyurl.com/52robw).

  It works fine on the add; but when invoking the edit I don't want the
  users passwords to be updated (this will; be done through a separate
  view) and so I don't want any validation to fire for the password
  field.

  I saw that you can turn validation off in the save() method; but that
  seems to be for all fields. Is there a way to turn of validation on
  specific fields? Or do I have to write a customer validation method
  that recognises which action has been invoked?

  Cheers

  David
 


--~--~-~--~~~---~--~~
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: Dying on blank white page

2009-08-21 Thread Bert Van den Brande

I've had blank pages when :
* .htaccess was not working as it should, due to restrictions from
Apache (it needed Allow Overwrite All)
* a table was missing from the db, and the error couldn't be displayed
by Cake because it got into a recursion when trying to output the
message html (this is very project specific since we added some magic
stuff to /app/config/routes.php)

Still it's weird that all of a sudden it started working ... I'm
thinking along the line of a browser page cache that just showed you
the white page again instead of reloading the requested url ?

On Thu, Aug 20, 2009 at 10:00 PM, Arvindarvind.mai...@gmail.com wrote:

 It has started to work without doing anything moments ago. All i did,
 i decided to debug through dispatcher
 and before going into the dispatcher i decided to do some dies
 around
 to the dispatcher call in webroot/index.php file to make sure it goes
 into
 (which i had tested already; just wanted to double check it) it and
 after
 doing 2-3 dies around the code

        if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
                trigger_error(CakePHP core could not be found.  Check
 the value of
 CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
 the directory containing your  . DS . cake core directory and your
  . DS . vendors root directory., E_USER_ERROR);
        }
        if (isset($_GET['url'])  $_GET['url'] === 'favicon.ico') {
                return;
        } else {

                $Dispatcher = new Dispatcher();
                $Dispatcher-dispatch($url);
        }
        if (Configure::read()  0) {
                echo !--  . round(getMicrotime() - $TIME_START,
 4) . s --;
        }

 and it started to work all at once. And tmp/cache files also started
 to
 get
 generated! VERY STRANGE INDEED!!

 I think there must be something which i am missing. Please let me
 know if someone has faced this kind of problem. Some apache
 server problem? Cake hash validation problem? or caching problem?

 Please put your thoughts before cakephp ( which i love the most in
 frameworks ) starts to become a mystery to me. (I wish it were not a
 cakephp problem though)

 On Aug 21, 12:21 am, Arvind arvind.mai...@gmail.com wrote:
 Hi everyone,

 I uploaded my local controller files, view files and one css file to
 remote server 2 hrs ago and tried to access the site admin section but
 it is dying on blank white page without any debug report or any error
 displayed. The entire system is working fine on my local wamp server
 and also worked well on the same remote server yesterday but is not
 working right now. I have checked all files many a times and all files
 mentioned above are parallel to my local files with one exception. On
 the remote server there is no cache files being generated inside the
 app/tmp/cache folder which i noticed today only but i am sure it
 worked with same settings 1 day ago. I am trying to debug in webroot/
 index.php file and it is reaching till the dispatcher alright. I also
 tried by removing .htaccess but same problem with /webroot/index.php
 file. Mod rewrite is WORKING just fine.

 Not sure what is the problem. Anyone with thoughts on this is most
 welcome as i have already started to pull my hair.

 Here is the url where it is dying on blank page 
 :http://d1041638.blacknight.com/admin/users/login

 Thanks in advance,

 Arvind.
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Set containable vars in beforeFind() callback of model

2009-08-21 Thread Adrian

Hi

I am trying to set my contain array from within the models beforeFind
() callback so a certain model is always contained. I have the
following code:

function beforeFind($queryData) {
// Always contain the client user
if(empty($queryData['contain']['ClientUser'])) {
$queryData['contain']['ClientUser']['fields'] = array
('ClientUser.user_group_id');
}
return $queryData;
}

should this not work?

At the moment the find operations just ignore this.

Any ideas?
--~--~-~--~~~---~--~~
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: Set containable vars in beforeFind() callback of model

2009-08-21 Thread Adrian

Btw when I add debug($queryData); it confirms the contain array is
present:

app\models\ticket.php (line 175)

Array
(
[conditions] = Array
(
[Ticket.ticket_status] = New
)

[fields] = Array
(
[0] = Ticket.ticket_id
)

[joins] = Array
(
)

[limit] = 51
[offset] =
[order] = Array
(
[0] =
)

[page] = 1
[group] =
[callbacks] = 1
[contain] = Array
(
[ClientUser] = Array
(
[fields] = Array
(
[0] = ClientUser.user_group_id
)

)

)

)

But it is not taking effect in the sql:

Warning (512): SQL Error: 1054: Unknown column
'ClientUser.user_site_id' in 'where clause' [CORE\cake\libs\model
\datasources\dbo_source.php, line 525]

Query: SELECT `Ticket`.`ticket_id` FROM `tickets` AS `Ticket` WHERE
`Ticket`.`ticket_status` = 'New' AND
`Ticket`.`ticket_support_group_id` = 2 AND `Ticket`.`ticket_status` !=
'Deleted' AND ((`Ticket`.`ticket_client_group_id` = 84) AND
(`ClientUser`.`user_site_id` = 204) AND (((`Ticket`.`ticket_openedby`
= 1024) OR (`Ticket`.`ticket_client_user_id` = 1024 LIMIT 51
--~--~-~--~~~---~--~~
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: Set containable vars in beforeFind() callback of model

2009-08-21 Thread Adrian

Btw when I add debug($queryData); it confirms the contain array is
present:

app\models\ticket.php (line 175)

Array
(
[conditions] = Array
(
[Ticket.ticket_status] = New
)

[fields] = Array
(
[0] = Ticket.ticket_id
)

[joins] = Array
(
)

[limit] = 51
[offset] =
[order] = Array
(
[0] =
)

[page] = 1
[group] =
[callbacks] = 1
[contain] = Array
(
[ClientUser] = Array
(
[fields] = Array
(
[0] = ClientUser.user_group_id
)

)

)

)

But it is not taking effect in the sql:

Warning (512): SQL Error: 1054: Unknown column
'ClientUser.user_group_id' in 'where clause' [CORE\cake\libs\model
\datasources\dbo_source.php, line 525]

Query: SELECT `Ticket`.`ticket_id` FROM `tickets` AS `Ticket` WHERE
`Ticket`.`ticket_status` = 'New' AND
`Ticket`.`ticket_support_group_id` = 2 AND `Ticket`.`ticket_status` !=
'Deleted' AND ((`Ticket`.`ticket_client_group_id` = 84) AND
(`ClientUser`.`user_group_id` = 204) AND (((`Ticket`.`ticket_openedby`
= 1024) OR (`Ticket`.`ticket_client_user_id` = 1024 LIMIT 51

On 21 Aug, 09:24, Adrian gond...@gmail.com wrote:
 Hi

 I am trying to set my contain array from within the models beforeFind
 () callback so a certain model is always contained. I have the
 following code:

         function beforeFind($queryData) {
                 // Always contain the client user
                 if(empty($queryData['contain']['ClientUser'])) {
                         $queryData['contain']['ClientUser']['fields'] = array
 ('ClientUser.user_group_id');
                 }
                 return $queryData;
         }

 should this not work?

 At the moment the find operations just ignore this.

 Any ideas?
--~--~-~--~~~---~--~~
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: Inflector and compound names

2009-08-21 Thread jordicakephp

Thanks a lot, Dr. Loboto. :-) I've finally done your trick and it
works!

On 21 ago, 06:03, Dr. Loboto drlob...@gmail.com wrote:
 Looks like it is a bug in Inflector class. It perfectly singularize
 irregular plurals alone but cannot process them correctly when string
 which have other part.

 As workaround you can try split compound controller name, singularize
 last part and unite them again...

 On Aug 20, 4:48 pm, jordicakephp jordicake...@gmail.com wrote:



  Dr.Loboto, thanks a lot. :-D

  I've tried $irregularPlural = array ('uve' = 'uves'); but it doesnt'
  work, so I'm explaining my concrete situation so that we can see where
  the error is.

  I've programmed a generic view from wich I want to access the name of
  its associated model. If I am right, there's no field for the model's
  name in the view's information array, so I try to get this name in the
  following manner:

  [params][models][0] or Inflector::Singularize($this-name) ($this-name is 
  the controller associated to the view, in my case

  DiccionarioUves).

  But I allways get SedeUfe. Let's remember: my table's name's
  sede_uves, my controller's name's SedeUvesController, and, finally, my
  model's name's SedeUve.

  On the other hand, I've experimentally accessed the model's name of my
  view with

  $irregularPlural = array ('uve' = 'uves');

  and it only works if the table's name is uves. That is, if I
  undersand, this solution doesn't work for table compound names, such
  as sede_uves. What am I doing wrong? Thanks a googol! :-D

  On 20 ago, 10:40, Dr. Loboto drlob...@gmail.com wrote:

   $irregularPlural = array ('uve' = 'uves');

   On Aug 20, 12:10 am, jordicakephp jordicake...@gmail.com wrote:

Sorry...

Maybe I should have been even more specific (because of the language).
My table's name is sede_uves (the compound name), my controller's name
is SedeUvesController and my model's name is SedeUve. I would like to
define a rule for Cake to deduce SedeUve (the name of the model) from
sede_uves (the name of the table). Sorry again and thanks a lot.

On 19 ago, 19:06, jordicakephp jordicake...@gmail.com wrote:

 Good afternoon everybody,

 I'm trying to define a new rule of type singular-plural so that
 CakePHP joins magically the table and the model names that these rule
 refers to. More specifically, I go to inflections.php and write:

 $irregularPlural = array('sedeuve', 'sedeuves');

 But this doesn't work because my table, sede_uves, is a compound noun.
 I've worked before in this way, with simple nouns, and everything has
 gone ok, but now, with a compound name, this doesn't work... Could
 somebody give me a clue to solve this? Thanks a lot in advance! :-D- 
 Ocultar texto de la cita -

   - Mostrar texto de la cita -- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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 majna
Use recursion like this
http://bakery.cakephp.org/articles/view/threaded-lists

On Aug 21, 10:41 am, albe radialremo...@gmail.com 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
-~--~~~~--~~--~--~---



Re: Inflector and compound names

2009-08-21 Thread jordicakephp

By the way, should I do something special to communicate this
Inflector's behaviour?

On 21 ago, 10:55, jordicakephp jordicake...@gmail.com wrote:
 Thanks a lot, Dr. Loboto. :-) I've finally done your trick and it
 works!

 On 21 ago, 06:03, Dr. Loboto drlob...@gmail.com wrote:



  Looks like it is a bug in Inflector class. It perfectly singularize
  irregular plurals alone but cannot process them correctly when string
  which have other part.

  As workaround you can try split compound controller name, singularize
  last part and unite them again...

  On Aug 20, 4:48 pm, jordicakephp jordicake...@gmail.com wrote:

   Dr.Loboto, thanks a lot. :-D

   I've tried $irregularPlural = array ('uve' = 'uves'); but it doesnt'
   work, so I'm explaining my concrete situation so that we can see where
   the error is.

   I've programmed a generic view from wich I want to access the name of
   its associated model. If I am right, there's no field for the model's
   name in the view's information array, so I try to get this name in the
   following manner:

   [params][models][0] or Inflector::Singularize($this-name) ($this-name 
   is the controller associated to the view, in my case

   DiccionarioUves).

   But I allways get SedeUfe. Let's remember: my table's name's
   sede_uves, my controller's name's SedeUvesController, and, finally, my
   model's name's SedeUve.

   On the other hand, I've experimentally accessed the model's name of my
   view with

   $irregularPlural = array ('uve' = 'uves');

   and it only works if the table's name is uves. That is, if I
   undersand, this solution doesn't work for table compound names, such
   as sede_uves. What am I doing wrong? Thanks a googol! :-D

   On 20 ago, 10:40, Dr. Loboto drlob...@gmail.com wrote:

$irregularPlural = array ('uve' = 'uves');

On Aug 20, 12:10 am, jordicakephp jordicake...@gmail.com wrote:

 Sorry...

 Maybe I should have been even more specific (because of the language).
 My table's name is sede_uves (the compound name), my controller's name
 is SedeUvesController and my model's name is SedeUve. I would like to
 define a rule for Cake to deduce SedeUve (the name of the model) from
 sede_uves (the name of the table). Sorry again and thanks a lot.

 On 19 ago, 19:06, jordicakephp jordicake...@gmail.com wrote:

  Good afternoon everybody,

  I'm trying to define a new rule of type singular-plural so that
  CakePHP joins magically the table and the model names that these 
  rule
  refers to. More specifically, I go to inflections.php and write:

  $irregularPlural = array('sedeuve', 'sedeuves');

  But this doesn't work because my table, sede_uves, is a compound 
  noun.
  I've worked before in this way, with simple nouns, and everything 
  has
  gone ok, but now, with a compound name, this doesn't work... Could
  somebody give me a clue to solve this? Thanks a lot in advance! 
  :-D- Ocultar texto de la cita -

- Mostrar texto de la cita -- Ocultar texto de la cita -

  - Mostrar texto de la cita -- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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 rich...@home

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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

   On 20 ago, 15:39, albe radialremo...@gmail.com 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: Best way to pass parameter to application

2009-08-21 Thread simplesi



simplesi wrote:
 
 ... Just want to do it the proper CakePHP way :)
 
Having read more, I think the proper way is to read the parameter using
$this-params['pass'][0] in the controller view function and use that to
only select records for viewing for one particular school.

regards

Simon
-- 
View this message in context: 
http://www.nabble.com/Best-way-to-pass-parameter-to-application-tp25043152p25076126.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: Differing validation on add and edit methods

2009-08-21 Thread rich...@home

Jonathan Snook posted some very useful code to add this functionality:

http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/

Works like a charm :-)

On Aug 20, 5:58 pm, DavidH djhollingwo...@gmail.com wrote:
 Hi

 Is there a simple way to do this? I have a UsersController and User
 method that does a dose of validation on the username and passwords
 fields (as per this excellent tutorialhttp://tinyurl.com/52robw).

 It works fine on the add; but when invoking the edit I don't want the
 users passwords to be updated (this will; be done through a separate
 view) and so I don't want any validation to fire for the password
 field.

 I saw that you can turn validation off in the save() method; but that
 seems to be for all fields. Is there a way to turn of validation on
 specific fields? Or do I have to write a customer validation method
 that recognises which action has been invoked?

 Cheers

 David
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Paginate limit setting

2009-08-21 Thread leafchild

I have admin page (admin_view.ctp) and public page(view.ctp) in one
controller.

In admin page, I want to list 50 products in each page but in public
page, I want to show 8 products every page.
How can I set limit number for paginate to each function in same
controller??

I can't use var $paginate = array('limit' = 8); because this code
effect to admin_view page.



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



paking dropdown boxes

2009-08-21 Thread Sourabh

Hello Friends,

I am trying to bake a MVC using cake bake.

I have a form (add view) which looks like this when I bake it

name : []
address : []
country : []

for all the fileds it gives me input box.Now the country fields need
to be dropdown box  populated form DB table countries which has
country_name,id.

is there any way to achive thing using bake or we need to manually
code it ?

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: Dying on blank white page

2009-08-21 Thread rich...@home

Also worth remembering to clear the app/tmp directories (just the
files, leave the directory structures intact) when you upload

On Aug 21, 9:22 am, Bert Van den Brande cyr...@gmail.com wrote:
 I've had blank pages when :
 * .htaccess was not working as it should, due to restrictions from
 Apache (it needed Allow Overwrite All)
 * a table was missing from the db, and the error couldn't be displayed
 by Cake because it got into a recursion when trying to output the
 message html (this is very project specific since we added some magic
 stuff to /app/config/routes.php)

 Still it's weird that all of a sudden it started working ... I'm
 thinking along the line of a browser page cache that just showed you
 the white page again instead of reloading the requested url ?



 On Thu, Aug 20, 2009 at 10:00 PM, Arvindarvind.mai...@gmail.com wrote:

  It has started to work without doing anything moments ago. All i did,
  i decided to debug through dispatcher
  and before going into the dispatcher i decided to do some dies
  around
  to the dispatcher call in webroot/index.php file to make sure it goes
  into
  (which i had tested already; just wanted to double check it) it and
  after
  doing 2-3 dies around the code

         if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
                 trigger_error(CakePHP core could not be found.  Check
  the value of
  CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
  the directory containing your  . DS . cake core directory and your
   . DS . vendors root directory., E_USER_ERROR);
         }
         if (isset($_GET['url'])  $_GET['url'] === 'favicon.ico') {
                 return;
         } else {

                 $Dispatcher = new Dispatcher();
                 $Dispatcher-dispatch($url);
         }
         if (Configure::read()  0) {
                 echo !--  . round(getMicrotime() - $TIME_START,
  4) . s --;
         }

  and it started to work all at once. And tmp/cache files also started
  to
  get
  generated! VERY STRANGE INDEED!!

  I think there must be something which i am missing. Please let me
  know if someone has faced this kind of problem. Some apache
  server problem? Cake hash validation problem? or caching problem?

  Please put your thoughts before cakephp ( which i love the most in
  frameworks ) starts to become a mystery to me. (I wish it were not a
  cakephp problem though)

  On Aug 21, 12:21 am, Arvind arvind.mai...@gmail.com wrote:
  Hi everyone,

  I uploaded my local controller files, view files and one css file to
  remote server 2 hrs ago and tried to access the site admin section but
  it is dying on blank white page without any debug report or any error
  displayed. The entire system is working fine on my local wamp server
  and also worked well on the same remote server yesterday but is not
  working right now. I have checked all files many a times and all files
  mentioned above are parallel to my local files with one exception. On
  the remote server there is no cache files being generated inside the
  app/tmp/cache folder which i noticed today only but i am sure it
  worked with same settings 1 day ago. I am trying to debug in webroot/
  index.php file and it is reaching till the dispatcher alright. I also
  tried by removing .htaccess but same problem with /webroot/index.php
  file. Mod rewrite is WORKING just fine.

  Not sure what is the problem. Anyone with thoughts on this is most
  welcome as i have already started to pull my hair.

  Here is the url where it is dying on blank page 
  :http://d1041638.blacknight.com/admin/users/login

  Thanks in advance,

  Arvind.
--~--~-~--~~~---~--~~
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 majna...@gmail.com wrote:
 Use recursion like thishttp://bakery.cakephp.org/articles/view/threaded-lists

 On Aug 21, 10:41 am, albe radialremo...@gmail.com 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
-~--~~~~--~~--~--~---



Re: If-else within a foreach cycle

2009-08-21 Thread brian

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...@homerichardath...@gmail.com 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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

   On 20 ago, 15:39, albe radialremo...@gmail.com 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: Paginate limit setting

2009-08-21 Thread brian

Set the limit at 8 as normal and override it in the admin action:

$this-paginate['YOUR_MODEL']['limit'] = 50;

On Fri, Aug 21, 2009 at 5:30 AM, leafchildleafchild.b...@gmail.com wrote:

 I have admin page (admin_view.ctp) and public page(view.ctp) in one
 controller.

 In admin page, I want to list 50 products in each page but in public
 page, I want to show 8 products every page.
 How can I set limit number for paginate to each function in same
 controller??

 I can't use var $paginate = array('limit' = 8); because this code
 effect to admin_view page.



 


--~--~-~--~~~---~--~~
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: Inflector and compound names

2009-08-21 Thread jordicakephp

Hi again,

I've finally written this rule:

$singularRules = array('/ves$/i' = '\1ve');

And it also works perfectly. Thanks again!

On 21 ago, 06:03, Dr. Loboto drlob...@gmail.com wrote:
 Looks like it is a bug in Inflector class. It perfectly singularize
 irregular plurals alone but cannot process them correctly when string
 which have other part.

 As workaround you can try split compound controller name, singularize
 last part and unite them again...

 On Aug 20, 4:48 pm, jordicakephp jordicake...@gmail.com wrote:



  Dr.Loboto, thanks a lot. :-D

  I've tried $irregularPlural = array ('uve' = 'uves'); but it doesnt'
  work, so I'm explaining my concrete situation so that we can see where
  the error is.

  I've programmed a generic view from wich I want to access the name of
  its associated model. If I am right, there's no field for the model's
  name in the view's information array, so I try to get this name in the
  following manner:

  [params][models][0] or Inflector::Singularize($this-name) ($this-name is 
  the controller associated to the view, in my case

  DiccionarioUves).

  But I allways get SedeUfe. Let's remember: my table's name's
  sede_uves, my controller's name's SedeUvesController, and, finally, my
  model's name's SedeUve.

  On the other hand, I've experimentally accessed the model's name of my
  view with

  $irregularPlural = array ('uve' = 'uves');

  and it only works if the table's name is uves. That is, if I
  undersand, this solution doesn't work for table compound names, such
  as sede_uves. What am I doing wrong? Thanks a googol! :-D

  On 20 ago, 10:40, Dr. Loboto drlob...@gmail.com wrote:

   $irregularPlural = array ('uve' = 'uves');

   On Aug 20, 12:10 am, jordicakephp jordicake...@gmail.com wrote:

Sorry...

Maybe I should have been even more specific (because of the language).
My table's name is sede_uves (the compound name), my controller's name
is SedeUvesController and my model's name is SedeUve. I would like to
define a rule for Cake to deduce SedeUve (the name of the model) from
sede_uves (the name of the table). Sorry again and thanks a lot.

On 19 ago, 19:06, jordicakephp jordicake...@gmail.com wrote:

 Good afternoon everybody,

 I'm trying to define a new rule of type singular-plural so that
 CakePHP joins magically the table and the model names that these rule
 refers to. More specifically, I go to inflections.php and write:

 $irregularPlural = array('sedeuve', 'sedeuves');

 But this doesn't work because my table, sede_uves, is a compound noun.
 I've worked before in this way, with simple nouns, and everything has
 gone ok, but now, with a compound name, this doesn't work... Could
 somebody give me a clue to solve this? Thanks a lot in advance! :-D- 
 Ocultar texto de la cita -

   - Mostrar texto de la cita -- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Configure::read() fetch depth

2009-08-21 Thread geoff

Hey all. Maybe this solution is really simple, and I'm just not
getting it.

But I've noticed that when using Configure::read() with dot notation
(e.g.: Configure::read('level1.level2.level3')), it only seems to go
down three levels. However, Set::extract() can go multiple levels
down.

Is there a reason for Configure::read() only going down three levels?
It'd be nice to access levels lower down (e.g. fourth and fifth
levels).
--~--~-~--~~~---~--~~
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 delocalizer

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 bally.z...@gmail.com 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...@homerichardath...@gmail.com 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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

On 20 ago, 15:39, albe radialremo...@gmail.com 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-21 Thread brian

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, delocalizerconrad.leon...@hotmail.com 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 bally.z...@gmail.com 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...@homerichardath...@gmail.com 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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

On 20 ago, 15:39, albe radialremo...@gmail.com 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-21 Thread brian

Oops! I take that back. I just re-read the original post.

On Fri, Aug 21, 2009 at 7:55 AM, brianbally.z...@gmail.com 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, delocalizerconrad.leon...@hotmail.com 
 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 bally.z...@gmail.com 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...@homerichardath...@gmail.com 
 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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

On 20 ago, 15:39, albe radialremo...@gmail.com 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: Configure::read() fetch depth

2009-08-21 Thread brian

Use the source:

http://api.cakephp.org/view_source/configure/#line-326

It's hard-coded in the sense that there's a switch block that tests
the number of names provided. I have a feeling there's a really
elegant way to do this for unlimited names but i'm still on my first
cup of joe. So, i might still be dreaming.

On Fri, Aug 21, 2009 at 7:13 AM, geoffgarbet...@gmail.com wrote:

 Hey all. Maybe this solution is really simple, and I'm just not
 getting it.

 But I've noticed that when using Configure::read() with dot notation
 (e.g.: Configure::read('level1.level2.level3')), it only seems to go
 down three levels. However, Set::extract() can go multiple levels
 down.

 Is there a reason for Configure::read() only going down three levels?
 It'd be nice to access levels lower down (e.g. fourth and fifth
 levels).
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



containable behaviour in app_model

2009-08-21 Thread leo

Is there any reason why it wouldn't be a good idea to globally add
containable behaviour in app_model? viz:

class AppModel extends Model
{
var $actsAs = array('Containable');

It would certainly save time over slavishly adding it to every model.
--~--~-~--~~~---~--~~
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 bally.z...@gmail.com wrote:
 Oops! I take that back. I just re-read the original post.

 On Fri, Aug 21, 2009 at 7:55 AM, brianbally.z...@gmail.com 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, delocalizerconrad.leon...@hotmail.com 
  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 bally.z...@gmail.com 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...@homerichardath...@gmail.com 
  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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

 On 20 ago, 15:39, albe radialremo...@gmail.com 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-21 Thread brian

Right, so delocalizer's suggestion should work. You wouldn't even need
to do a find() first.

$this-Post-id = $var;
$this-Post-saveField('options', $value1);
$this-Post-updateAll(array('options'=value2),array('id '='$var));

On Fri, Aug 21, 2009 at 8:18 AM, alberadialremo...@gmail.com wrote:

 @ 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 bally.z...@gmail.com wrote:
 Oops! I take that back. I just re-read the original post.

 On Fri, Aug 21, 2009 at 7:55 AM, brianbally.z...@gmail.com 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, delocalizerconrad.leon...@hotmail.com 
  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 bally.z...@gmail.com 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...@homerichardath...@gmail.com 
  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 radialremo...@gmail.com 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 richardath...@gmail.com 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 andydawso...@gmail.com wrote:

 On 20 ago, 15:39, albe radialremo...@gmail.com 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: containable behaviour in app_model

2009-08-21 Thread leop

If there's no significant overhead, it makes me wonder why it isn't
there by default.

On Aug 21, 1:53 pm, Bert Van den Brande cyr...@gmail.com wrote:
 Can't think of any reason :)

 On Fri, Aug 21, 2009 at 2:16 PM, leoponton@gmail.com wrote:

  Is there any reason why it wouldn't be a good idea to globally add
  containable behaviour in app_model? viz:

  class AppModel extends Model
  {
     var $actsAs = array('Containable');

  It would certainly save time over slavishly adding it to every model.
--~--~-~--~~~---~--~~
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: Retaining URL parameters on failed validation

2009-08-21 Thread foldiman

Here's a blog post on exactly this subject.

http://foldifoldi.com/news/?p=352

You can also see the comment about the $this-params['url']['url']
entry

On Aug 20, 5:12 pm, Jamie jamie@gmail.com wrote:
 Oops, you're right - I don't. ;) At least, not until yesterday, and
 now I have a bug report sitting in my inbox that a contact form is
 exhibiting the same action URL error that Carl describes.

 But yeah, sticking the forward slash before $this-params['url'][url']
 works just fine.

 On Aug 20, 8:37 am, AD7six andydawso...@gmail.com wrote:

  You evidently never develop withhttp://domain/project/in/a/subfolder
  ;)

  if you're athttp://localhost/myapp/foo/bar/fum

  $this-here is 'myapp/foo/bar/fum
  $this-params['url']['url'] is foo/bar/fum

  (or similar)

  It was a minor oversight that the url param doesn't have a / prefix

  I use/meant to say '/' . $this-params['url']['url']

  AD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fulltext and Order By

2009-08-21 Thread Shaun

I would like to edit the following MySQL statement to use CakePHP
conventions:

SELECT *,
  MATCH(movie_title) AGAINST('$keywords') AS score
  FROM movies
  WHERE MATCH(movie_title) AGAINST('$keywords')
  ORDER BY score DESC, movie_year DESC

The idea is to order the movies by search relevancy, but when there is
a Hollywood remake of an old movie (same title, same relevancy), the
newer movie should appear above the older movie, sorted by movie_year
DESC.

I have a model called Movie.  As of now, the database is being queried
like this:

$conditions = array(MATCH(Movie.movie_name) AGAINST('$keywords'));
$matches = $this-Movie-find('all', array('conditions' =
$conditions));
$this-set('movies', $matches);

The results are ordered by the fulltext relevancy, but how can I order
by both fulltext relevancy and movie year?  I'm not sure how to assign
the fulltext results to a fake field called score.  Thanks.
--~--~-~--~~~---~--~~
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: containable behaviour in app_model

2009-08-21 Thread Bert Van den Brande

Can't think of any reason :)

On Fri, Aug 21, 2009 at 2:16 PM, leoponton@gmail.com wrote:

 Is there any reason why it wouldn't be a good idea to globally add
 containable behaviour in app_model? viz:

 class AppModel extends Model
 {
    var $actsAs = array('Containable');

 It would certainly save time over slavishly adding it to every model.
 


--~--~-~--~~~---~--~~
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: Configure::read() fetch depth

2009-08-21 Thread geoff

I have done a way before, but it involved a little bit of eval(),
which I've heard isn't all that efficient. And considering the
Configure::read() method is used a fair amount, efficiency would
probably be a good idea.

For some reason, I've also tried replacing the current setup with a
Set::extract($name, $_this); within the method, but (I think) a fatal
error was generated (script halted, and there was no output - so I
assumed it was fatal). If only it was as simple as a Set::extract
(); :)

On Aug 21, 2:01 pm, brian bally.z...@gmail.com wrote:
 Use the source:

 http://api.cakephp.org/view_source/configure/#line-326

 It's hard-coded in the sense that there's a switch block that tests
 the number of names provided. I have a feeling there's a really
 elegant way to do this for unlimited names but i'm still on my first
 cup of joe. So, i might still be dreaming.

 On Fri, Aug 21, 2009 at 7:13 AM, geoffgarbet...@gmail.com wrote:

  Hey all. Maybe this solution is really simple, and I'm just not
  getting it.

  But I've noticed that when using Configure::read() with dot notation
  (e.g.: Configure::read('level1.level2.level3')), it only seems to go
  down three levels. However, Set::extract() can go multiple levels
  down.

  Is there a reason for Configure::read() only going down three levels?
  It'd be nice to access levels lower down (e.g. fourth and fifth
  levels).
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



array from query() call

2009-08-21 Thread dycokac

I would like to gain better control/understanding of formatting the
returned array from the query() method.

I have thought of a few ways around this but can't quite figure out
how to run something like a mysql_query and then mysql_fetch_array
procedure to make my own array. I'm stuck at how to get the database
connection from cake.

I'm looking to get an associative array where the primary key column
of my table is the key of my associative array and a second field from
the table is the value for each array position. Then I can use this
array to get at my name in my view.

I haven't found a good resource yet to help me understand if it's
possible to control the resulting array from a query() call or how to
better link in those queries to get all I want out of it.

Thanks for any help I receive.

--~--~-~--~~~---~--~~
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: Add input field with jquery

2009-08-21 Thread Luke

Hi brian,

excellent, thank you for your help. I got it to work. It is slightly
different but your answer got me on the right route. Thank you again.

Luke


--~--~-~--~~~---~--~~
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: array from query() call

2009-08-21 Thread MattyHead

Can you describe how you'd like your data to look?

And (not being a troll, I swear) may I ask why you're not just calling
to the proper model and unbinding as necessary to slim down the
'width' of the result set?

M
On Fri, Aug 21, 2009 at 9:46 AM, dycokacwrigh...@gmail.com wrote:

 I would like to gain better control/understanding of formatting the
 returned array from the query() method.

 I have thought of a few ways around this but can't quite figure out
 how to run something like a mysql_query and then mysql_fetch_array
 procedure to make my own array. I'm stuck at how to get the database
 connection from cake.

 I'm looking to get an associative array where the primary key column
 of my table is the key of my associative array and a second field from
 the table is the value for each array position. Then I can use this
 array to get at my name in my view.

 I haven't found a good resource yet to help me understand if it's
 possible to control the resulting array from a query() call or how to
 better link in those queries to get all I want out of it.

 Thanks for any help I receive.

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Profiling cakePHP: performance issues with plugin view render logic, possible bug?

2009-08-21 Thread majna

On plain cakePHP 1.2.3.8166 installation with only one dummy pizza
plugin,
View class seeks view and element files on strange places.

Output of $path variable in View::_paths()
Array
(
[0] = C:\AppServ\cake\app\views\plugins\pizza\
[1] = C:\AppServ\cake\cake\libs\view\plugins\pizza\
[2] = C:\AppServ\cake\app\plugins\pizza\views\
[3] = C:\AppServ\cake\app\views\
[4] = C:\AppServ\cake\cake\libs\view\
)

I can se many file_exists() in View class when profiling cake with
xdebug,
and I think this could be improved much.

Cake will seek foreach above path when rendering view or element.

Snippet form View::element() method:
foreach ($paths as $path) {
if (file_exists($path . 'elements' . DS . $name . $this-ext)) {
$file = $path . 'elements' . DS . $name . $this-ext;
break;
} elseif (file_exists($path . 'elements' . DS . $name . '.thtml'))
{
$file = $path . 'elements' . DS . $name . '.thtml';
break;
}
}

Snippet form View::_getViewFileName() method:
foreach ($paths as $path) {
if (file_exists($path . $name . $this-ext)) {
return $path . $name . $this-ext;
} elseif (file_exists($path . $name . '.ctp')) {
return $path . $name . '.ctp';
} elseif (file_exists($path . $name . '.thtml')) {
return $path . $name . '.thtml';
}
}

Snippet form View::_getLayoutFileName() method:
$exts = array($this-ext, '.ctp', '.thtml');
foreach ($paths as $path) {
foreach ($exts as $ext) {
if (file_exists($path . $file . $ext)) {
return $path . $file . $ext;
}
}
}


My conclusion:
1. As you can see from snippets above, there will be many failed
file_exists() calls.
2. Something is wrong with path order from which cake seeks files (see
Output of $path from above). First two paths are strange.Is it a bug?
3. thtml extension should be deprecated for performance improvement
(I/O)

Consider following scenario:
Pizza plugin has it's own layout and index view with 3 elements:
Cake will find:
-  index view on 7th attempt!
- layout on 5th attempt
- first element on 5th attempt
- second element on 5th attempt
- third element on 5th attempt

SUM= 22 failed file_exist, only for one view render
If you setup additional view paths in Configure (bootstap $viewPaths
array), things got even worse.(Many CMS apps do that)

This file seeking takes most of View render process time (xdebug)
I'm not sure if this calculations are correct, please correct me.
Other files (controller, models, helpers) are cached (paths) once
found by App::import,
so I  thnik that view rendering logic is far from optimal.


PS:
Option to extend requestAction or at least have some callback
beforeRequestAction() would be very nice.






--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



sanitize and echoing in html

2009-08-21 Thread ezekfred

Hello,

I'm having some issues with my views.

add.ctp: echo $form-input('theanswer');
view.ctp: echo $data['theanswer'];

in my database theanswer is a TEXT field

I just want to allow people make use of carriage return,
I want to display these CR in view.ctp and index.ctp
but I don't want them to write scripts like scriptalert
(EXPLETIVES!!!)/script

I've tried to sanitize::clean the input, to sanitize::html the output
but I'm unable to get an output like that:
Line1
Line2


Has anyone an idea?

thanks for your help!
--~--~-~--~~~---~--~~
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: saveAll with a hasMany relationship

2009-08-21 Thread Luke

Hi Nancy,

I had the same issue like you are describing, how to save the
hasMany after positing it on here, I found the solution.

I have a recipe hasMany Ingredient relationship, the importance is to
have the array formated in the right way. It needs to look like below,
than it will work.

 [Recipe] = Array
(
[recipe_name] = Champions
[Rezeptportion] = 2
)

[Ingredient] = Array
(
[0] = Array
(
[ingredientname] = Champions
)

[1] = Array
(
[ingredientname] = pepper
)

Try this out and let me know if you struggle, maybe we find an answer.


Luke

--~--~-~--~~~---~--~~
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 menu

2009-08-21 Thread dhiraj ray

i want to add menu layout

--~--~-~--~~~---~--~~
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: Ubdate HABTM and hasMany

2009-08-21 Thread Luke

Hi delocalizer,

Thank you very much for your hint. You are absolutley right, I had an
issue with the set up of the array. I now got it all to work, finally
after 2 weeks I have to say.
So for everyone who got the same problem, the array for the hasMany
needs to look like this:

 [Recipe] = Array
(
[recipe_name] = Champions
[Rezeptportion] = 2
)

[Ingredient] = Array
(
[0] = Array
(
[ingredientname] = Champions
)

[1] = Array
(
[ingredientname] = pepper
)

Thank you very much again for your help.

Luke

--~--~-~--~~~---~--~~
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: sanitize and echoing in html

2009-08-21 Thread euromark (munich)

always the same^^

no sanitizing neccessary
just use h($var) in the view

and for textareas
nl2br(h($var))

thats all


On 21 Aug., 16:55, ezekfred ezekf...@wanadoo.fr wrote:
 Hello,

 I'm having some issues with my views.

 add.ctp: echo $form-input('theanswer');
 view.ctp: echo $data['theanswer'];

 in my database theanswer is a TEXT field

 I just want to allow people make use of carriage return,
 I want to display these CR in view.ctp and index.ctp
 but I don't want them to write scripts like scriptalert
 (EXPLETIVES!!!)/script

 I've tried to sanitize::clean the input, to sanitize::html the output
 but I'm unable to get an output like that:
 Line1
 Line2
 

 Has anyone an idea?

 thanks for your help!
--~--~-~--~~~---~--~~
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 add menu

2009-08-21 Thread brian

I want a pony. But, for a menu, you'd probably want to use an element.
Create file:

app/views/elements/menu.ctp

In your layout:

echo $this-element('menu');

http://api.cakephp.org/class/view#method-Viewelement

There are a lot of different ways to do this with Cake.
http://www.google.com/search?q=cakephp+menu

On Fri, Aug 21, 2009 at 6:09 AM, dhiraj raydhiraj.r...@gmail.com wrote:

 i want to add menu layout

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SSL in cake1.1

2009-08-21 Thread MattyHead

How is pushing users into and out of SSL traditionally handled in
cakephp 1.1?  I'm working on someone else's codebase (thus, 1.1) -- a
shop with no provision for SSL routing written in.  I found, modified,
and used a component to force actions into and out of SSL.  It seems a
slightly imperfect in my mind because, currently, a link that will
land you on an SSL encrypted page from an unencrypted one doesn't
indicate SSL (so the link is '/login/', and if you're on 80, you get
pushed into 433 -- this would happen to break a post submission, but
that shouldn't be an issue, because who'd want to submit from 80 to
433 anyway?).  Anyway, I was considering something like a wrapper
around the HTML helper so that $html-link() could be told to write as
SSLon or somesuch.  My thinking is that handling this with both
accurately written links and server-side enforcement would be the best
way to go, but I haven't actually seen something like that done, so I
thought I'd solicit some feedback...

thoughts?

Matt

--~--~-~--~~~---~--~~
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 add menu

2009-08-21 Thread Robert P

Congratulations, have a cookie and go and play in the corner.

Oh, and read http://book.cakephp.org/

Help requires more information.

On Aug 21, 6:09 pm, dhiraj ray dhiraj.r...@gmail.com wrote:
 i want to add menu layout
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake getting slower

2009-08-21 Thread abc

Our original cake framework was alpha. We ported the framework to 1.2.
Our design is MVC.


We are see significant performance downgrade. Operations that took 22
milliseconds are taking 122 milliseconds. This comparison is on the
same machine (all care is taken the comparison is right).


Can anybody please tell us should we do any changes to our code to
make things faster. All pointers appreciated.

Thank you
sudhir

--~--~-~--~~~---~--~~
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: containable behaviour in app_model

2009-08-21 Thread Jon Bennett

On Friday, August 21, 2009, leop ponton@gmail.com wrote:

 If there's no significant overhead, it makes me wonder why it isn't
 there by default.

I get a fair few comments from php devs who like to it all themselves
that cake does and assumes too


 On Aug 21, 1:53 pm, Bert Van den Brande cyr...@gmail.com wrote:
 Can't think of any reason :)

 On Fri, Aug 21, 2009 at 2:16 PM, leoponton@gmail.com wrote:

  Is there any reason why it wouldn't be a good idea to globally add
  containable behaviour in app_model? viz:

  class AppModel extends Model
  {
     var $actsAs = array('Containable');

  It would certainly save time over slavishly adding it to every model.
 


-- 

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: containable behaviour in app_model

2009-08-21 Thread Jon Bennett

Bloody iPhone! Wasn't even going to send that!!

Sorry for the noise :)

j

On Friday, August 21, 2009, Jon Bennett jmbenn...@gmail.com wrote:
 On Friday, August 21, 2009, leop ponton@gmail.com wrote:

 If there's no significant overhead, it makes me wonder why it isn't
 there by default.

 I get a fair few comments from php devs who like to it all themselves
 that cake does and assumes too


 On Aug 21, 1:53 pm, Bert Van den Brande cyr...@gmail.com wrote:
 Can't think of any reason :)

 On Fri, Aug 21, 2009 at 2:16 PM, leoponton@gmail.com wrote:

  Is there any reason why it wouldn't be a good idea to globally add
  containable behaviour in app_model? viz:

  class AppModel extends Model
  {
     var $actsAs = array('Containable');

  It would certainly save time over slavishly adding it to every model.
 


 --

 jon bennett
 w: http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett


-- 

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
-~--~~~~--~~--~--~---



Class and Model Naming Problems (wave becomes wafe)

2009-08-21 Thread JDRopp

I've just started working with Cake and have been impressed so far.

I've created:
A table called waves
A model class called wave (wave.php)
A controller class called WavesController (waves_controller.php)

Somehow wave turns into wafe when SQL is generated.  For example:
Nr  Query   Error   AffectedNum. rows   Took (ms)
1   DESCRIBE `waves`3   3   38
2   SELECT COUNT(*) AS `count` FROM `waves` AS `Wafe` WHERE `Wafe`.`id`
= 1 1   1   0
3   SELECT `Wafe`.`id`, `Wafe`.`name`, `Wafe`.`deployment_date` FROM
`waves` AS `Wafe` WHERE `Wafe`.`id` = 1 LIMIT 1 1   1   0

Any idea what's going on here?  I've searched and found no wafe
typos in my code.

Thanks!
Jeff

--~--~-~--~~~---~--~~
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: Cake getting slower

2009-08-21 Thread Marcelo Andrade

On Fri, Aug 21, 2009 at 2:35 PM, abcsudmo...@gmail.com wrote:

 We are see significant performance downgrade. Operations that took 22
 milliseconds are taking 122 milliseconds. This comparison is on the
 same machine (all care is taken the comparison is right).

 Can anybody please tell us should we do any changes to our code to
 make things faster. All pointers appreciated.

There are some usefull tips here.  I hope it helps:

http://www.pseudocoder.com/archives/2009/03/17/8-ways-to-speed-up-cakephp-apps/

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.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
-~--~~~~--~~--~--~---



Auth doesn't hash password field

2009-08-21 Thread Veoempleo

Hello,

I have a very simple form with username, name and password fields. But
the Auth component is saving the password field without hashing it.

Why? Thank you in advantage
--~--~-~--~~~---~--~~
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: Class and Model Naming Problems (wave becomes wafe)

2009-08-21 Thread JDRopp

Thanks Marcelo for pointing to the relevant code.

I decided to change the model, table, and controller names instead.

I'll submit the defect to Cake.


On Aug 21, 12:01 pm, Marcelo Andrade mfandr...@gmail.com wrote:
 On Fri, Aug 21, 2009 at 3:21 PM, JDRoppjeffreyr...@gmail.com wrote:

  I've just started working with Cake and have been impressed so far.

  I've created:
  A table called waves
  A model class called wave (wave.php)
  A controller class called WavesController (waves_controller.php)

  Somehow wave turns into wafe when SQL is generated.  For example:
  Nr      Query   Error   Affected        Num. rows       Took (ms)
  1       DESCRIBE `waves`                3       3       38
  2       SELECT COUNT(*) AS `count` FROM `waves` AS `Wafe` WHERE `Wafe`.`id`
  = 1             1       1       0
  3       SELECT `Wafe`.`id`, `Wafe`.`name`, `Wafe`.`deployment_date` FROM
  `waves` AS `Wafe` WHERE `Wafe`.`id` = 1 LIMIT 1         1       1       0

  Any idea what's going on here?  I've searched and found no wafe
  typos in my code.

 Not sure, but It seems like a bug in inflector.

 Try to add wave/waves to the $irregularPlurals at app/config/inflector.php

 If it not works, I'm afraid you'll have to define the $useTable = 'waves'; in
 your Wave model.

 Best regards.

 --
 MARCELO DE F. ANDRADE
 Belem, PA, Amazonia, Brazil
 Linux User #221105

 http://mfandrade.wordpress.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
-~--~~~~--~~--~--~---



Scaffolding and Model Relationships

2009-08-21 Thread JDRopp

Is there a limitation of scaffolding that impacts the related
sections presented?

For example:
applications application_roles   roles
-    
id id   id
name   application_id  name
   role_id

I've defined the relationships appropriately:
1) applications has many application roles
2) applications_roles belongs to applications
3) applications_roles belongs to roles
4) roles has many application roles

When viewing an application, a Related Application Roles section is
created that shows the appropriate rows in the application_roles
table.  BUT, it only shows role_id which doesn't have any meaning to
a user.

The documentation suggests that you can use $display_field but this
seems to have no effect (it only is used on the view of application
roles).

Is this a known limitation or is there something else to configure?

Many thanks for your thoughts.
Jeff

--~--~-~--~~~---~--~~
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: Cake getting slower

2009-08-21 Thread KK

  Can anybody please tell us should we do any changes to our code to
  make things faster. All pointers appreciated.

 There are some usefull tips here.  I hope it helps:

 http://www.pseudocoder.com/archives/2009/03/17/8-ways-to-speed-up-cak...


I intended to rewrite 1.1.8 to 1.2 to gain higher performance, and I
saw this post :/
My hosting provider blocked my account yesterday for making high load
- site has about 1400 UU :/ and no chance to cache views (scoring
photos by users clears all cache :/ )

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Please help - 3rd time trying to post - Why is knownusers from IBM tutorial not working?

2009-08-21 Thread winegoddess

Hello, I am not sure why my messages are not getting through.

I have a question regarding the IBM tutorial
http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake2/section2.html

My knownusers page is not working.
I get a message that
The first argument should be an array [APP\views\users\knownusers.ctp,
line 3]

I have several records in the users table.

Here are my files:


VIEW (knownusers.ctp)
table
?php echo $html-tableHeaders(array_keys($knownusers[0]['User']));
foreach ($knownusers as $thisuser){
 echo $html-tableCells($thisuser['User']);
}

?
/table

MODEL:

?php
class User extends AppModel
{
var $name = 'User';

 var $validate = array(
'first_name' = array(

 'ruleName2' = array(
 'rule' = 'alphaNumeric',
 'required' = true,
 'message' = 'You must enter a 
first name using letters only.'
)
 ),

'last_name' = array(
'ruleName' = array(
'rule' = '/^.{1,40}$/',
 'message' = 'Please enter a 
first name between 1 and 40
characters.'
),
'ruleName2' = array(
 'rule' = 'alphaNumeric',
 'required' = true,
 'message' = 'You must enter a first 
name.'
)

),
   'username' = array(
 'ruleName' = array(
 'rule' = '/^.{6,40}$/',
 'message' = 'Please enter a 
username between 6 and 40
characters.'
),
 'ruleName2' = array(
 'rule' = 'isUnique',
'message' = 'This username has 
already been taken.'
)
 ),

   'password' = array (
'rule' = '/^.{6,40}$/',
 'message' = 'Please enter a 
password between 6 and 40
characters.'
),
'email' = array('rule' = 'email',
 'message' = 'Please 
enter a valid email address.'
),

  );



}
?


CONTROLLER  (truncated)

?php
class UsersController extends AppController
{

var $name = 'Users';


var $helpers = array('Html', 'Form' );

.
.
.


 function knownusers()
{
$this-set('knownusers', $this-User-findAll(null,
array('id', 'username', 'first_name', 'last_name'), 'id 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: Certain strings crashing CakePHP - where do I look first?

2009-08-21 Thread technicaltitch

You are such stars for helping me with this - its incredible thank you
so much!

I tried the new redirect method but got errors (missing arguments for
AppController::redirect(), $status and $exit undefined) when I tried
to log in, as this involved a redirect to the login form, so I logged
in and then copied across the redirect override - to no avail - when I
save the changes it redirects to the homepage, which contains no hint
of the error. Also got the site working locally (was my PHP version
thanks so much AD7six) - and can't repeat the defect. Do these point
to Apache or PHP as the cause?

I tried disabling mod_security using:
IfModule mod_security.c
SecFilterEngine Off
SecFilterScanPOST Off
/IfModule
in every .htaccess file in my site, but it didn't make any difference
(I sanitize everything, and it can't be this as it doesn't happen
locally - unless it could be that local is Windows and host is Linux -
seems very unlikely).

I'd really appreciate any tips if anything's obvious about resolving
the redirect override - or does the fact that it works locally mean
this is unlikely to reveal anything?

Tried creating a test subdirectory but suspected it wouldn't work - I
get a 500 error probably related to my non-standard directory layout
(so that my cake and app directories are outside my public_html
directory - seemed safer).

My reason for another site is in case the forum software has somehow
added this filtering site-wide - it seems to be a server setting, (its
only $11). I do get this error when I try the text in any table in the
system (including tables that are nothing to do with tinyMCE and very
little to do with the rest of the code). Will try baking an unrelated
table to see if I can repeat it there but I very much expect to as it
seems platform related.

As far as I can tell, I don't have access to PHP settings - just
CPanel on a shared hosting platform.

Am I right in suspecting Apache or PHP? If so any ideas where I can
look? I can't find anything likely by googling filters for either.
Does Cake automatically use certain PHP filters on all POST and GET
submissions or something?

Thanks HUGELY, I'll be so incredibly happy when I/we crack this
Chris/tt



On Aug 18, 5:11 pm, Brendon Kozlowski (Realm)
brendon...@hotmail.com wrote:
 I like archF6's suggestion, it's easy to test, and if it doesn't solve
 it, continue from there.  It might work, it might not.  I don't think
 a 500 server error would automatically redirect (but instead stop
 execution).  Regardless, it's about a 20 second test.  With Dreamhost
 I can enable/disable mod_security, I'm not sure if you would be able
 to test that on your host or not.  To be clear - I don't know why
 mod_security would mess with this, but it can't hurt to take a look if
 you're able to make such changes.

 On Aug 17, 11:23 am, technicaltitch technicalti...@gmail.com wrote:



  App was built Oct 2007 but it's taken the organization this long to
  find funding for someone to test and work on it, (hence I'm struggling
  to get my head round stuff again).

  I will have a go at creating a test subdirectory and adding that debug
  code- fantastic fantastic ideas thanks - probably blindingly obvious
  to PHPers but not to me (a decade working with C, Java and .NET but
  only ever used PHP on volunteer projects).

  Is it possible that a phpBB install may have had this as a side-
  effect? Ie, can filters be set up on all form input for a given space
  on a shared CPanel server?

  I have commented out my controller method and seen the error, so I'm
  assuming the redirect is called elsewhere, where do I put the redirect
  override code pls?

  As far as I can tell it isn't my code requesting the redirect but
  perhaps I'm missing something obvious? I commented out my controller
  method, route.php just has the default page specified. Tried debug
  level 1 and 2 and nothing is displayed about the error, or anything
  preceding the current page.

  Thanks SO much for your help - this is all so useful and despite my
  wandering off-subject, absolutely exactly how I hoped people would
  help me and I'm massively grateful,
  Chris
--~--~-~--~~~---~--~~
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: Please help - 3rd time trying to post - Why is knownusers from IBM tutorial not working?

2009-08-21 Thread Sam Sherlock
no longer findAll use find('all')
http://book.cakephp.org/view/449/find
- S


2009/8/21 winegoddess winegodd...@gmail.com


 Hello, I am not sure why my messages are not getting through.

 I have a question regarding the IBM tutorial

 http://www.ibm.com/developerworks/opensource/tutorials/os-php-cake2/section2.html

 My knownusers page is not working.
 I get a message that
 The first argument should be an array [APP\views\users\knownusers.ctp,
 line 3]

 I have several records in the users table.

 Here are my files:


 VIEW (knownusers.ctp)
 table
 ?php echo $html-tableHeaders(array_keys($knownusers[0]['User']));
 foreach ($knownusers as $thisuser){
  echo $html-tableCells($thisuser['User']);
 }

 ?
 /table

 MODEL:

 ?php
 class User extends AppModel
 {
var $name = 'User';

 var $validate = array(
'first_name' = array(

 'ruleName2' = array(
 'rule' = 'alphaNumeric',
 'required' = true,
 'message' = 'You must
 enter a first name using letters only.'
)
 ),

'last_name' = array(
'ruleName' = array(
'rule' = '/^.{1,40}$/',
 'message' = 'Please enter
 a first name between 1 and 40
 characters.'
),
'ruleName2' = array(
 'rule' = 'alphaNumeric',
 'required' = true,
 'message' = 'You must enter a
 first name.'
)

),
   'username' = array(
 'ruleName' = array(
 'rule' = '/^.{6,40}$/',
 'message' = 'Please enter
 a username between 6 and 40
 characters.'
),
 'ruleName2' = array(
 'rule' = 'isUnique',
'message' = 'This username
 has already been taken.'
)
 ),

   'password' = array (
'rule' = '/^.{6,40}$/',
 'message' = 'Please enter
 a password between 6 and 40
 characters.'
),
'email' = array('rule' = 'email',
 'message' =
 'Please enter a valid email address.'
),

  );



 }
 ?


 CONTROLLER  (truncated)

 ?php
 class UsersController extends AppController
 {

 var $name = 'Users';


 var $helpers = array('Html', 'Form' );

 .
 .
 .


  function knownusers()
{
 $this-set('knownusers', $this-User-findAll(null,
array('id', 'username', 'first_name', 'last_name'), 'id
 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: Certain strings crashing CakePHP - where do I look first?

2009-08-21 Thread technicaltitch

Sorry for my lack of clarity - simple version:

The redirect override caused errors, but didn't seem to be called when
I repeated the error anyway - I get a completely normal homepage
rather than a Save confirmation when I save anything with any field
containing http://geocities.com/

Same code locally does not exhibit this error - only difference is
MySQL version, that its Windows-based, and the server configuration.

Disabling mod_security did not solve the error.

Test subdirectory under public_html returned a 500 error.

Unrelated tables in the system still exhibit the error.

Does this point to Apache or PHP? And if so any diagnosis ideas?

THANK YOU ALL!

On Aug 22, 12:57 am, technicaltitch technicalti...@gmail.com wrote:
 You are such stars for helping me with this - its incredible thank you
 so much!

 I tried the new redirect method but got errors (missing arguments for
 AppController::redirect(), $status and $exit undefined) when I tried
 to log in, as this involved a redirect to the login form, so I logged
 in and then copied across the redirect override - to no avail - when I
 save the changes it redirects to the homepage, which contains no hint
 of the error. Also got the site working locally (was my PHP version
 thanks so much AD7six) - and can't repeat the defect. Do these point
 to Apache or PHP as the cause?

 I tried disabling mod_security using:
 IfModule mod_security.c
         SecFilterEngine Off
         SecFilterScanPOST Off
 /IfModule
 in every .htaccess file in my site, but it didn't make any difference
 (I sanitize everything, and it can't be this as it doesn't happen
 locally - unless it could be that local is Windows and host is Linux -
 seems very unlikely).

 I'd really appreciate any tips if anything's obvious about resolving
 the redirect override - or does the fact that it works locally mean
 this is unlikely to reveal anything?

 Tried creating a test subdirectory but suspected it wouldn't work - I
 get a 500 error probably related to my non-standard directory layout
 (so that my cake and app directories are outside my public_html
 directory - seemed safer).

 My reason for another site is in case the forum software has somehow
 added this filtering site-wide - it seems to be a server setting, (its
 only $11). I do get this error when I try the text in any table in the
 system (including tables that are nothing to do with tinyMCE and very
 little to do with the rest of the code). Will try baking an unrelated
 table to see if I can repeat it there but I very much expect to as it
 seems platform related.

 As far as I can tell, I don't have access to PHP settings - just
 CPanel on a shared hosting platform.

 Am I right in suspecting Apache or PHP? If so any ideas where I can
 look? I can't find anything likely by googling filters for either.
 Does Cake automatically use certain PHP filters on all POST and GET
 submissions or something?

 Thanks HUGELY, I'll be so incredibly happy when I/we crack this
 Chris/tt

 On Aug 18, 5:11 pm, Brendon Kozlowski (Realm)



 brendon...@hotmail.com wrote:
  I like archF6's suggestion, it's easy to test, and if it doesn't solve
  it, continue from there.  It might work, it might not.  I don't think
  a 500 server error would automatically redirect (but instead stop
  execution).  Regardless, it's about a 20 second test.  With Dreamhost
  I can enable/disable mod_security, I'm not sure if you would be able
  to test that on your host or not.  To be clear - I don't know why
  mod_security would mess with this, but it can't hurt to take a look if
  you're able to make such changes.

  On Aug 17, 11:23 am, technicaltitch technicalti...@gmail.com wrote:

   App was built Oct 2007 but it's taken the organization this long to
   find funding for someone to test and work on it, (hence I'm struggling
   to get my head round stuff again).

   I will have a go at creating a test subdirectory and adding that debug
   code- fantastic fantastic ideas thanks - probably blindingly obvious
   to PHPers but not to me (a decade working with C, Java and .NET but
   only ever used PHP on volunteer projects).

   Is it possible that a phpBB install may have had this as a side-
   effect? Ie, can filters be set up on all form input for a given space
   on a shared CPanel server?

   I have commented out my controller method and seen the error, so I'm
   assuming the redirect is called elsewhere, where do I put the redirect
   override code pls?

   As far as I can tell it isn't my code requesting the redirect but
   perhaps I'm missing something obvious? I commented out my controller
   method, route.php just has the default page specified. Tried debug
   level 1 and 2 and nothing is displayed about the error, or anything
   preceding the current page.

   Thanks SO much for your help - this is all so useful and despite my
   wandering off-subject, absolutely exactly how I hoped people would
   help me and I'm massively grateful,
   Chris

Re: Certain strings crashing CakePHP - where do I look first?

2009-08-21 Thread technicaltitch

I submitted a ticket about this to my host's server admin, and
including http://geocities.com/ in the request caused:

Not Acceptable
An appropriate representation of the requested resource /pdesk.cgi
could not be found on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
HTTPD Server Server at www.getsomesupport.com Port 443

Removing those few characters allowed the ticket to submit
successfully.

On Aug 22, 12:57 am, technicaltitch technicalti...@gmail.com wrote:
 You are such stars for helping me with this - its incredible thank you
 so much!

 I tried the new redirect method but got errors (missing arguments for
 AppController::redirect(), $status and $exit undefined) when I tried
 to log in, as this involved a redirect to the login form, so I logged
 in and then copied across the redirect override - to no avail - when I
 save the changes it redirects to the homepage, which contains no hint
 of the error. Also got the site working locally (was my PHP version
 thanks so much AD7six) - and can't repeat the defect. Do these point
 to Apache or PHP as the cause?

 I tried disabling mod_security using:
 IfModule mod_security.c
         SecFilterEngine Off
         SecFilterScanPOST Off
 /IfModule
 in every .htaccess file in my site, but it didn't make any difference
 (I sanitize everything, and it can't be this as it doesn't happen
 locally - unless it could be that local is Windows and host is Linux -
 seems very unlikely).

 I'd really appreciate any tips if anything's obvious about resolving
 the redirect override - or does the fact that it works locally mean
 this is unlikely to reveal anything?

 Tried creating a test subdirectory but suspected it wouldn't work - I
 get a 500 error probably related to my non-standard directory layout
 (so that my cake and app directories are outside my public_html
 directory - seemed safer).

 My reason for another site is in case the forum software has somehow
 added this filtering site-wide - it seems to be a server setting, (its
 only $11). I do get this error when I try the text in any table in the
 system (including tables that are nothing to do with tinyMCE and very
 little to do with the rest of the code). Will try baking an unrelated
 table to see if I can repeat it there but I very much expect to as it
 seems platform related.

 As far as I can tell, I don't have access to PHP settings - just
 CPanel on a shared hosting platform.

 Am I right in suspecting Apache or PHP? If so any ideas where I can
 look? I can't find anything likely by googling filters for either.
 Does Cake automatically use certain PHP filters on all POST and GET
 submissions or something?

 Thanks HUGELY, I'll be so incredibly happy when I/we crack this
 Chris/tt

 On Aug 18, 5:11 pm, Brendon Kozlowski (Realm)



 brendon...@hotmail.com wrote:
  I like archF6's suggestion, it's easy to test, and if it doesn't solve
  it, continue from there.  It might work, it might not.  I don't think
  a 500 server error would automatically redirect (but instead stop
  execution).  Regardless, it's about a 20 second test.  With Dreamhost
  I can enable/disable mod_security, I'm not sure if you would be able
  to test that on your host or not.  To be clear - I don't know why
  mod_security would mess with this, but it can't hurt to take a look if
  you're able to make such changes.

  On Aug 17, 11:23 am, technicaltitch technicalti...@gmail.com wrote:

   App was built Oct 2007 but it's taken the organization this long to
   find funding for someone to test and work on it, (hence I'm struggling
   to get my head round stuff again).

   I will have a go at creating a test subdirectory and adding that debug
   code- fantastic fantastic ideas thanks - probably blindingly obvious
   to PHPers but not to me (a decade working with C, Java and .NET but
   only ever used PHP on volunteer projects).

   Is it possible that a phpBB install may have had this as a side-
   effect? Ie, can filters be set up on all form input for a given space
   on a shared CPanel server?

   I have commented out my controller method and seen the error, so I'm
   assuming the redirect is called elsewhere, where do I put the redirect
   override code pls?

   As far as I can tell it isn't my code requesting the redirect but
   perhaps I'm missing something obvious? I commented out my controller
   method, route.php just has the default page specified. Tried debug
   level 1 and 2 and nothing is displayed about the error, or anything
   preceding the current page.

   Thanks SO much for your help - this is all so useful and despite my
   wandering off-subject, absolutely exactly how I hoped people would
   help me and I'm massively grateful,
   Chris
--~--~-~--~~~---~--~~
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