Re: No validation after deploy

2010-05-21 Thread Andrei Mita
Do you use model validation or a custom made one?


On Thu, May 20, 2010 at 9:58 PM, Matteo inter...@gmail.com wrote:

 Hi all,

 hope you can help a very newbe one.

 I have a very simple form with two fields: title and body.

 In my dev enviroment I check for the two fields to be fill.
 Validation works fine, if the fields are left blank, it shows the
 message error.

 The problem is with deploy. In my deploy env. (dreamhost) if I leave
 the fields blank it submits the same!!

 Have you ever experienced anything similar??

 Can't find a solution.

 A case similar to that can be due to .htaccess configuration?

 I can't think at any other couses!!

 Working with 1.2.7 V.

 Thanx a lot

 Matteo

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: No validation after deploy

2010-05-21 Thread Matteo
Hi Andrei,

the model one, please see below:

class Latest extends AppModel
{
var $name = 'Latest';

var $validate = array(
  'title' =  array('rule' = 'notEmpty', 'message' =
'mandatory field'),
  'body' =  array('rule' = 'notEmpty', 'message' =
'mandatory field')
);
}

How is it possible it works on my Mac and not online??

Thank you

Matteo

On May 21, 8:48 am, Andrei Mita andrei.m...@gmail.com wrote:
 Do you use model validation or a custom made one?





 On Thu, May 20, 2010 at 9:58 PM, Matteo inter...@gmail.com wrote:
  Hi all,

  hope you can help a very newbe one.

  I have a very simple form with two fields: title and body.

  In my dev enviroment I check for the two fields to be fill.
  Validation works fine, if the fields are left blank, it shows the
  message error.

  The problem is with deploy. In my deploy env. (dreamhost) if I leave
  the fields blank it submits the same!!

  Have you ever experienced anything similar??

  Can't find a solution.

  A case similar to that can be due to .htaccess configuration?

  I can't think at any other couses!!

  Working with 1.2.7 V.

  Thanx a lot

  Matteo

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.c 
  omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: No validation after deploy

2010-05-21 Thread Nicolas Maleve
I had a similar problem once with a validation rule.
It was due to the difference of PHP versions between my dev environment
(php5) and the production environment (php4)
Upgrading the production environment to php5 was the solution, but it
isn't always possible.

,n
Le Ven 21 mai 2010 9:08, Matteo a écrit :
 Hi Andrei,

 the model one, please see below:

 class Latest extends AppModel
 {
 var $name = 'Latest';

 var $validate = array(
   'title' =  array('rule' = 'notEmpty', 'message' =
 'mandatory field'),
   'body' =  array('rule' = 'notEmpty', 'message' =
 'mandatory field')
 );
 }

 How is it possible it works on my Mac and not online??

 Thank you

 Matteo

 On May 21, 8:48 am, Andrei Mita andrei.m...@gmail.com wrote:
 Do you use model validation or a custom made one?





 On Thu, May 20, 2010 at 9:58 PM, Matteo inter...@gmail.com wrote:
  Hi all,

  hope you can help a very newbe one.

  I have a very simple form with two fields: title and body.

  In my dev enviroment I check for the two fields to be fill.
  Validation works fine, if the fields are left blank, it shows the
  message error.

  The problem is with deploy. In my deploy env. (dreamhost) if I leave
  the fields blank it submits the same!!

  Have you ever experienced anything similar??

  Can't find a solution.

  A case similar to that can be due to .htaccess configuration?

  I can't think at any other couses!!

  Working with 1.2.7 V.

  Thanx a lot

  Matteo

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
 others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.c
 omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
 with their CakePHP related questions.

 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
 athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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



 *
*
  *
  *
   *
 *
   *
  *
  *
  C O N S T A N T
   V Z W




Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: No validation after deploy

2010-05-21 Thread Matteo
thanx Nicolas, however the PHP version is the 5.2.x in both
environments.


On May 21, 9:31 am, Nicolas Maleve nico...@constantvzw.com wrote:
 I had a similar problem once with a validation rule.
 It was due to the difference of PHP versions between my dev environment
 (php5) and the production environment (php4)
 Upgrading the production environment to php5 was the solution, but it
 isn't always possible.

 ,n
 Le Ven 21 mai 2010 9:08, Matteo a écrit :



  Hi Andrei,

  the model one, please see below:

  class Latest extends AppModel
  {
              var $name = 'Latest';

              var $validate = array(
                    'title' =  array('rule' = 'notEmpty', 'message' =
  'mandatory field'),
                    'body' =  array('rule' = 'notEmpty', 'message' =
  'mandatory field')
              );
  }

  How is it possible it works on my Mac and not online??

  Thank you

  Matteo

  On May 21, 8:48 am, Andrei Mita andrei.m...@gmail.com wrote:
  Do you use model validation or a custom made one?

  On Thu, May 20, 2010 at 9:58 PM, Matteo inter...@gmail.com wrote:
   Hi all,

   hope you can help a very newbe one.

   I have a very simple form with two fields: title and body.

   In my dev enviroment I check for the two fields to be fill.
   Validation works fine, if the fields are left blank, it shows the
   message error.

   The problem is with deploy. In my deploy env. (dreamhost) if I leave
   the fields blank it submits the same!!

   Have you ever experienced anything similar??

   Can't find a solution.

   A case similar to that can be due to .htaccess configuration?

   I can't think at any other couses!!

   Working with 1.2.7 V.

   Thanx a lot

   Matteo

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
  others
   with their CakePHP related questions.

   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.comcake-php%2bunsubscr...@googlegroups.c
  omFor more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
  with their CakePHP related questions.

  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
  athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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
  athttp://groups.google.com/group/cake-php?hl=en

          *
     *
   *
   *
    *
      *
        *
           *
               *
                   C O N S T A N T
                        V Z W

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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_rand not working!

2010-05-21 Thread HK
Wow! Thanks a lot.

Upgrading to 1.3 isn't very simple! But new project do use cakePHP
v1.3

On May 18, 9:24 pm, Jamie jamie@gmail.com wrote:
 Talk about going off on a tangent! :) Let's get to the core of the
 issue, which is just array_rand()...

 HK, what version of Cake are you using? If you're using 1.2, check out
 this ticket:

 http://cakephp.lighthouseapp.com/projects/42648/tickets/73-securityci...

 Basically, a call to srand() in Security::cipher() causes all
 subsequent calls to rand(), array_rand(), etc. to use the same seed
 and thus generate the same results. To fix, you'll either need to
 upgrade to 1.3 (strongly recommended), or follow the fix outlined at
 the top of that ticket.

 - Jamie

 On May 18, 8:22 am, piousbox pious...@gmail.com wrote:



  First, if you're developing this application, I strongly advice not
  messing with caching until you're ready to deploy. In particular, you
  do $banners_tmp = Cache::read('banners'); even if it returns empty?
  Maybe you're looking at only your cached version all the time, not
  what's in your database?

  Second, MySQL has random functions so you can put that inside your SQL
  code. You can have conditions like, ... SORT BY RAND() LIMIT 1...

  Third, array_rand() doesn't look to be a cakePHP function either. Try
  writing a function that takes some data and returns a random piece of
  it. Then input your Position data into that function, basically break
  the task at hand into two: the cakePHP part of retrieving data, and
  the non-cakePHP part of taking a random element from an array. that
  is, if you don't want to use the advise above and incorporate RAND()
  into your SQL query.

  _V

  On May 17, 8:50 am, HK hkosm...@gmail.com wrote:

   Hello,

   I have a strange problem with one of my applications.

   Consider the following code:
   function getBanner() {
                   $banners_tmp = Cache::read('banners');
                   if(empty($banners_tmp))
                   {
                           $this-loadModel('Position');
                           $this-Position-cacheBanner();
                           $banners_tmp = Cache::read('banners');
                   }

                   //srand(floor(time() / (60*60*24)));
                  //debug(rand() % count($banners_tmp));

                   //return $banners_tmp[rand() % count($banners_tmp)];
                   return $banners_tmp[array_rand($banners_tmp)];
           }

   array_rand always return the first element of my array. I also used
   srand and rand()%count() but with same result. Is there a problem with
   cake and rands?

   thanks a lot

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
   with their CakePHP related questions.

   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 
   athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Problem with data inside an element.ctp when is loaded dynamically

