Re: $this-data donot retreive any value

2009-07-24 Thread aswamr


Following is my add.thtml
 
form action=?php echo $html-url(/notes/add)? method=post
pTitle:
 ?php echo $form-input('Note/title',array('size'='40'));?
/p
pBody:
 ?php echo $form-textarea('Note/body') ?
/p
p
 ?php echo $form-submit('save'); ?
/p
/form

Is this naming ok?
-- 
View this message in context: 
http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp24625878p24639250.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Using CakePHP-bake , some of the database table names get changed in model files...why is it so?

2009-07-24 Thread Anibigi

Hi,

I am using Bake to create models for my database tables.
I have run into a little problem.

I have 25 tables 

I strated baking the models until for one of the database tables the
bake started giving a name of it own to the model,file and class.

For example ,the table in database is named :  'risk_manager'

(It has association with other tables which i'm defining while baking)

However the model for this turns up as a file called risk.php and
the class name is called risk (but it is mapped to the correct
table.)

Why is this happening...?





--~--~-~--~~~---~--~~
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: $this-data donot retreive any value

2009-07-24 Thread thatsgreat2345

Have you even read the documentation at all? I would really recommend
doing the blog before you take anything else on.

but
$form-create('Note',array('action'='add'));
$form-input('Note.title'); //or just $form-input('title');
$form-input('Note.body',array('rows'=5,'cols'=5));
$form-end('Save');

All with echos of course, and I was too lazy to add in the p tags,
which can be utilized with before and after options, or just use the
div option for possibly better styling with css. For more options
hceck out here
http://book.cakephp.org/view/189/Automagic-Form-Elements

On Jul 23, 11:23 pm, aswamr aswathi@gmail.com wrote:
 Following is my add.thtml

 form action=?php echo $html-url(/notes/add)? method=post
         pTitle:
          ?php echo $form-input('Note/title',array('size'='40'));?
         /p
         pBody:
          ?php echo $form-textarea('Note/body') ?
         /p
         p
          ?php echo $form-submit('save'); ?
         /p
     /form

 Is this naming ok?
 --
 View this message in 
 context:http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp2462...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Download code for downloading a file

2009-07-24 Thread Rufus

Here is my code:

pdfDir is defined constant fyi


function download($id = null) {

if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid Invoice', true));
$this-redirect(array('action'='index'));
}

Configure::write('debug', 0);
$file = $this-Invoice-findById($id);
if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename
(pdfDir.$file['Invoice']['file_name']));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-
check=0');
header('Pragma: public');
header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
['file_name']));
ob_clean();
flush();
readfile(pdfDir.$file['Invoice']['file_name']);
exit;
} else {
$this-Session-setFlash(__('File Does Not Exist', 
true));
$this-redirect(array('action'='index'));
}

}

On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
 Hello All,

 I uploads the files to webroot/uploads folder from the file uploading
 component.

 Now I am trying to download that file from webroot/uploads folder but
 it is giving me 0 byte file.

 Code is as follows,

 function admin_download($id)
     {
         $this-adminchecksession();
             // you'll want to check the login status here ...

             $result = $this-Application-findById($id);

             Configure::write('debug', 0);
             $this-view = 'Media';

             /* MediaView is really irritating
              */
             //$name = $result['Application']['resume'];

             $ext = explode(. ,$result['Application']['resume']);

             $params = array(
                     'name' = $ext[0],
                     'download' = true,
                     'extension' = $ext[1],
                     'path' = APP.webroot/uploads.DS,
                     'mimeType' = array($result['Application']
 ['type'])
             );

             $this-set($params);

     }

 Please help me on this.
--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Vijay Kumbhar
i have removed that array too. but it is not still giving the file to
download.