2010-05-21 Thread kryska
It must be something in the way i load the component in the
controller:

 array($this-render(null, 'ajax', '/elements/'.$stringNombre))

i dont know

Thank you anyway!

On 20 mayo, 19:11, Andrei Mita andrei.m...@gmail.com wrote:
 That was my best guess. Sorry :)

 Take a look at the view source cod after you populate your form just before
 submission and maybe you'll spot  something there. Or, make a debug after
 you submit your form and see what data is passed to the controller.





 On Thu, May 20, 2010 at 8:00 PM, kryska kryskasan...@gmail.com wrote:
  Yes , i do.

  first I create the form:
   $form-create(array('controller'='Detallemenu','action'='add'));

   afert i have:
  div id=divupdate /div

  And at the end:
  $form-end(array('label'='Crear Menú','class'='button'))

  In fact, if i write $this-element('mielement') inside the div, it
  works!

  But i dont know why it doesnt work if i do itdynamically!!

  Thank you!

  On 20 mayo, 18:42, Andrei Mita andrei.m...@gmail.com wrote:
   Do you load the elements in between form-create and form-end?

   On Thu, May 20, 2010 at 6:01 PM, kryska kryskasan...@gmail.com wrote:
Hi!
There is a view with a form inside.
Two dropdown lists; depending on the first value selected, fill the
second dropdown. And depending on the value selected on the secon
dropdown, i load different elements.ctp inside a div. Finally, i end
the form:

echo $form-
create(array('controller'='Detallemenu','action'='add'));
echo $form-

  select('seccion_id',array($secciones),null,array('id'='secciones'),Select
one type..')
echo $form-select('tipo_id',array(),null,array('id'='tipos'),'Select
one type..')

echo $ajax-observeField('secciones',array('url'=http://127.0.0.1/
elmolinodesanlazaro.com/prueba/adm/Menus/
update_tipo_select,'update'='tipos'));

echo $ajax-

  observeField('tipos',array('url'='actualizarCarta','update'='divupdate') 
  ­);

div id=divupdate /div

The action in the controller to load an element.ctp inside the div:

function actualizarCarta($id = null) {
       $tipo_id = $this-data['Detallemenu']['tipo_id'];
       $options = $this-Detallemenu-Tipo-
find('list',array('fields'='Tipo.nombre','conditions'=array('id'=
$tipo_id)));
               $stringNombre = implode(',', Set::extract($options,
'{n}.Tipo.nombre'));
       array($this-render(null, 'ajax', '/elements/'.$stringNombre));
  }
echo $form-end(array('label'='Crear Menú','class'='button'))

Everything works except that do not save the fields that are inside
the element.ctp
If the element is not loaded dynamically, (if i write inside the div:
$this-element('mielement') ), it saves the fields inside the view and
inside the element..
But by loading dynamically, it only saves the fileds inside the view,
but it do not save the fields inside the element...

Please, any help would be awesome..i`m going crazy with this!

Thank you!

Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
  others
with their CakePHP related questions.

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.comcake-php%2bunsubscr...@googlegroups.c
 om
  cake-php%2bunsubscr...@googlegroups.c­omFor more options, visit this
  group at
   http://groups.google.com/group/cake-php?hl=en

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
  with their CakePHP related questions.

   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.comcake-php%2bunsubscr...@googlegroups.c
omFor more options, visit this group athttp://
  groups.google.com/group/cake-php?hl=en- Ocultar texto de la cita -

   - Mostrar texto de la cita -

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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.comcake-php%2bunsubscr...@googlegroups.c 
  omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 

Re: Problem with Session-setFlash

2010-05-21 Thread sami_bk
Hi Jeremy,

Thanks for your reply.
It did not work with me , is there any other alternative to
setFlash() ?

Greetings.
On May 20, 7:16 pm, Jeremy Burns jeremybu...@me.com wrote:
 Seems like overkill to me. Just use $this-Session-setFlash('Here is my 
 message');  Then do echo $this-Session-flash(); - this not only displays 
 your message but also clears it out of the cache.

 Jeremy Burns
 jeremybu...@me.com

 On 20 May 2010, at 18:16, sami_bk wrote:



  Hi all,

  I am new to CakePHP and i am building a small app.
  i use Session-setFlash('message') to display notifications to the
  users .
  The notification is displayed in the default layout and i delete the
  flash messega from the session using this code
  code
  if ($session-check('Message.flash')) {
     $message = $session-read('Message.flash') ;
     if($message['message'] != '') {
         if(is_array($message['message'])) {
             $text =  ;
             foreach ($message['message'] as $mes) {
                 $text = $mes .br ;
             }
         }
         else $text = $message['message'];
  div id=flash class='message2 success'
      p?php echo $text; ?/p
  /div
         ?php $session-flash() ?
     }
  }
  /code
  My problem is that notification are displayed randomly , ie : it seems
  that the flash message is not deleted from the session.
  PS : using another layout for ajax calls i also delete the flash
  message in this layout.

  Thanks in advance for your help

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Problem with Session-setFlash

2010-05-21 Thread Jeremy Burns
What error are you getting? Can you post the code where you call it? Have you 
included both the Session helper and component in your controller (or 
app_controller)?

Jeremy Burns
jeremybu...@me.com


On 21 May 2010, at 10:48, sami_bk wrote:

 Hi Jeremy,
 
 Thanks for your reply.
 It did not work with me , is there any other alternative to
 setFlash() ?
 
 Greetings.
 On May 20, 7:16 pm, Jeremy Burns jeremybu...@me.com wrote:
 Seems like overkill to me. Just use $this-Session-setFlash('Here is my 
 message');  Then do echo $this-Session-flash(); - this not only displays 
 your message but also clears it out of the cache.
 
 Jeremy Burns
 jeremybu...@me.com
 
 On 20 May 2010, at 18:16, sami_bk wrote:
 
 
 
 Hi all,
 
 I am new to CakePHP and i am building a small app.
 i use Session-setFlash('message') to display notifications to the
 users .
 The notification is displayed in the default layout and i delete the
 flash messega from the session using this code
 code
 if ($session-check('Message.flash')) {
$message = $session-read('Message.flash') ;
if($message['message'] != '') {
if(is_array($message['message'])) {
$text =  ;
foreach ($message['message'] as $mes) {
$text = $mes .br ;
}
}
else $text = $message['message'];
 div id=flash class='message2 success'
 p?php echo $text; ?/p
 /div
?php $session-flash() ?
}
 }
 /code
 My problem is that notification are displayed randomly , ie : it seems
 that the flash message is not deleted from the session.
 PS : using another layout for ajax calls i also delete the flash
 message in this layout.
 
 Thanks in advance for your help
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 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 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 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 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Mootools and CakePHP

2010-05-21 Thread Davor Ilic
I tried this tutorial and it didn´t work because he say that the variable
$pagination and the object options don´t exists :

http://mark-story.com/posts/view/creating-simple-ajax-pagination-with-cakephp-1-3-and-mootools

someone else how tried to use mootools with cakephp and it work then help me
please.

thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: noob question, how to add a button(to link somewhere) to a form

2010-05-21 Thread John Andersen
Please clarify your requirment! Do you need:
1) to be able to go to the As add page when you are working in the Bs
add page?
1.1) is it fine that you may loose what content you have entered on
the Bs add page, when going to the As add page?

2) to be able to lookup an A and assign it to the B in the Bs add
page?

3) to do something different?

Enjoy,
   John

On May 21, 4:58 am, Jay jingsi@gmail.com wrote:
 Hi guys, I have 2 MVC classes A and B. Where B has a foreign key
 reference to A.
 In A's view controller, I have a working Add page.
 In B's view controller, I'm writing the add page(add.ctp) using forms
 and I want to have a button where it links to A's add page, how would
 I be able to do that? Please help, many thanks

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: ideas for handling user added images

2010-05-21 Thread calvin
Why don't you move your working directory to separate the live
application from the checkout? That's how we have it set up at work.
Each team member has their own local working directory as well as
their own separate vhost on our test server (though we generally all
share one test database). Transferring files to the test server via
SFTP isn't much of a hassle since it's all local and Aptana has an
auto-upload-on-save script. I honestly don't feel there's that much of
a difference from working right out of the www root directory.

Or you could just do what I do at home--store user-uploaded images in /
app/webroot/files/img and add that path to svn:ignore.

On May 20, 10:27 pm, mikeottinger mikeottin...@gmail.com wrote:
 Hi All,

   I have a site that allows the user, through an admin section, the
 ability to upload his own images to the site, a very poor man's CMS if
 you will. This has all worked pretty well but for one annoying aspect
 that I finally want to address. Currently all uploaded images are
 placed in app/webroot/img where they're used with the html helpers.
 Why I don't like this approach is that these files get mixed in with
 files under source control. My production server is basically an SVN
 checkout of the application. Everything is perfectly in synch with SVN
 except for these user uploaded images. What I had in mind was setting
 aside a directory outside of the cakephp app instance and have my
 image paths point to there. This doesn't work because this outside
 directory is not a document root to the web server. I suppose I could
 setup a separate host configuration within apache and place them in
 its document root. Long story short, has anyone devised any better
 ways to keep user generated content out of the application's directory
 structure?

 Thanks in advance.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


About pagination Cake v1.3

2010-05-21 Thread Abraham Boray
Guys
Can I paginate an array using paginate function?

eg:

 $this-Student-recursive=1;
 $this-set('student_notes',$this-Student-find('all'));

Then I want to paginate this array $student_notes


Can I ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Multi-client application

2010-05-21 Thread Heidi Grab
Hi there,

I need my cakephp application to support multiple clients. This means,
that people from company A have their very own data, and people from
company B have a completely different set of data. Think of it as an
issue management application: every company has their own software
applications, their own staff, their own administrators that use the
same web based application, but need a company-specific set of data.

I think the best option would be to specify different databases -
database A for company A right down to database Z for company Z. This
could make it easy to host databases on different servers - e.g. if a
company for security reasons wants to host the mysql data in their
company, or if there are so many companys that one DB server just is
not enough.

How would I do this with cakephp?

-- define a table clients that contains information on the client
including which host and which database he wants to use

-- user has client_id ; means user database would be the same for
everyone; better ideas?

-- use the specific database, e.g. the model issues for user A from
company A is tied to database company_A.

Any ideas on how to make that work?

All the best,
Heidi.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Where do I put the index.ctp for the app_controller?

2010-05-21 Thread Raaaaaaaagh
Right now I have the default view for http://localhost/cake/appacl/,
and I want to change it to my own view.

Its embarrassingly simple - but Im a complete newbie and its a hard
question to google (web and this group)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Transactions in Cakephp 1.3

2010-05-21 Thread pablopedrosa
Hello, i have a problem i don´t know how to resolve it.
 Is there any posibility when using transaction to do this?
 in a loop I do lot of inserts, then before COMMIT the transaction
y have to do a find() and the result can´t be the inserts I made in
the transaction.

Thanks a lot
Pablo

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cakephp on wamp

2010-05-21 Thread Amit
Hi

   i want to install cakephp on wamp, but i don't know where should i
put this downloaded cakephp folder, i has renamed it as myApp.

generally we put our application folder in www folder in wamp.

i want to use cake bake functionality

Is it required to make change something in cake batch file?

Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Transactions in Cakephp 1.3

2010-05-21 Thread Jeremy Burns
http://book.cakephp.org/view/1633/Transactions

Make sure your table suports transaction - e.g. InnoDB.

Jeremy Burns
jeremybu...@me.com


On 21 May 2010, at 08:56, pablopedrosa wrote:

 Hello, i have a problem i don´t know how to resolve it.
 Is there any posibility when using transaction to do this?
 in a loop I do lot of inserts, then before COMMIT the transaction
 y have to do a find() and the result can´t be the inserts I made in
 the transaction.
 
 Thanks a lot
 Pablo
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


TimeHelper in cake, french language ?

2010-05-21 Thread Abraham Boray
How can I translate or make the time helper in french
Actually I'm on a french project(I mean a french language)
And I need time helper in french  as well to print time in french
Intead of2 weeks, 3 days ago   == depuis 2 semaines et 3 jours


Got it guys ?


Thx in advance ;)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cakephp on wamp

2010-05-21 Thread Jeremy Burns
http://book.cakephp.org/view/912/Installation

Jeremy Burns
jeremybu...@me.com


On 21 May 2010, at 12:02, Amit wrote:

 Hi
 
   i want to install cakephp on wamp, but i don't know where should i
 put this downloaded cakephp folder, i has renamed it as myApp.
 
 generally we put our application folder in www folder in wamp.
 
 i want to use cake bake functionality
 
 Is it required to make change something in cake batch file?
 
 Thanks in advance
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem with Media Plugin of David Persson

2010-05-21 Thread marco.rizze...@gmail.com
Hi
I have installed the Media Plugin in my system (I work on windows
system).
I try to test if all works using directly the Attachment Model.
I try to upload a jpeg but I get always an mime type error.
I have mime_magic installed.
I try to do a bit of backup on code of Media Plugin and I have find
where is the error.
On  Transfer Behaviour in the method checkMimeType if i do a pr()
$this-runtime[$Model-alias] I get :
Array
(
[temporary] = Array
(
[scheme] =
[host] = localhost
[port] =
[file] = C:\Windows\Temp\php1D5E.tmp
[mimeType] = application/octet-stream
[size] = 92632
[pixels] = 337460
[permisssion] =
[dirname] = C:\Windows\Temp
[basename] = php1D5E.tmp
[filename] = php1D5E
[extension] = tmp
[type] = uploaded-file-local
[permission] = 0666
[error] = 0
)


The mime type is application/octet-stream and this causes the error.
Can someone give me some suggestion about this?
Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem with Media Plugin of David Persson

2010-05-21 Thread marco.rizze...@gmail.com
Hi
I have installed the Media Plugin in my system (I work on windows
system).
I try to test if all works using directly the Attachment Model.
I try to upload a jpeg but I get always an mime type error.
I have mime_magic installed.
I try to do a bit of backup on code of Media Plugin and I have find
where is the error.
On  Transfer Behaviour in the method checkMimeType if i do a pr()
$this-runtime[$Model-alias] I get :
Array
(
[temporary] = Array
(
[scheme] =
[host] = localhost
[port] =
[file] = C:\Windows\Temp\php1D5E.tmp
[mimeType] = application/octet-stream
[size] = 92632
[pixels] = 337460
[permisssion] =
[dirname] = C:\Windows\Temp
[basename] = php1D5E.tmp
[filename] = php1D5E
[extension] = tmp
[type] = uploaded-file-local
[permission] = 0666
[error] = 0
)


The mime type is application/octet-stream and this causes the error.
Can someone give me some suggestion about this?
Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Sending Email from Shell

2010-05-21 Thread Jesse
I have recently upgraded my cake core from cake-1.2.0.7962 to cake 1.2
6.

The only problem I've had in converting everything is my custom shells
that I have written.

I have a shell that searches a database, returns records and sends out
email for people to renew their account. It's pretty simple.

The problem comes when trying to send the email. Here is my code from
the old cake core that worked in sending out the email:

App::import('Core', array('Controller'));
App::import('Component', array('Email'));
$this-Controller = new Controller();
$this-Email = new EmailComponent();
$this-Email-startup($this-Controller);

$this-Email-reset();
$this-Email-to = 'Jesse t...@example.com';
$this-Email-subject = Subject;
$this-Email-replyTo = t...@example.com;
$this-Email-from = t...@example.com;
$this-Email-template = 'default';
$this-Email-sendAs = html;
$this-Email-send();

This worked flawlessly for over a year, sent out thousands of email
and I never had a problem with it. After upgrading I keep getting this
error:

Notice: Undefined property: EmailComponent::$Controller in /usr/local/
cake_1.2.6/cake/libs/controller/components/email.php on line 363
Notice: Trying to get property of non-object in /usr/local/cake_1.2.6/
cake/libs/controller/components/email.php on line 363
Notice: Undefined property: EmailComponent::$Controller in /usr/local/
cake_1.2.6/cake/libs/controller/components/email.php on line 370
Notice: Trying to get property of non-object in /usr/local/cake_1.2.6/
cake/libs/controller/components/email.php on line 370
Notice: Undefined property: View::$webroot in /usr/local/cake_1.2.6/
cake/libs/view/view.php on line 755
Notice: Undefined property: View::$webroot in /usr/local/cake_1.2.6/
cake/libs/view/view.php on line 755

The email is still sent out but it contains some errors as well and
I'm thinking it has to do with these errors. I didn't realize this was
broken until we rolled it out into production so we haven't been able
to send the emails out for a couple days. Anyone have some advice for
me?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Problem with Media Plugin of David Persson

2010-05-21 Thread marco.rizze...@gmail.com
I find that the problem isthat mime_magic is not goog installed.
Now I get mime_magic installed but I get this error:

mime_content_type() [http://www.php.net/mime_magic]: mime_magic not
initialized [APP\plugins\media\vendors\mime_type.php, line 160]

How can I initialized mime_magic?

On 21 Mag, 16:15, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 I have installed the Media Plugin in my system (I work on windows
 system).
 I try to test if all works using directly the Attachment Model.
 I try to upload a jpeg but I get always an mime type error.
 I have mime_magic installed.
 I try to do a bit of backup on code of Media Plugin and I have find
 where is the error.
 On  Transfer Behaviour in the method checkMimeType if i do a pr()
 $this-runtime[$Model-alias] I get :
 Array
 (
     [temporary] = Array
         (
             [scheme] =
             [host] = localhost
             [port] =
             [file] = C:\Windows\Temp\php1D5E.tmp
             [mimeType] = application/octet-stream
             [size] = 92632
             [pixels] = 337460
             [permisssion] =
             [dirname] = C:\Windows\Temp
             [basename] = php1D5E.tmp
             [filename] = php1D5E
             [extension] = tmp
             [type] = uploaded-file-local
             [permission] = 0666
             [error] = 0
         )
 

 The mime type is application/octet-stream and this causes the error.
 Can someone give me some suggestion about this?
 Many Thanks

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Where do I put the index.ctp for the app_controller?

2010-05-21 Thread calvin
AFAIK, AppController doesn't have any actions or views. It's just used
as a parent class for the other controllers to inherit from. If you're
looking to change the home page of your app, then edit /app/views/
pages/home.ctp --static pages are all served up by the
PagesController.

On May 20, 11:37 pm, Rgh writetof...@gmail.com wrote:
 Right now I have the default view forhttp://localhost/cake/appacl/,
 and I want to change it to my own view.

 Its embarrassingly simple - but Im a complete newbie and its a hard
 question to google (web and this group)

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 select from subquery result

2010-05-21 Thread Marcelo Andrade
On Fri, May 7, 2010 at 7:16 AM, Eleazar gerrit.kru...@gmail.com wrote:
 Hello
 for the life of me I coudn't find an example of how to do the
 following:
 SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
 DESC) t1 GROUP BY block_id

 The query needs to select the latest entries for each block_id in the
 table (like selecting the latest comment for each blog post would be
 an equivalent scenario).

 I would need to implement this with pagination, but I would just like
 to get it to work with find() for now.

 Is a custom query maybe the only way to do this?


Check the sub-query item at

http://book.cakephp.org/view/74/Complex-Find-Conditions

Best regards.

-- 
MARCELO F ANDRADE
Belem, Amazonia, Brazil

I took the red pill

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 IIS

2010-05-21 Thread McFrosty
Howdy all,

I have what is probably a stupid question.  I have to run cake in an
IIS environment without redirection.  I am able to get to the apps as
needed, but I'm having a tough time with the webroot folder, or more
precisely, the information under there.  It appears that none of my
pages can access the css or img files under the webroot folder.

Is there a way to change the paths to these items?

Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Scaling question - separating model reads and writes across databases

2010-05-21 Thread NdJ
Hi,

I wonder if anyone out there has done the following in a production
situation that they could  provide feedback on?

/app/config/database.php:-
$read = array('host'='127.0.0.1');
$write = array('host'='1.2.3.4');

/app/app_model.php:-
beforeFind() { $this-useDbConfig = 'read'; }
beforeSave() { $this-useDbConfig = 'write'; }
beforeDelete() { $this-useDbConfig = 'write'; }

Then use database replication from the write host back to the read
host(s) thus deploying a classic master-write, multi-read database
setup.

It *seems* like this technique should work quite nicely and would
permit easy scaling but are there any CakePHP related gotchas I'm not
aware of?

Looking at the Model class source indicates the field() and read()
methods use Model-find() but if I'm not mistaken (and I could be!) I
don't believe those Model-find() calls will get passed through my
child beforeFind() callback and they could thus miss a $this-
useDbConfig adjustment. Perhaps the answer this that is to just go
ahead and overload all find, save, delete, read, field and query
methods in AppModel and insert a $this-useDbConfig statement before
passing back to their respective parents.

Anyway, has anyone got feedback or experiance doing this with CakePHP
in this way?  Did it work for you?

Cheers,
N

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem when creating/deleting test tables for fixtures in the context of a CakeTestCase for a controller

2010-05-21 Thread Rafael Vega

Hello.
I am using cake 1.3.0 and php 5.2.13. I'm trying to test a controller
(code is below) using fixtures and a subclass of CakeTestCase.

When I run the test, I get a SQL error: Table
'coolata_test.suggestions' doesn't exist. So I went debugging until I
found line 287 in cake_test_case.php which removes the created
database tables after the testAction method is run.

I commented out that line and everything seemed to be working fine
until on my testAdd() method I wanted to make assertions about the
rendered output.
There is a SQL statement added to the rendered output:

Query: CREATE TABLE `suggestions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fbid` int(20) NOT NULL,
`user_name` varchar(255) DEFAULT NULL,
`song_name` varchar(255) DEFAULT NULL,
`picture_url` varchar(255) DEFAULT NULL,
`flavor` varchar(255) DEFAULT NULL,
`created` datetime DEFAULT NULL,PRIMARY KEY  (`id`));

This is because the table already exists.

This issue preventing me from making assertions and testing my
rendered output. I could test by making assertions about the variables
passed to the view but since CakeWebTests cannot use fixtures, I'm
trying to do that here.

I believe this is a bug in the test suite but maybe I'm missing
soething. Please help!

The code:



THE CONTROLLER:


?php
class SuggestionsController extends AppController {

var $name = 'Suggestions';
var $helpers = array('xml', 'Cache');
var $layout = 'xml';

var $cacheAction = array('index' = 600); //cache the index action
for 10 minutes

// GET /suggestions/
function index() {
if(!isset($this-params['url']['fbid']) || !is_int($this-
params['url']['fbid']))
$fbid = 0;
else
$fbid = $this-params['url']['fbid'];

$recent_suggestions = $this-Suggestion-getRecent($fbid);
$this-set('recent_suggestions', $recent_suggestions);
}

// POST /suggestions/add
function add() {
if($this-hasPermissions($this-data)){
unset($this-data['id']);
App::import('Sanitize');
$clean_data = Sanitize::clean($this-data);
$new_suggestion = array('Suggestion'=$clean_data);
if(!$this-Suggestion-save($new_suggestion)){
$errs = $this-Suggestion-invalidFields();
$msgs = array_values($errs);
$error = array('code'=400, 
'message'=$msgs[0]);
$this-set('error',$error);
}
}
}
}
?



THE TEST:


?php
/* Suggestions Test cases generated on: 2010-05-19 12:05:35 :
1274291795*/
App::import('Controller', 'Suggestions');

class SuggestionsControllerTestCase extends CakeTestCase {
var $fixtures = array('app.suggestion', 'app.like', 'app.bad_word');
var $autoFixtures = true;

function testIndex() {
$result = $this-testAction('/suggestions/',array(
'return'='vars',
'fixturize'=true,
'method'='get',
'data'=array('fbid'=232323)
));
$this-AssertFalse(isset($result['error']), 'Should not return
error');
$this-AssertEqual(count($result['recent_suggestions']), 6, 
'Should
return 6 suggestions');
}

function testAdd() {
//Inserting a new suggestion.
$result = $this-testAction('/suggestions/add',array(
'return'='render',
'fixturize'=true,
'method'='post',
'data'=array(
'fbid'=232323,
'user_name'='Some Nice Guy',
'song_name'='Some Nice Song',
'picture_url'='http://nice.com/picture.jpg',
'flavor'='sweet'
)
));
pr($result);
}
}
?




THE UGLY HACK IN cake_test_case.php:



/**
 * Callback issued when a controller's action has been invoked through
testAction().
 *
 * @param Controller $controller Controller that 

Re: Problem when creating/deleting test tables for fixtures in the context of a CakeTestCase for a controller

2010-05-21 Thread email.r...@gmail.com
More Info:
I just tested with latest version of the 1.3-dev branch and I have the same
issue.

Here are my fixtures and db schema:

?php
/* BadWord Fixture generated on: 2010-05-20 11:05:17 : 1274374157 */
class BadWordFixture extends CakeTestFixture {
var $name = 'BadWord';

var $import = array('table'='bad_words', 'connection'='default',
'records'=true);
}
?


?php
/* Like Fixture generated on: 2010-05-19 15:05:05 : 1274299565 */
class LikeFixture extends CakeTestFixture {
 var $name = 'Like';

var $import = array('table'='likes', 'connection'='default',
'records'=false);
 var $records = array(
array(
 'id' = 1,
'fbid' = 234567, //This is Mariluz Gonzalez
 'suggestion_id' = 1
),
array(
 'id' = 2,
'fbid' = 234567, //This is Mariluz Gonzalez
 'suggestion_id' = 2
),
array(
 'id' = 3,
'fbid' = 234567, //This is Mariluz Gonzalez
 'suggestion_id' = 5
),
 array(
'id' = 4,
'fbid' = 234567, //This is Mariluz Gonzalez
 'suggestion_id' = 6
)
);
}
?


?php
/* Suggestion Fixture generated on: 2010-05-19 11:05:58 : 1274288338 */
class SuggestionFixture extends CakeTestFixture {
 var $name = 'Suggestion';

var $import = array('table'='suggestions', 'connection'='default',
'records'=false);

var $records = array(
array(
'id' = 1,
 'fbid' = 123456,
'user_name' = 'Rafael Vega',
 'song_name' = 'Lasso by Wolfgang Amadeus Phoenix',
'created' = '2010-05-18 11:58:58',
 'flavor' = 'Coffee',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 2,
 'fbid' = 123456,
'user_name' = 'Rafael Vega',
 'song_name' = 'Electric Feel by MGMT',
'created' = '2010-05-18 15:58:58',
 'flavor' = 'Chocolate',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 3,
 'fbid' = 234567,
'user_name' = 'Mariluz Gonzalez',
 'song_name' = 'Lady by Fela Kuti',
'created' = '2010-05-21 11:28:58',
 'flavor' = 'Strawberry',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 4,
 'fbid' = 234567,
'user_name' = 'Mariluz Gonzalez',
 'song_name' = 'Zombie by Fela Kuti',
'created' = '2010-05-22 09:20:02',
 'flavor' = 'Vanilla',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 5,
 'fbid' = 567890,
'user_name' = 'John Doe',
 'song_name' = 'Bad by Michael Jackson',
'created' = '2010-05-19 11:58:58',
 'flavor' = 'Coffee',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 6,
 'fbid' = 678901,
'user_name' = 'Cheetah-Ra',
 'song_name' = 'Love Cats by the Cure',
'created' = '2010-05-19 15:58:58',
 'flavor' = 'Chocolate',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 7,
 'fbid' = 789012,
'user_name' = 'Leon-Oh',
 'song_name' = 'Mas allá de lo evidente by Leo Dan',
'created' = '2010-05-21 11:28:58',
 'flavor' = 'Strawberry',
'picture_url' = 'http://some.url.com/an_image.jpg'
 ),
array(
'id' = 8,
 'fbid' = 890123,
'user_name' = 'Jane Tarzan',
 'song_name' = 'Welcome to the Jungle by Guns n\' Roses',
'created' = '2010-05-22 09:20:02',
 'flavor' = 'Coconut',
'picture_url' = 'http://some.url.com/an_image.jpg'
 )
);
}
?

?php
/* SVN FILE: $Id$ */
/* App schema generated on: 2010-05-21 11:05:01 : 1274461141*/
class AppSchema extends CakeSchema {
var $name = 'App';

function before($event = array()) {
return true;
}

function after($event = array()) {
}

var $accesses = array(
 'id' = array('type' = 'integer', 'null' = false, 'default' = NULL,
'key' = 'primary'),
 'api_key' = array('type' = 'string', 'null' = false, 'default' = ' ',
'key' = 'unique'),
 'secret' = array('type' = 'string', 'null' = false, 'default' = ' '),
'indexes' = array('PRIMARY' = array('column' = 'id', 'unique' = 1),
'unique_api_key' = array('column' = 'api_key', 'unique' = 1)),
 'tableParameters' = array('charset' = 'utf8', 'collate' =
'utf8_general_ci', 'engine' = 'MyISAM')
 );
var $bad_words = array(
'id' = array('type' = 'integer', 'null' = false, 'default' = NULL, 'key'
= 'primary'),
 'bad_word' = array('type' = 'string', 'null' = false, 'default' = ' '),
'indexes' = array('PRIMARY' = array('column' = 'id', 'unique' = 1)),
 'tableParameters' = array('charset' = 'utf8', 'collate' =
'utf8_general_ci', 'engine' = 'InnoDB')
 );
var $likes = array(
'id' = array('type' = 'integer', 'null' = false, 'default' = NULL, 'key'
= 'primary'),
 'fbid' = array('type' = 'integer', 'null' = false, 'default' = NULL,
'length' = 20),
 'suggestion_id' = array('type' = 'integer', 'null' = false, 'default' =
NULL, 'key' = 'index'),
 'indexes' = array('PRIMARY' = array('column' = 'id', 'unique' = 1),
'suggestion_id' = array('column' = 'suggestion_id', 'unique' = 0)),
 'tableParameters' = array('charset' = 'utf8', 'collate' =
'utf8_general_ci', 'engine' = 'InnoDB')
 );
var $suggestions = array(
'id' = array('type' = 'integer', 'null' = false, 'default' = NULL, 'key'
= 'primary'),
 'fbid' = array('type' = 'integer', 'null' = false, 'default' = NULL,
'length' = 20),
 'user_name' = array('type' = 'string', 'null' = true, 'default' =
NULL),
'song_name' = array('type' = 'string', 'null' = true, 'default' = NULL),
 'picture_url' 

Re: Unitesting with Simpletest

2010-05-21 Thread LunarDraco
Exactly what are you trying to test?
It looks like your trying to test the http POST and response
protocols, I'm pretty sure Apache and other web server engines have
fully tested those.

First make sure your logic is as deep into the model as possible. As
models are much easier to test than controllers.
The rest of this sounds like your testing the controller. The
controller is not exactly simple to test against however it can be
done. And you may need to use a few different MOCK objects to get the
results your looking for.

Mark Story has a couple of articles on how to test the controllers.
There is a bit of setup involved and you may have to create some mock
objects to accomplish the test.

http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way
http://mark-story.com/posts/view/testing-cakephp-controllers-mock-objects-edition

On May 20, 9:17 am, Aung thein.aungmy...@gmail.com wrote:
 Hi team,

 I have been using cakephp for one of my projects and we are trying to
 test with Simpletest as provided in the documentation. However, our
 api cannot be called directly. We have to use

     * Method: POST
     * Header Name: Content-Type
     * Header Value: application/x-www-form-urlencoded
     * Body: params={username:aung,password:pass}

 I can solve the first problem by using 'method'=post in testAction()
 method from CakeTestCase as 
 inhttp://book.cakephp.org/view/366/Testing-controllers
 page. However, i don't have any idea how to set the header name, type
 and params into the body. We can use httpclient to do these things but
 httpclient is a bit manual and we think simpletest in cakephp
 framework is better if we can solve this problem.

 If anyone knows, please let me know the solution :) ..

 Thank very much in advance.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Find Question - field()

2010-05-21 Thread bradmaxs
Thanks Calvin. I get it.

On May 20, 8:44 pm, calvin cal...@rottenrecords.com wrote:
 I mean referencing the model object itself, i.e. $this-User-find()
 instead of $model-find() or User-find().

 On May 20, 10:18 am, bradmaxs b...@pezzano.com wrote:



  Thanks Calvin.

  When you say access models from controllers, do you mean with find().

  Trying some different methods as we speak.

  On May 20, 4:07 am, calvin cal...@rottenrecords.com wrote:

   Assuming that's exactly what your code looks like, the
   T_OBJECT_OPERATOR error is probably because you're putting a
   T_OBJECT_OPERATOR (-) after a constant (User). If you want the
   model, then you need to write $this-User. Likewise, unless you
   declared a variable previously named $model, calling $model-

   anything() is going to result in an error.

   Jeremy's recommendations are good, but you should still read up on how
   to access models from controllers in the Cookbook. That will help you
   avoid encountering similar errors in the future.

   On May 19, 7:17 pm, bradmaxs b...@pezzano.com wrote:

I want to send an email with the email component.  No problem there.

However, I don't want it to be a hidden field in the form so I thought
I could do something in the controller.

So I did this line:

$email = $this-User-find('first', array('conditions' =
array('User.id' = $this-data['Friend']['friend_id']), 'fields' =
'User.email_address'));

Which to my surprise (still learning all of these functions) it did
get the email address but the find function turns the info into an
array and then the email component has an array to deal with rather
than the specific string (email_address).

I thought I could use the field() method but I am confused as to how
to get it to work and there isn't much documentation.

I tried:

$email = User-field('email_address', array('id' = $this-

data['Friend']['friend_id']));

and got:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /var/www/
vhosts/theactorstoolkit.com/httpdocs/app/controllers/
users_controller.php  on line 69

which shows up on the screen before I even get to the page.

I tried:

$email = $model-field('email_address', array('id' = $this-

data['Friend']['friend_id']));

and once I submit the form it gives me:

Notice (8): Undefined variable: model [APP/controllers/
users_controller.php, line 69]

Anyone know how this should be done.

Thank you!

Brad

Check out the new CakePHP Questions 
sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.

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 athttp://groups.google.com/group/cake-php?hl=en

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
   with their CakePHP related questions.

   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 
   athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Why uses CKeditor in Cake 1.3?

2010-05-21 Thread Celso
Anyone have a example?
Thanks,
Celso.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Why uses CKeditor in Cake 1.3?

2010-05-21 Thread Matthew Powell
Unpack ckeditor to app/webroot/ckeditor, then, in your view:

?php echo $this-Javascript-link('/ckeditor/ckeditor', false);?
?php echo $this-Form-textarea('some_textarea'); ?
script type='text/javascript'
CKEDITOR.replace('some_textarea');
/script


Matt

On Fri, May 21, 2010 at 12:53, Celso cels...@gmail.com wrote:
 Anyone have a example?
 Thanks,
 Celso.

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: ideas for handling user added images

2010-05-21 Thread John Andersen
You can place them outside the application folder, just use Apache
Alias to map them in under the webroot.

Alias /usr_img file path to the user image folder

Enjoy,
   John

On May 21, 8:27 am, mikeottinger mikeottin...@gmail.com wrote:
 Hi All,

   I have a site that allows the user, through an admin section, the
 ability to upload his own images to the site, a very poor man's CMS if
 you will. This has all worked pretty well but for one annoying aspect
 that I finally want to address. Currently all uploaded images are
 placed in app/webroot/img where they're used with the html helpers.
 Why I don't like this approach is that these files get mixed in with
 files under source control. My production server is basically an SVN
 checkout of the application. Everything is perfectly in synch with SVN
 except for these user uploaded images. What I had in mind was setting
 aside a directory outside of the cakephp app instance and have my
 image paths point to there. This doesn't work because this outside
 directory is not a document root to the web server. I suppose I could
 setup a separate host configuration within apache and place them in
 its document root. Long story short, has anyone devised any better
 ways to keep user generated content out of the application's directory
 structure?

 Thanks in advance.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Why uses CKeditor in Cake 1.3?

2010-05-21 Thread Davor Ilic
isnt ckeditor with a license and you have to buy it for commercial use

2010/5/21 Matthew Powell php...@gmail.com

 Unpack ckeditor to app/webroot/ckeditor, then, in your view:

 ?php echo $this-Javascript-link('/ckeditor/ckeditor', false);?
 ?php echo $this-Form-textarea('some_textarea'); ?
 script type='text/javascript'
 CKEDITOR.replace('some_textarea');
 /script


 Matt

 On Fri, May 21, 2010 at 12:53, Celso cels...@gmail.com wrote:
  Anyone have a example?
  Thanks,
  Celso.
 
  Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
  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.comcake-php%2bunsubscr...@googlegroups.comFor
   more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en
 

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Demo shell could not be loaded

2010-05-21 Thread dkirzhner
I am trying to create and run my first shell script in the cakePHP
1.3.

?php
class ProbeShell extends Shell {
function main() {}
}
?

When I try to run, I get this:
cake probe
Error: Class ProbeShell could not be loaded.

What am I missing? Thanks!

Regards,
Dmitry

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Pagination ordered by a field that is not in the table

2010-05-21 Thread Filipe
I'm using the version 1.2. When I try to order the pagination by a
field that is not in any table, for example, SUM(Model.field) AS
new_field, the pagination isn't ordered by this new_field. It happens
because in the file cake/libs/controller/controller.php, line 1017,
the expression $object-{$alias}-hasField($field) is false in that
case. We have changed this file, at the line 1021:

}else{ //line 1021
foreach ($this-paginate[$alias][fields] as
$columnName){
if(preg_match(/\b$field\b$/, $columnName)){
$options['order'][$field] = $value;
break;
}
}
}

Perhaps there are better solutions for this problem. I hope you
understand my english. Thank you.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: TimeHelper in cake, french language ?

2010-05-21 Thread John Andersen
The time helper uses the __() function to translate the time labels,
should you provide them.
Look at the time helper code and see which labels are used and then
provide the corresponding translations in your language.

For example, the time helper method niceShort:
[code]
function niceShort($dateString = null, $userOffset = null) {
105 $date = $dateString ? $this-fromString($dateString,
$userOffset) : time();
106
107 $y = $this-isThisYear($date) ? '' : ' Y';
108
109 if ($this-isToday($date)) {
110 $ret = sprintf(__('Today, %s',true), date(H:i, $date));
111 } elseif ($this-wasYesterday($date)) {
112 $ret = sprintf(__('Yesterday, %s',true), date(H:i, $date));
113 } else {
114 $ret = date(M jS{$y}, H:i, $date);
115 }
116
117 return $this-output($ret);
[/code]

As you can see in line 110, the time helper uses __() function with
the text Today, %s, so you just have to provide the french
translation for that.

Browse through the code and find all occurrences for your translation.
Enjoy,
   John

On May 21, 5:11 pm, Abraham Boray abrahambo...@gmail.com wrote:
 How can I translate or make the time helper in french
 Actually I'm on a french project(I mean a french language)
 And I need time helper in french  as well to print time in french
 Intead of    2 weeks, 3 days ago   == depuis 2 semaines et 3 jours

 Got it guys ?

 Thx in advance ;)

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Validate REST input

2010-05-21 Thread Henrik Gemal
I have a controller which is being called with different paramters
like:
/test/do?start=2010-01-01end=2011-01-01test=1super=8

Now I like to user cake to validate the input parameters. How do I do
that?

I like to specify that start and end are dates and test is numeric and
super is also numeric.

Can CakePHP do this?

I'm not saving the parameters into a database so I cant just use $this-
save($data)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Why uses CKeditor in Cake 1.3?

2010-05-21 Thread Celso

Thanks
Matthew !!! But I would like in a component way... no sucess :(

?php
App::import('Plugin', 'CKEditor', array('file' =
'ckeditor'.DS.'ckeditor.php'));
App::import('Plugin', 'CKFinder', array('file' =
'ckeditor'.DS.'ckfinder.php'));

class CkeditorComponent extends Object {
var $controller;

function startup( $controller ) {
debug(CKEditor); //Do not returns anything
$this-controller = $controller;
}

function create() {

$ckeditor = new CKEditor();
$ckeditor-basePath = '/ckeditor/';
CKFinder::SetupCKEditor($ckeditor, '/ckfinder/');
$ckeditor-editor('CKEditor1');

}

}


And..about license: http://ckeditor.com/license

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Sending Email from Shell

2010-05-21 Thread bujanga
This is the code I use:

//  IMPORT AND INITIALIZE EMAIL COMPONENT
App::import('Core', 'Controller');
App::import('Component', 'Email');
$this-Controller = new Controller();
$this-Email = new EmailComponent(null);
$this-Email-initialize($this-Controller);

A few minor differences from yours. Maybe give it a try.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Help with User - Friend HABTM relationship

2010-05-21 Thread bradmaxs
Worked like a charm! Thanks again!

On May 20, 9:52 pm, bradmaxs b...@pezzano.com wrote:
 Thank you Calvin.  Working hard to figure all of this out and your
 suggestion was exactly what I was looking for.

 I will be working on this tomorrow and let you know how it works out.

 On May 20, 6:36 pm, calvin cal...@rottenrecords.com wrote:



  That's a PHP question, not a Cake question.

  If you want to combine the arrays, then just combine them like you
  would any other array.

  If you have:

  $friends = array('friend 1', 'friend 2', 'friend 3', ...);
  $admirers = array('admirer 1', 'admirer 2', 'admirer 3', ...);

  how would you combine them?

  Well, the obvious solution is with array_merge():
  $friendsAndAdmirers = array_merge($friends, $admirers);

  If you want to filter out duplicates (i.e. if a person is both a
  friend and an admirer), then use array_unique() on top of
  array_merge().

  I would suggest bookmarking--or, better yet, installing the Firefox
  search tool for--the PHP Manual:http://us3.php.net/manual/en/index.php

  On May 20, 11:31 am, bradmaxs b...@pezzano.com wrote:

   Anyone able to help me on this?

   On May 18, 4:55 pm, bradmaxs b...@pezzano.com wrote:

Hello All,

In response to the following post:

   http://groups.google.com/group/cake-php/browse_thread/thread/c8ebc209...

I have come up with my users having friends and admirers, thank you
gentlemen for that.

I am getting the array for both of them in my dump.

    [friend] = Array
        (
            [0] = Array
                (
                    [id] = 3
                    [username] = artist

                    [Friend] = Array
                        (
                            [id] = 1
                            [user_id] = 4
                            [friend_id] = 3
                            [approved] = 1
                        )

                )

            [1] = Array
                (
                    [id] = 5
                    [username] = testing

                    [Friend] = Array
                        (
                            [id] = 2
                            [user_id] = 4
                            [friend_id] = 5
                            [approved] = 1
                        )

                )

        )

    [admirer] = Array
        (
            [0] = Array
                (
                    [id] = 5
                    [username] = testing

                    [Friend] = Array
                        (
                            [id] = 3
                            [user_id] = 5
                            [friend_id] = 4
                            [approved] = 0

My question, and I think it is simple but I am still a newbie for the
most part -

How do I combine that data in the view to have both friends and
admirers as part of the same foreach statement?

Is that possible?  I have looked at Set::merge and tried that from the
controller.  Looked at custom query methods but the data is already
there in an array so I am a little stuck.

Here is what is in my view for the friends array and it is working
fine.  Just don't know how to get the admirer as part of it.

?php foreach ($user['friend'] as $friend): ?
?php echo $friend['username'];?
?php echo $friend['created'];?
?php echo $this-Html-link(__('View', true), array('controller' =
'friends', 'action' = 'view', $friend['id'])); ?
?php echo $this-Html-link(__('Delete', true), array('controller' =
'friends', 'action' = 'delete', $friend['id']), null, sprintf(__('Are
you sure you want to delete # %s?', true), $friend['id'])); ?
?php endforeach; ?

Thanks for any help!

Brad

Check out the new CakePHP Questions 
sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.

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 athttp://groups.google.com/group/cake-php?hl=en

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
   with their CakePHP related questions.

   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 
   athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  You received this message because you are subscribed to the 

Re: Why uses CKeditor in Cake 1.3?

2010-05-21 Thread AD7six


On May 21, 8:52 pm, Celso cels...@gmail.com wrote:
 Thanks
 Matthew !!! But I would like in a component way... no sucess :(

 ?php
 App::import('Plugin', 'CKEditor', array('file' =
 'ckeditor'.DS.'ckeditor.php'));
 App::import('Plugin', 'CKFinder', array('file' =
 'ckeditor'.DS.'ckfinder.php'));

 class CkeditorComponent extends Object {
         var $controller;

         function startup( $controller ) {
                 debug(CKEditor); //Do not returns anything
                 $this-controller = $controller;
         }

         function create() {

                 $ckeditor = new CKEditor();
                 $ckeditor-basePath = '/ckeditor/';
                 CKFinder::SetupCKEditor($ckeditor, '/ckfinder/');
                 $ckeditor-editor('CKEditor1');

         }

 }

Are you randomly making that code up ...?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: TimeHelper in cake, french language ?

2010-05-21 Thread Abraham Boray
Pretty nice solution, but I found it a little far away from
professionalism.

Isn't there any variant 4 the time helper in french and keep the
english one 4 future purpose ?



On May 21, 8:21 pm, John Andersen j.andersen...@gmail.com wrote:
 The time helper uses the __() function to translate the time labels,
 should you provide them.
 Look at the time helper code and see which labels are used and then
 provide the corresponding translations in your language.

 For example, the time helper method niceShort:
 [code]
 function niceShort($dateString = null, $userOffset = null) {
 105     $date = $dateString ? $this-fromString($dateString,
 $userOffset) : time();
 106
 107     $y = $this-isThisYear($date) ? '' : ' Y';
 108
 109     if ($this-isToday($date)) {
 110     $ret = sprintf(__('Today, %s',true), date(H:i, $date));
 111     } elseif ($this-wasYesterday($date)) {
 112     $ret = sprintf(__('Yesterday, %s',true), date(H:i, $date));
 113     } else {
 114     $ret = date(M jS{$y}, H:i, $date);
 115     }
 116
 117     return $this-output($ret);
 [/code]

 As you can see in line 110, the time helper uses __() function with
 the text Today, %s, so you just have to provide the french
 translation for that.

 Browse through the code and find all occurrences for your translation.
 Enjoy,
    John

 On May 21, 5:11 pm, Abraham Boray abrahambo...@gmail.com wrote:

  How can I translate or make the time helper in french
  Actually I'm on a french project(I mean a french language)
  And I need time helper in french  as well to print time in french
  Intead of    2 weeks, 3 days ago   == depuis 2 semaines et 3 jours

  Got it guys ?

  Thx in advance ;)

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 IIS

2010-05-21 Thread WhyNotSmile
I had this problem a few weeks ago.  The thread is here:
http://groups.google.co.uk/group/cake-php/browse_thread/thread/c40445a733078b3/60af200dd7bf5415#60af200dd7bf5415

Uncommenting the line:
 Configure::write('App.baseUrl', env('SCRIPT_NAME'));
in core.php helped.  I think I did a few other things as well; I can't
remember off the top of my head, but give that a go, and if you're
still stuck, I'll look it up and see what I did.

I remember looking a lot of stuff up on Google, and they all made it
sound like it was really complicated, but I found it ok to get up and
running (although I lost pretty urls - if you need those, it may be
more complex).

Sharon



On May 21, 5:09 pm, McFrosty mcfro...@gmail.com wrote:
 Howdy all,

 I have what is probably a stupid question.  I have to run cake in an
 IIS environment without redirection.  I am able to get to the apps as
 needed, but I'm having a tough time with the webroot folder, or more
 precisely, the information under there.  It appears that none of my
 pages can access the css or img files under the webroot folder.

 Is there a way to change the paths to these items?

 Thanks!

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Simple Acl controlled Application

2010-05-21 Thread Jonathan
I'm also unable to find the sql file, db_acl.sql. The php file that is
located in app/config/schema is not what I need because I cannot run
the command line utility at my host.

On Apr 27, 8:51 pm, cricket zijn.digi...@gmail.com wrote:
 On Apr 27, 5:52 pm, zamees h...@halrotholz.com wrote:

  Has the 10.2 Tutorial been tested using Cake1.3? I get all sorts of
  warnings and fatal errors. Initially due to sessions, which is never
  explained that it now needs to be explicitely included as a
  component, and after that just a random fatal error. The added groups
  never make it into the aros db.

 Since when did I not have to specify that SessionComponent should be
 loaded? Are you ure you didn't have it loaded in AppController before?
 That's what I usually do, meaning that I never need to include it in
 any of my controllers.

 http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3http://book.cakephp.org/view/1572/New-features-in-CakePHP-1-3

  Also, there doesnt appear to be a path/to/app/config/sql/db_acl.sql
  file located in a /sql directory, as there is no /sql directory.

 You should poke around a bit. It's in the app/schema/ dir.

  Can someone clarify any of this, or update the tutorial to work with
 1.3. Does the tutorial work with 1.2?

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Validate REST input

2010-05-21 Thread calvin
Use $this-validates()

But why not use Cake's named parameters? (e.g. /test/do/start:
2010-01-01/end:2010-01-01/test:1/super:8)

On May 21, 11:51 am, Henrik Gemal henrikge...@gmail.com wrote:
 I have a controller which is being called with different paramters
 like:
 /test/do?start=2010-01-01end=2011-01-01test=1super=8

 Now I like to user cake to validate the input parameters. How do I do
 that?

 I like to specify that start and end are dates and test is numeric and
 super is also numeric.

 Can CakePHP do this?

 I'm not saving the parameters into a database so I cant just use $this-

 save($data)

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: ideas for handling user added images

2010-05-21 Thread mikeottinger
Thanks for the advice guys. I've taken the path of least resistance
and left everything in the webroot/img directory. I simply make my www
directory the target of an svn export. So...

svn export --force repo path www

This will output my svn repo to www and the --force flag ensures I
don't wipe out the user added images.

Thanks again!

On May 21, 11:15 am, John Andersen j.andersen...@gmail.com wrote:
 You can place them outside the application folder, just use Apache
 Alias to map them in under the webroot.

 Alias /usr_img file path to the user image folder

 Enjoy,
    John

 On May 21, 8:27 am,mikeottingermikeottin...@gmail.com wrote:



  Hi All,

    I have a site that allows the user, through an admin section, the
  ability to upload his own images to the site, a very poor man's CMS if
  you will. This has all worked pretty well but for one annoying aspect
  that I finally want to address. Currently all uploaded images are
  placed in app/webroot/img where they're used with the html helpers.
  Why I don't like this approach is that these files get mixed in with
  files under source control. My production server is basically an SVN
  checkout of the application. Everything is perfectly in synch with SVN
  except for these user uploaded images. What I had in mind was setting
  aside a directory outside of the cakephp app instance and have my
  image paths point to there. This doesn't work because this outside
  directory is not a document root to the web server. I suppose I could
  setup a separate host configuration within apache and place them in
  its document root. Long story short, has anyone devised any better
  ways to keep user generated content out of the application's directory
  structure?

  Thanks in advance.

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 1.3 zip download problems

2010-05-21 Thread william ratke
I'm having trouble downloading the most recent CakePHP 1.3 release from 
the site. When I try to unzip it I get a 'The archive is either in an 
unknown format or damaged' error. I downloaded the RC4 version without 
any problems. Is it just me or does anyone else have this problem?


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Help needed sending tcp with syn to specific ip address

2010-05-21 Thread dilip bakotiya
Hi

i want to send  tcp to specific ip address with syn bit set so how i can set
at php


Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 can I consolidate conditions that I will use for every find?

2010-05-21 Thread shantamg
Every model in my app has a foreign key called schedule_id. I need
to narrow my finds so that they only return data with the schedule_id
that is in the session. The long and annoying way to do it this is:

function show($id) {
$this-Person-id = $id;
$schedule_id = $this-Session-read('Schedule.id');
$this-Person-contain(
Hobby.schedule_id = {$schedule_id},
Job.schedule_id = {$schedule_id}
);
$data = $this-Person-find('first', array(
'conditions' = array(
'Person.schedule_id' = $schedule_id
)
));

etc...

}

Is there a way to do something in the beforeFilter of the
appController (bindModel maybe?) that checks the session for the
schedule id and sets up the conditions so that all I have to do in the
controller action is something like this?:

function show($id) {
$this-Person-id = $id;
$this-Person-contain('Hobby', 'Job');
$data = $this-Person-find('first');

etc...

}

Thanks for your help!
Jason

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Simple Acl controlled Application

2010-05-21 Thread Jeremy Burns
Does your computer allow you do any sort of find across folders and files? Mine 
does (perhaps it's more modern than yours). I found your missing file!

/cake/console/templates/skel/config/schema/db_acl.sql

Jeremy Burns
jeremybu...@me.com


On 21 May 2010, at 21:56, Jonathan wrote:

 I'm also unable to find the sql file, db_acl.sql. The php file that is
 located in app/config/schema is not what I need because I cannot run
 the command line utility at my host.
 
 On Apr 27, 8:51 pm, cricket zijn.digi...@gmail.com wrote:
 On Apr 27, 5:52 pm, zamees h...@halrotholz.com wrote:
 
 Has the 10.2 Tutorial been tested using Cake1.3? I get all sorts of
 warnings and fatal errors. Initially due to sessions, which is never
 explained that it now needs to be explicitely included as a
 component, and after that just a random fatal error. The added groups
 never make it into the aros db.
 
 Since when did I not have to specify that SessionComponent should be
 loaded? Are you ure you didn't have it loaded in AppController before?
 That's what I usually do, meaning that I never need to include it in
 any of my controllers.
 
 http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3http://book.cakephp.org/view/1572/New-features-in-CakePHP-1-3
 
 Also, there doesnt appear to be a path/to/app/config/sql/db_acl.sql
 file located in a /sql directory, as there is no /sql directory.
 
 You should poke around a bit. It's in the app/schema/ dir.
 
 Can someone clarify any of this, or update the tutorial to work with
 1.3. Does the tutorial work with 1.2?
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
 with their CakePHP related questions.
 
 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 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 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 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Pagination ordered by a field that is not in the table

2010-05-21 Thread matt
I have had this issue and in 1.2 got round it by changing my model
bindings on the fly.  However if you can upgrade to 1.3 you can have
that calculated field defined as a virtual field which will make
sorting by it much easier to do.

On May 21, 4:12 pm, Filipe filipe.t2...@gmail.com wrote:
 I'm using the version 1.2. When I try to order the pagination by a
 field that is not in any table, for example, SUM(Model.field) AS
 new_field, the pagination isn't ordered by this new_field. It happens
 because in the file cake/libs/controller/controller.php, line 1017,
 the expression $object-{$alias}-hasField($field) is false in that
 case. We have changed this file, at the line 1021:

             }else{     //line 1021
                 foreach ($this-paginate[$alias][fields] as
 $columnName){
                     if(preg_match(/\b$field\b$/, $columnName)){
                         $options['order'][$field] = $value;
                         break;
                     }
                 }
             }

 Perhaps there are better solutions for this problem. I hope you
 understand my english. Thank you.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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