On Fri, Jul 24, 2009 at 8:06 AM, brian bally.z...@gmail.com wrote:


 mimeType should be a string, not an array. Why do you assign it as
 array($result['Application']['type'])?

 On Thu, Jul 23, 2009 at 2:23 PM, Vijay Kumbhark.vidn...@gmail.com wrote:
  Hello Brian,
 
  Thanks for your reply.I have done as you told it gave me the $param
 values.
  But it is not giving me download window :( .
 
  here is code as you told to comment the part,
 
 //Configure::write('debug', 0);
 
  $this-view = 'Media';
 
  /* MediaView is really irritating
   */
  //$name = $result['Application']['resume'];
 
  $ext = explode(. ,$result['Application']['resume']);
 
  $params = array(
  'name' = $ext[0],
  'download' = true,
  'extension' = $ext[1],
  'path' = APP.webroot/uploads.DS,
  'mimeType' = array($result['Application']['type'])
  );
 
  $this-set($params);
 
  die(debug($params));
 
  And the output is as follows,
 
  app/controllers/applications_controller.php (line 198)
 
  Array
  (
  [name] = resume-1
  [download] = 1
  [extension] = doc
  [path] = MY_SERVER_DOCUMENT_PATH/app/webroot/uploads/
  [mimeType] = Array
  (
 
  [0] = application/msword
  )
 
  )
 
  Please help.
 
  On Thu, Jul 23, 2009 at 10:15 PM, brian bally.z...@gmail.com wrote:
 
  I like how you left my snarky comment in the code I'd posted :-)
 
  Try commenting out the Configure::write('debug', 0) and, after you've
  set the $params array, put:
 
  die(debug($params));
 
  ... so that you can see if the values are all what you're expecting.
 
  Of course, you should also ensure that the file is where you think it
  is and that the permissions allow the server to read it.
 
  On Thu, Jul 23, 2009 at 10:44 AM, Vijayk.vidn...@gmail.com wrote:
  
   Hello All,
  
   I uploads the files to webroot/uploads folder from the file uploading
   component.
  
   Now I am trying to download that file from webroot/uploads folder but
   it is giving me 0 byte file.
  
   Code is as follows,
  
   function admin_download($id)
  {
  $this-adminchecksession();
  // you'll want to check the login status here ...
  
  $result = $this-Application-findById($id);
  
  Configure::write('debug', 0);
  $this-view = 'Media';
  
  /* MediaView is really irritating
   */
  //$name = $result['Application']['resume'];
  
  $ext = explode(. ,$result['Application']['resume']);
  
  $params = array(
  'name' = $ext[0],
  'download' = true,
  'extension' = $ext[1],
  'path' = APP.webroot/uploads.DS,
  'mimeType' = array($result['Application']
   ['type'])
  );
  
  $this-set($params);
  
  }
  
  
   Please help me on this.
   
  
 
 
 
 
 
  --
  Thanks  Regards,
  Vijayk.
  Co-founder (www.weboniselab.com)
 
  You Bring the Dreams, We'll Bring the Means
 
  
 

 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Rufus

I would imagine if you are getting an empty file you a referencing the
file incorrectly. Try echo out your path and make sure its correct.

make sure

On Jul 24, 5:39 pm, Vijay Kumbhar k.vidn...@gmail.com wrote:
 i have removed that array too. but it is not still giving the file to
 download.



 On Fri, Jul 24, 2009 at 8:06 AM, brian bally.z...@gmail.com wrote:

  mimeType should be a string, not an array. Why do you assign it as
  array($result['Application']['type'])?

  On Thu, Jul 23, 2009 at 2:23 PM, Vijay Kumbhark.vidn...@gmail.com wrote:
   Hello Brian,

   Thanks for your reply.I have done as you told it gave me the $param
  values.
   But it is not giving me download window :( .

   here is code as you told to comment the part,

              //Configure::write('debug', 0);

               $this-view = 'Media';

               /* MediaView is really irritating
                */
               //$name = $result['Application']['resume'];

               $ext = explode(. ,$result['Application']['resume']);

               $params = array(
                       'name' = $ext[0],
                       'download' = true,
                       'extension' = $ext[1],
                       'path' = APP.webroot/uploads.DS,
                       'mimeType' = array($result['Application']['type'])
               );

               $this-set($params);

               die(debug($params));

   And the output is as follows,

   app/controllers/applications_controller.php (line 198)

   Array
   (
       [name] = resume-1
       [download] = 1
       [extension] = doc
       [path] = MY_SERVER_DOCUMENT_PATH/app/webroot/uploads/
       [mimeType] = Array
           (

               [0] = application/msword
           )

   )

   Please help.

   On Thu, Jul 23, 2009 at 10:15 PM, brian bally.z...@gmail.com wrote:

   I like how you left my snarky comment in the code I'd posted :-)

   Try commenting out the Configure::write('debug', 0) and, after you've
   set the $params array, put:

   die(debug($params));

   ... so that you can see if the values are all what you're expecting.

   Of course, you should also ensure that the file is where you think it
   is and that the permissions allow the server to read it.

   On Thu, Jul 23, 2009 at 10:44 AM, Vijayk.vidn...@gmail.com wrote:

Hello All,

I uploads the files to webroot/uploads folder from the file uploading
component.

Now I am trying to download that file from webroot/uploads folder but
it is giving me 0 byte file.

Code is as follows,

function admin_download($id)
   {
       $this-adminchecksession();
           // you'll want to check the login status here ...

           $result = $this-Application-findById($id);

           Configure::write('debug', 0);
           $this-view = 'Media';

           /* MediaView is really irritating
            */
           //$name = $result['Application']['resume'];

           $ext = explode(. ,$result['Application']['resume']);

           $params = array(
                   'name' = $ext[0],
                   'download' = true,
                   'extension' = $ext[1],
                   'path' = APP.webroot/uploads.DS,
                   'mimeType' = array($result['Application']
['type'])
           );

           $this-set($params);

   }

Please help me on this.

   --
   Thanks  Regards,
   Vijayk.
   Co-founder (www.weboniselab.com)

   You Bring the Dreams, We'll Bring the Means

 --
 Thanks  Regards,
 Vijayk.
 Co-founder (www.weboniselab.com)

 You Bring the Dreams, We'll Bring the Means
--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Vijay Kumbhar
Yeah...

Thanks rufus it works .

only i changed this line,

header('Content-Type: application/octet-stream'); to

header(Content-Type: .$result['Application']['resume']).);

that is the content type of the uploaded file coming from my database.


Thanks again...

On Fri, Jul 24, 2009 at 12:53 PM, Rufus rufusp...@gmail.com wrote:


 Here is my code:

 pdfDir is defined constant fyi


function download($id = null) {

if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid Invoice',
 true));
$this-redirect(array('action'='index'));
}

Configure::write('debug', 0);
$file = $this-Invoice-findById($id);
if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename
 (pdfDir.$file['Invoice']['file_name']));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-
 check=0');
header('Pragma: public');
header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
 ['file_name']));
ob_clean();
flush();
readfile(pdfDir.$file['Invoice']['file_name']);
exit;
} else {
$this-Session-setFlash(__('File Does Not Exist',
 true));
$this-redirect(array('action'='index'));
 }

}

 On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
  Hello All,
 
  I uploads the files to webroot/uploads folder from the file uploading
  component.
 
  Now I am trying to download that file from webroot/uploads folder but
  it is giving me 0 byte file.
 
  Code is as follows,
 
  function admin_download($id)
  {
  $this-adminchecksession();
  // you'll want to check the login status here ...
 
  $result = $this-Application-findById($id);
 
  Configure::write('debug', 0);
  $this-view = 'Media';
 
  /* MediaView is really irritating
   */
  //$name = $result['Application']['resume'];
 
  $ext = explode(. ,$result['Application']['resume']);
 
  $params = array(
  'name' = $ext[0],
  'download' = true,
  'extension' = $ext[1],
  'path' = APP.webroot/uploads.DS,
  'mimeType' = array($result['Application']
  ['type'])
  );
 
  $this-set($params);
 
  }
 
  Please help me on this.
 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Vijay Kumbhar
Also i have created a code  it also worked  :)

// your file to upload
  $result = $this-Application-findById($id);

  // your file to upload
  $file = APP.webroot/uploads.DS.$result['Application']['resume'];
  header(Pragma: public);
  header(Expires: 0);
  header(Cache-Control: must-revalidate, post-check=0,
pre-check=0);
  header(Cache-Control: private,false);
  header(Content-Type: .$result['Application']['type']. );
  header(Content-Disposition: attachment;
filename=\.$result['Application']['resume'].\;);
  header(Content-Transfer-Encoding:­ binary);
  //header(Content-Length: .$filesize);
  readfile($file);
  exit;



On Fri, Jul 24, 2009 at 1:28 PM, Vijay Kumbhar k.vidn...@gmail.com wrote:

 Yeah...

 Thanks rufus it works .

 only i changed this line,

 header('Content-Type: application/octet-stream'); to

 header(Content-Type: .$result['Application']['resume']).);

 that is the content type of the uploaded file coming from my database.


 Thanks again...


 On Fri, Jul 24, 2009 at 12:53 PM, Rufus rufusp...@gmail.com wrote:


 Here is my code:

 pdfDir is defined constant fyi


function download($id = null) {

if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid Invoice',
 true));
$this-redirect(array('action'='index'));
}

Configure::write('debug', 0);
$file = $this-Invoice-findById($id);
if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename
 (pdfDir.$file['Invoice']['file_name']));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-
 check=0');
header('Pragma: public');
header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
 ['file_name']));
ob_clean();
flush();
readfile(pdfDir.$file['Invoice']['file_name']);
exit;
} else {
$this-Session-setFlash(__('File Does Not Exist',
 true));
$this-redirect(array('action'='index'));
 }

}

 On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
  Hello All,
 
  I uploads the files to webroot/uploads folder from the file uploading
  component.
 
  Now I am trying to download that file from webroot/uploads folder but
  it is giving me 0 byte file.
 
  Code is as follows,
 
  function admin_download($id)
  {
  $this-adminchecksession();
  // you'll want to check the login status here ...
 
  $result = $this-Application-findById($id);
 
  Configure::write('debug', 0);
  $this-view = 'Media';
 
  /* MediaView is really irritating
   */
  //$name = $result['Application']['resume'];
 
  $ext = explode(. ,$result['Application']['resume']);
 
  $params = array(
  'name' = $ext[0],
  'download' = true,
  'extension' = $ext[1],
  'path' = APP.webroot/uploads.DS,
  'mimeType' = array($result['Application']
  ['type'])
  );
 
  $this-set($params);
 
  }
 
  Please help me on this.
 



 --
 Thanks  Regards,
 Vijayk.
 Co-founder (www.weboniselab.com)

 You Bring the Dreams, We'll Bring the Means




-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: $this-data donot retreive any value

2009-07-24 Thread Vijay Kumbhar
Hey aswamr,

can you follow the cake bake commands.It is a awesome feature of cakephp
which creates the controllers , models , view on the fly with the common
functions like index ,add, edit, delete , admin_index ,admin_add , .and
so on.
Only craete your table with the appropriate fields  see the magic of cake
bake.

So you dont care about the syntax that is used to create the form elements.

For this please follow following links,

http://book.cakephp.org/view/113/Code-Generation-with-Bake

For windows,

http://www.webdevelopment2.com/cakephp-bake-baking-models-controllers-views-cakephp-12/

Please read this.


On Fri, Jul 24, 2009 at 12:37 PM, thatsgreat2345
thatsgreat2...@gmail.comwrote:


 Have you even read the documentation at all? I would really recommend
 doing the blog before you take anything else on.

 but
 $form-create('Note',array('action'='add'));
 $form-input('Note.title'); //or just $form-input('title');
 $form-input('Note.body',array('rows'=5,'cols'=5));
 $form-end('Save');

 All with echos of course, and I was too lazy to add in the p tags,
 which can be utilized with before and after options, or just use the
 div option for possibly better styling with css. For more options
 hceck out here
 http://book.cakephp.org/view/189/Automagic-Form-Elements

 On Jul 23, 11:23 pm, aswamr aswathi@gmail.com wrote:
  Following is my add.thtml
 
  form action=?php echo $html-url(/notes/add)? method=post
  pTitle:
   ?php echo $form-input('Note/title',array('size'='40'));?
  /p
  pBody:
   ?php echo $form-textarea('Note/body') ?
  /p
  p
   ?php echo $form-submit('save'); ?
  /p
  /form
 
  Is this naming ok?
  --
  View this message in context:
 http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp2462...
  Sent from the CakePHP mailing list archive at Nabble.com.
 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Crazy

Will there be allot of file downloads?

If there will be a big load on the site from file downloads,
especially big files. Then it's not smart to handle it in cakephp.
Especially if you want to support download accellerators/resume
support

On every request(someone that uses a download accelerator and makes 10
requests), the cakephp framework is loaded.
This is accually not needed, because it's a plain file download.
Even if you want to check a couple of things in the database, it's
better to do it manually.

This ofcouse depends on the situation you're in.
In my case, using cakephp this way would crash my server within 5
minutes(if not faster)

You can find the code I use here:

http://pastebin.com/f179e1e49

I've been using it for several years and transfer 15 to 20tb per month
using that piece of code.


/Crazy

On Jul 24, 9:58 am, Vijay Kumbhar k.vidn...@gmail.com wrote:
 Yeah...

 Thanks rufus it works .

 only i changed this line,

 header('Content-Type: application/octet-stream'); to

 header(Content-Type: .$result['Application']['resume']).);

 that is the content type of the uploaded file coming from my database.

 Thanks again...



 On Fri, Jul 24, 2009 at 12:53 PM, Rufus rufusp...@gmail.com wrote:

  Here is my code:

  pdfDir is defined constant fyi

         function download($id = null) {

                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid Invoice',
  true));
                         $this-redirect(array('action'='index'));
                 }

                 Configure::write('debug', 0);
                 $file = $this-Invoice-findById($id);
     if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header('Content-Disposition: attachment; filename='.basename
  (pdfDir.$file['Invoice']['file_name']));
         header('Content-Transfer-Encoding: binary');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-
  check=0');
         header('Pragma: public');
         header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
  ['file_name']));
         ob_clean();
         flush();
         readfile(pdfDir.$file['Invoice']['file_name']);
         exit;
     } else {
                         $this-Session-setFlash(__('File Does Not Exist',
  true));
                         $this-redirect(array('action'='index'));
      }

         }

  On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
   Hello All,

   I uploads the files to webroot/uploads folder from the file uploading
   component.

   Now I am trying to download that file from webroot/uploads folder but
   it is giving me 0 byte file.

   Code is as follows,

   function admin_download($id)
       {
           $this-adminchecksession();
               // you'll want to check the login status here ...

               $result = $this-Application-findById($id);

               Configure::write('debug', 0);
               $this-view = 'Media';

               /* MediaView is really irritating
                */
               //$name = $result['Application']['resume'];

               $ext = explode(. ,$result['Application']['resume']);

               $params = array(
                       'name' = $ext[0],
                       'download' = true,
                       'extension' = $ext[1],
                       'path' = APP.webroot/uploads.DS,
                       'mimeType' = array($result['Application']
   ['type'])
               );

               $this-set($params);

       }

   Please help me on this.

 --
 Thanks  Regards,
 Vijayk.
 Co-founder (www.weboniselab.com)

 You Bring the Dreams, We'll Bring the Means
--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-24 Thread Vijay Kumbhar
Hey Crazy,

thanks a lot ... i will try this out.


On Fri, Jul 24, 2009 at 1:56 PM, Crazy crazy...@gmail.com wrote:


 Will there be allot of file downloads?

 If there will be a big load on the site from file downloads,
 especially big files. Then it's not smart to handle it in cakephp.
 Especially if you want to support download accellerators/resume
 support

 On every request(someone that uses a download accelerator and makes 10
 requests), the cakephp framework is loaded.
 This is accually not needed, because it's a plain file download.
 Even if you want to check a couple of things in the database, it's
 better to do it manually.

 This ofcouse depends on the situation you're in.
 In my case, using cakephp this way would crash my server within 5
 minutes(if not faster)

 You can find the code I use here:

 http://pastebin.com/f179e1e49

 I've been using it for several years and transfer 15 to 20tb per month
 using that piece of code.


 /Crazy

 On Jul 24, 9:58 am, Vijay Kumbhar k.vidn...@gmail.com wrote:
  Yeah...
 
  Thanks rufus it works .
 
  only i changed this line,
 
  header('Content-Type: application/octet-stream'); to
 
  header(Content-Type: .$result['Application']['resume']).);
 
  that is the content type of the uploaded file coming from my database.
 
  Thanks again...
 
 
 
  On Fri, Jul 24, 2009 at 12:53 PM, Rufus rufusp...@gmail.com wrote:
 
   Here is my code:
 
   pdfDir is defined constant fyi
 
  function download($id = null) {
 
  if (!$id  empty($this-data)) {
  $this-Session-setFlash(__('Invalid Invoice',
   true));
  $this-redirect(array('action'='index'));
  }
 
  Configure::write('debug', 0);
  $file = $this-Invoice-findById($id);
  if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
  header('Content-Description: File Transfer');
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename='.basename
   (pdfDir.$file['Invoice']['file_name']));
  header('Content-Transfer-Encoding: binary');
  header('Expires: 0');
  header('Cache-Control: must-revalidate, post-check=0, pre-
   check=0');
  header('Pragma: public');
  header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
   ['file_name']));
  ob_clean();
  flush();
  readfile(pdfDir.$file['Invoice']['file_name']);
  exit;
  } else {
  $this-Session-setFlash(__('File Does Not
 Exist',
   true));
  $this-redirect(array('action'='index'));
   }
 
  }
 
   On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
Hello All,
 
I uploads the files to webroot/uploads folder from the file uploading
component.
 
Now I am trying to download that file from webroot/uploads folder but
it is giving me 0 byte file.
 
Code is as follows,
 
function admin_download($id)
{
$this-adminchecksession();
// you'll want to check the login status here ...
 
$result = $this-Application-findById($id);
 
Configure::write('debug', 0);
$this-view = 'Media';
 
/* MediaView is really irritating
 */
//$name = $result['Application']['resume'];
 
$ext = explode(. ,$result['Application']['resume']);
 
$params = array(
'name' = $ext[0],
'download' = true,
'extension' = $ext[1],
'path' = APP.webroot/uploads.DS,
'mimeType' = array($result['Application']
['type'])
);
 
$this-set($params);
 
}
 
Please help me on this.
 
  --
  Thanks  Regards,
  Vijayk.
  Co-founder (www.weboniselab.com)
 
  You Bring the Dreams, We'll Bring the Means
 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

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



Define several paginators for one model

2009-07-24 Thread Bs

Hi,

I would like to define several paginators for one model. For example

users_controller.php:

var $paginate = array (.);

var $paginate2 = array (.);

var $paginate3 = array ();


so that I can use those in my views like this

$php echo $paginator-sort($paginate, Country'); ?
$php echo $paginator-sort($paginate2, Country'); ?
$php echo $paginator-sort($paginate3, Country'); ?


The thing is I want to provide the user with several buttons to
paginate the view after different orders. But with the standard
pagination this doesn't seem to be possible.

Can I achieve this by overwriting the paginate() method from the
Controller class?


--~--~-~--~~~---~--~~
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: Multiples lists of different tables :S

2009-07-24 Thread Abraham Boray

Thx Piotr ,I'm goign to check out that !

On Jul 21, 6:18 pm, Piotr Kilczuk kilc...@gmail.com wrote:
 Hello,

  Wot makes things harder in CakePHp is how to select records from a
  table depending on another one !! ill explain further.

  I got4 example 2 tables ::
    1-Categories
    2-Posts

   I want to get all the posts records whom r in a specific category .
   let's say that i want all the posts whom r in JQUERY category!

  thx Agin 4 ur response ,I appreciate

 Depends on relationship type... I guess this classical case (Posts 
 Comments) is well documented in Cakebook or am I wrong?

 Regards,
 Piotr
--~--~-~--~~~---~--~~
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: Define several paginators for one model

2009-07-24 Thread Bs

Right now I do the following to paginate my model after several orders
in one view:

- I created a function sort() in my controller which does the
following:


function sort()
{
$order = array();
if (($this-data['sort']['column1']) == 1)
{
$order['mymodel.column'] = 'asc';
}
if (($this-data['sort']['column2']) == 1)
{
$order['mymodel.column2'] = 'asc';
}
if (($this-data['sort']['Region']) == 1)
{
$order['Skigebiet.Region'] = 'asc';
}



$this-paginate = array(
 'fields' = array(),
 'limit' = 100,
 'order' = $order
);
$data = $this-paginate('mymodel');
$this-set('mymodels', $data);
$this-render('index');
}


and in my view I have a form sending the wished order (by checkboxes)
to the sort() method.
So I overwrite my paginate array each time.
Is there a better method doing this?
--~--~-~--~~~---~--~~
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: Define several paginators for one model

2009-07-24 Thread Bs


Right now I do the following to paginate my model after several orders
in one view:

- I created a function sort() in my controller which does the
following:

function sort()
{
$order = array();
if (($this-data['sort']['column1']) == 1)
{
$order['mymodel.column1'] = 'asc';
}
if (($this-data['sort']['column2']) == 1)
{
$order['mymodel.column2'] = 'asc';
}
if (($this-data['sort']['column3']) == 1)
{
$order['mymodel.column3'] = 'asc';
}



$this-paginate = array(
 'fields' = array(),
 'limit' = 100,
 'order' = $order
);
$data = $this-paginate('mymodel');
$this-set('mymodels', $data);
$this-render('index');
}

and in my view I have a form sending the wished order (by checkboxes)
to the sort() method.
So I overwrite my paginate array each time.
Is there a better method doing this?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



blackHole and Callback Question

2009-07-24 Thread Luke

Hi,

I am finally moving on with my first Cake Project. (Recipe Page) User
can add Recipes and of course they must be able to delete them aswell.
So if they are logged in, they see their own recipes. To secure other
recipes of being deleted, I wanted to use the Security Component. So I
added below in the recipe_controller function beforeFilter

  if(!$this-canAccess($this-Auth-user('id'), $this-params['pass']
[0])) {

   $this-Security-blackHoleCallback = 'accessError';
   $this-Security-blackHole($this);

  }

In my App Controller, I have now got the  function accessError()
method and

function canAccess($userId = null, $primaryKey = null)
{
   if($this-Recipe-find('first', array('conditions' = array
('recipe.user_id' = $userId, 'recipe.id'= $primaryKey),
   'recursive' = -1))) {
return true;
   }

return false;
}



I would like now that the User stays on the same site, but gets an
Error Message displayed. How would the accessError method have to look
to achieve this? I have searched through the www, but could not find
any examples.

Hope you guys understand what I am looking for. Is this the right way
to achieve it or how are you securing against manipulation?

Look forward to some ideas. Thanks so much in advance.


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



saveField updates more than the field

2009-07-24 Thread Dave Maharaj :: WidePixels.com
I have 
 
$this-Calculations-saveField('percent', $percent); which saves a math
formula to the field
 
But modified field is also getting updated which I do not want. Can we
specify that we only want the one field saved? Or just use save() and
include the fields we want to save instead of saveField?
 
Thanks
 
Dave 

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

2009-07-24 Thread Dhileepen Chakravarthy
Hi everybody,

I googling to do facebook in cakephp i got the following link
but it supports older version.
what is the sample url for newer version.

http://facebook-developer.net/2007/10/18/building-your-first-facebook-application-with-cakephp/

Regards,
Dhileep

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



HABTM

2009-07-24 Thread Farjad

i m defining a habtm relation between students table and courses table

now i want that when i call students to fetch the data particular
fields of course table are fetched.

currently all the fields of course table are fetched.

can someone help or guide
--~--~-~--~~~---~--~~
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: $this-data donot retreive any value

2009-07-24 Thread aswamr


thanks for the support. But still that problem remains

thanks for that link Vijay.
Once i tried with cake bake. but got stuck in the first configuration steps
itself.
I will go through those links and come back to u later.
-- 
View this message in context: 
http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp24625878p24644757.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Changing field type in scaffold form

2009-07-24 Thread Antônio Marco

Hi, folks!

FACTS:

[1] I'm using scaffolding;
[2] I have a table wich contains a INT2 column named LEVEL. This
column accepts only values IN (0, 1, 2, 3, 4, 5, 6);
[3] When the scaffold form is shown, the LEVEL field is a simple *
TEXT type * field.

My question is:

Would be possible to change a * TEXT type * field to a * SELECT type *
field by manipulating the $this-viewVars OR setting up something in
the related model OR something else?

Notice that I do not want manually create a form.

Any help will be welcome.
--~--~-~--~~~---~--~~
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: Redirect after AJAX request

2009-07-24 Thread NOSLOW

hey DatacenterHellas,

Your best bet is to not login via an AJAX call. Just set
standardSubmit: true in your ExtJS login FormPanel config and call
MyFormPanel.getForm().submit({method: 'POST'});. Now you can let
CakePHP handler your redirects server-side. On failure, you login page
will just reload. This works very well for me.

Here's some ExtJS code showing details of the login form:

Ext.namespace('CRM');
var crmLogin = {};
Ext.onReady(function(){

var crm_center = new Ext.Panel({
region: 'center',
layout: 'fit',
bodyBorder: false, border: false, hideBorders: true,
collapsible: false,
bodyStyle: 'border-style: none;',
width: 300,
items:
[
{
contentEl: 'center1'
}
]
});

var viewport = new Ext.Viewport({
layout: 'border',
items:
[
new Ext.BoxComponent({
title: 'North',
region: 'north',
el: 'north',
height: 80
}), new Ext.BoxComponent({
title: 'South',
region: 'south',
el: 'footer',
height: 30
}),
crm_center
]
});

Ext.QuickTips.init();

crmLogin = new Ext.FormPanel({
labelWidth: 70,
url: '/users/login',
frame: true,
title: 'Application Login',
width: 284,
bodyStyle: 'padding: 10px 0 5px 20px;',
defaultType: 'textfield',
standardSubmit: true,
monitorValid: true,

items:
[
{
name: '_method',
xtype: 'hidden',
value: 'POST'
},{
id: 'CRM-username',
fieldLabel: 'Username',
name: 'data[User][username]',
allowBlank: false
},{
id: 'CRM-password',
fieldLabel: 'Password',
name: 'data[User][password]',
inputType: 'password',
allowBlank: false
}
],

buttons:
[
{
text: 'Login',
formBind: true,
type: 'submit',
handler: function() {
CRM.login(crmLogin);
}
}
]
});

var win = new Ext.Window({
layout: 'fit',
width: 300,
height: 150,
closable: false,
resizable: false,
plain: true,
items: crmLogin
});

// defer delay seems to help with rendering of login form
(sometimes button is placed too low on form).
(function(){
win.show();
var mapPassword = new Ext.KeyMap('CRM-password', {
key: 13, // or Ext.EventObject.ENTER
fn: function() {CRM.login(crmLogin);}
,scope: crmLogin
});

var mapUsername = new Ext.KeyMap('CRM-username', {
key: 13, // or Ext.EventObject.ENTER
fn: function() {CRM.login(crmLogin);}
,scope: crmLogin
});
}).defer(200);

(function(){
crmLogin.getForm().findField('data[User][username]').focus();
}).defer(700);
});

CRM.login = function(loginFormPanel) {
loginFormPanel.ownerCt.hide();
Ext.MessageBox.wait('Logging in...', 'Please wait...');
loginFormPanel.getForm().submit({method: 'POST'});
};

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



Admin routing with language prefix in URL - problem.

2009-07-24 Thread mariusz.lewandowski

Hi, I have set in my Routes.php following routes:

Router::reload();

Router::connect(
'/:language/admin/:controller',
array('action' = 'index', 'language' = null, 'admin'
= true, 'prefix' = 'admin'),
array('language' = '[a-z]{2}')
);


Router::connect(
'/:language/admin/:controller/:action/*',
array('language' = null, 'admin' = true, 'prefix' =
'admin'),
array('language' = '[a-z]{2}')
);


Router::connect('/:language/:controller/:action/*',
   array(),
   array('language' = '[a-z]{2}'));

Everything works fine when I try to achieve URLS like:

/en/news/view/2
/fr/admin/news/add
/fr/admin/news/delete/2 (by using html link)

The problem appear, when i want to edit something and use form-create

in HTML preview, that looks like:

form enctype=multipart action=localhost/admin/news/edit/33/
language:en

...
/form

why is like that?

Could you please help me?

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



routes.php: Where do the errors go?

2009-07-24 Thread DragonFlyEye

OK, I'm trying to figure this out and getting wacky results as I test:
I'm playing with custom-built routes in the following format:

/:town-name/:action/:id

The route works fine for correct URLs, but I'm confused as to what
CakePHP does with URLs which don't conform to the regex included in
the third argument to the Router::connect() method. Here is my code:

Router::connect(
'/:town-name/:action/:id',
array('controller' = 'potholes'),
array(
'town-name' = '[a-z/-]+',
'id' = '[a-z/-]+'));

If I put in an erroneous URL like /roch3ster/view/this-post, I get the
error Roch3sterController could not be found. If I put one in that
messes up the third parameter, /rochester/view/bo3ogers, I get
RochesterController could not be found.

It may be that some of the other routing I'm doing is messing up the
show. But can anyone tell me what the expected behavior aught to be?

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



newbie - Installation Inquiry for a multi-language web2.0 application

2009-07-24 Thread Mahmoud M. Abdel-Fattah

I'm working on Web 2.0 Application and will be hosted on cPanel
server. and here're some notes about my needs :

1. Multi-Lingual website.
2. each user will have it's own sub-domain to log-in, ex :
http://company.website.com/
3. want to install the cake in folder not root, so as I can install
some other products on the root. ex : CMS, Shopping cart for site
subscription.

So, Any Suggestions??

Thanks for your time :) !

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



Downloading and dealing with zip files

2009-07-24 Thread rhorn

I've done a little bit of searching, but was unable to find anything.
I have a situation where I need my application to download a zip file
(it's an archive of feeds), extract and access its contents. Would
like to keep it as cake friendly as possible, can anyone point me in
the right direction?

--~--~-~--~~~---~--~~
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: $this-data donot retreive any value

2009-07-24 Thread eromero_81

Try to make a debug or a var_dump for $this-data and see if it realy
contains the data... Also like everyone else said before check the
documentation... Remember that this data only containsn data from post
so check if the form is sending the data via post method if not add
'method' = 'POST' To your options array on form create.


On Jul 24, 6:41 am, aswamr aswathi@gmail.com wrote:
 thanks for the support. But still that problem remains

 thanks for that link Vijay.
 Once i tried with cake bake. but got stuck in the first configuration steps
 itself.
 I will go through those links and come back to u later.
 --
 View this message in 
 context:http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp2462...
 Sent from the CakePHP mailing list archive at Nabble.com.

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



validation is not working

2009-07-24 Thread anurag

This is freelesson module code for validation.but its not working

== freelesson.php===

class FreeLesson extends AppModel
{
var $name = 'FreeLesson';
var $validate = array(
'free_lesson_title' = array(
array('allowEmpty' = false, 'message' = 'Your Error 
Message'
),
'free_lesson_description'=array(
array('allowEmpty' = false, 'message' = 'Your Error 
Message')
),
);

}

===freelessons.php=

freelessons Class Controller code

function admin_add_free_lesson()
{
$this-layout='admin_dashboard';
$this-set('valid', true);
//$this-session_check();
if (!empty($this-data))
{
 $fileOK = $this-uploadFiles('upload\freelessons', 
$this-data
['FreeLessons']['free_lesson_name']);
 if($fileOK)
 {
 $this-data['FreeLessons']['free_lesson_name'] 
= $this-data
['FreeLessons']['free_lesson_name']['name'];
 if ($this-FreeLessons-save($this-data))
 {
$this-Session-setFlash('Your lesson 
data has been saved.');
$this-redirect(array('action' = 
'../admins/dashboard'));
 }
 }
}
}

If i am provide all data record has been saved,but when ever fields
are empty it will not display
any error message.
Please correct me

--~--~-~--~~~---~--~~
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: Using CakePHP-bake , some of the database table names get changed in model files...why is it so?

2009-07-24 Thread Carlos Suarez Fontalvo

I'm not understanding you. But, it seems you are not using the bake
shell properly.
In linux you must type: cakbe bake or cake bake model, and when it
asks for params lets say name of the table (is the name cake expect
the table might have). but if your table doesnt follow cakephp
conventions, you must type the correct name of the table for that
model. for example: If you have a table called user, cake in the
command: cake bake model, must expect that your table should be name
as users, instead of user, so if this happen, your are obligated
to say to the script that users is not the table name, and type
user in the script for correct coding generation. then, your model
is going to be called user.php, instead of cakephp conventional name
users.php.

I hope this can help you.

Regards.

On Jul 24, 1:50 am, Anibigi anamikasarkhe...@gmail.com wrote:
 Hi,

 I am using Bake to create models for my database tables.
 I have run into a little problem.

 I have 25 tables 

 I strated baking the models until for one of the database tables the
 bake started giving a name of it own to the model,file and class.

 For example ,the table in database is named :  'risk_manager'

 (It has association with other tables which i'm defining while baking)

 However the model for this turns up as a file called risk.php and
 the class name is called risk (but it is mapped to the correct
 table.)

 Why is this happening...?
--~--~-~--~~~---~--~~
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: Downloading and dealing with zip files

2009-07-24 Thread thatsgreat2345

fsock, or curl, and gzip

On Jul 24, 7:54 am, rhorn ryan.horn@gmail.com wrote:
 I've done a little bit of searching, but was unable to find anything.
 I have a situation where I need my application to download a zip file
 (it's an archive of feeds), extract and access its contents. Would
 like to keep it as cake friendly as possible, can anyone point me in
 the right direction?
--~--~-~--~~~---~--~~
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: Custom layout when using cakeError

2009-07-24 Thread toby1kenobi

I figured out how to do this, by creating app_error and overriding
_outputMessage.


toby1kenobi wrote:
 Hi there,

   Is it possible to specify an alternative layout for use when calling
 cakeError?

   Thanks,

 Toby
--~--~-~--~~~---~--~~
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: routes.php: Where do the errors go?

2009-07-24 Thread mark_story

Well if the request doesn't match any user land routes, cake tries to
use its default routes.  If those generate errors, that's what
happens.

-Mark

On Jul 24, 10:23 am, DragonFlyEye dragonflyey...@gmail.com wrote:
 OK, I'm trying to figure this out and getting wacky results as I test:
 I'm playing with custom-built routes in the following format:

 /:town-name/:action/:id

 The route works fine for correct URLs, but I'm confused as to what
 CakePHP does with URLs which don't conform to the regex included in
 the third argument to the Router::connect() method. Here is my code:

 Router::connect(
     '/:town-name/:action/:id',
     array('controller' = 'potholes'),
     array(
         'town-name' = '[a-z/-]+',
         'id' = '[a-z/-]+'));

 If I put in an erroneous URL like /roch3ster/view/this-post, I get the
 error Roch3sterController could not be found. If I put one in that
 messes up the third parameter, /rochester/view/bo3ogers, I get
 RochesterController could not be found.

 It may be that some of the other routing I'm doing is messing up the
 show. But can anyone tell me what the expected behavior aught to be?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Netbeans mod_rewrite support

2009-07-24 Thread matt

Netbeans is a free, open source, high quality, and feature rich IDE.
It is cross-platform compatible and actively being developed.
Netbean's mod_rewrite support is a dependency of Netbean's support for
CakePHP. The CakePHP issue has 120 votes and has been made top priority
(P1) while the mod_rewrite issue has only 4 votes and is only of
secondary priority(P2). Please, help vote them both up.

Register for an account here: http://www.netbeans.org/servlets/Join
Vote for mod_rewrite support here: 
http://www.netbeans.org/issues/show_bug.cgi?id=152262
Vote for CakePHP support here: 
http://www.netbeans.org/issues/show_bug.cgi?id=140918

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



unsigned column types

2009-07-24 Thread Miles J

Does cake do anything weird if I apply an unsigned attribute to any of
my int columns?
--~--~-~--~~~---~--~~
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 hasMany/belongsTo relationships - not returning related records.

2009-07-24 Thread mariusz.lewandowski

I'm also looking for some convinient way to avoid invoking bindModel
method ..

On Jul 23, 1:52 pm, Alastair alast...@zanginteractive.com wrote:
 Hi and many thanks for your help!

 This did work, however it doesn't make sense that I've had to do this
 in the first place! It seems like accessing the parent model of a
 child model is broken. I don't know if I'm doing something completely
 wrong but I can access my comments records from the user perfectly
 fine but am unable to access the User from a comment?

 Does anyone have any suggestions why this might be?

 Cheers,

 Alastair

 On Jul 23, 8:53 am, mariusz.lewandowski lew...@gmail.com wrote:

  I had the same issue.

  The resolutions goes like that: in beforeFilter i invoke:

          public function beforeFilter() {
                  $this-pageTitle = 'Portfolio';
                  $this-Portfolio-bindModel(array(
                                                  'belongsTo' = 
  array('Category'),
                                                  'hasMany' = 
  array('Image')));
          }

  And then you have an access to allrelatedmodels.

  Cheers.

  On 22 Lip, 19:11, Alastair alast...@zanginteractive.com wrote:

   Hoping someone can suggest something here!

   I have a number of models, which look as follows:

   Comment
   --

   class Comment extends AppModel
   {

           var $name = 'Comment';
           var $validate = array(
                   'body' = array('rule' = 'notEmpty')
           );

           var $belongsTo = array(
                   'User' = array(
                           'className' = 'User',
                           'foreignKey' = 'user_id',
                   ),
                   'Post' = array(
                           'className' = 'Post',
                           'foreignKey' = 'post_id',
                   ),
           );

   }

   Post
   ---

   class Post extends AppModel
   {

           var $name = 'Post';
           var $validate = array(
                   'title' = array('rule' = 'notEmpty'),
                   'body' = array('rule' = 'notEmpty')
           );

           var $hasMany = array('Comment');

   }

   User
   ---

   class User extends AppModel {

           var $actsAs = array('Acl' = array('requester'));
           var $hasOne = 'Member';
           var $name = 'User';

           var $belongsTo = array('Group');

           var $hasMany = array(
                   'Comment' = array(
                           'className' = 'Comment',
                           'foreignKey' = 'user_id'
                   )
           );

   }

   I'm calling the following find in my Posts controller:

   $comments = $this-Comment-find('all', array('recursive' = 2));

   I've declared var $uses = array('Post', 'Comment','User'); at the top
   of the posts controller.

   All I'm getting returned is an array of comments but not theirrelated
   users.

   Can anyone suggest why this might be?

   Many thanks!

   Alastair
--~--~-~--~~~---~--~~
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: unsigned column types

2009-07-24 Thread Mark

nope
i always use unsigned ints

- auto incr int(10)
- tinyint(1) toggles
- tinyint(2) enumeration fields
etc

only the cake bake schema seems not to like it
but its buggy anyway (comments and other special attributes get lost)
hopefully, this won't be a problem in the future


On 24 Jul., 22:19, Miles J mileswjohn...@gmail.com wrote:
 Does cake do anything weird if I apply an unsigned attribute to any of
 my int columns?
--~--~-~--~~~---~--~~
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: routes.php: Where do the errors go?

2009-07-24 Thread MrMeikel

In production mode (Debug = 0), Cake just displays the generic 404
error view I believe. From there you could work which part of the url
is wrong if you wanted, or just display the same view for either type
(or other) of error.

On Jul 24, 6:11 pm, mark_story mark.st...@gmail.com wrote:
 Well if the request doesn't match any user land routes, cake tries to
 use its default routes.  If those generate errors, that's what
 happens.

 -Mark

 On Jul 24, 10:23 am, DragonFlyEye dragonflyey...@gmail.com wrote:

  OK, I'm trying to figure this out and getting wacky results as I test:
  I'm playing with custom-built routes in the following format:

  /:town-name/:action/:id

  The route works fine for correct URLs, but I'm confused as to what
  CakePHP does with URLs which don't conform to the regex included in
  the third argument to the Router::connect() method. Here is my code:

  Router::connect(
      '/:town-name/:action/:id',
      array('controller' = 'potholes'),
      array(
          'town-name' = '[a-z/-]+',
          'id' = '[a-z/-]+'));

  If I put in an erroneous URL like /roch3ster/view/this-post, I get the
  error Roch3sterController could not be found. If I put one in that
  messes up the third parameter, /rochester/view/bo3ogers, I get
  RochesterController could not be found.

  It may be that some of the other routing I'm doing is messing up the
  show. But can anyone tell me what the expected behavior aught to be?


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