Re: Custom Bake Fails

2012-03-13 Thread gavrielh
I figured this out - for anyone interested, there's a missing directory 
under vendors/shells that needs to be there for this to work.  The custom 
bake templates need to be placed in a folder (any name of your choosing 
except for default) under the following directory - 
/app/vendors/shells/templates/.

On Monday, March 12, 2012 7:01:41 PM UTC-7, gavrielh wrote:

 I've changed some of the controller actions within the bake template 
 and cannot seem to get Cake Bake to use these custom templates.  I 
 have Cake 1.3 installed in the following manner: 

 /var/www/cakephp(root install, added to environment variables) 
 /var/www/myapp  (application code) 

 I copied the cake bake templates from 

 /var/www/cakephp/cake/console/templates/default 

 to 

 /var/www/myapp/vendors/shells/custom 

 When I navigate to /var/www/myapp and run 

 cake bake controller person 

 I end up with the standard out of the box cake controller, not my 
 custom bake template. 

 Am I doing something wrong here?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Cake Bake Model Template - Access Field Data Within Template

2012-03-13 Thread gavrielh
I'm trying to iterate over model fields within a custom Bake template - I 
can't seem to figure out what variables might be available that would allow 
me to iterate over the fields within the model.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cake Bake Model Template - Access Field Data Within Template

2012-03-13 Thread euromark
you can always output data on the console for development:

debug($schema[$field]); die();

etc (or you can log them into a file like `file_put_contents($tmpfile, 
print_r($schema, true));`)

this allows you to see what those variables contain.
be creative!

anyway, iterating over those fields you can do some pretty neat things:
https://github.com/dereuromark/setup/blob/master/Console/Templates/setup/views/index.ctp
 (for 
example)
to give you some ideas


Am Dienstag, 13. März 2012 10:02:59 UTC+1 schrieb gavrielh:

 I'm trying to iterate over model fields within a custom Bake template - I 
 can't seem to figure out what variables might be available that would allow 
 me to iterate over the fields within the model.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Filling in a drop down box - comments on code please

2012-03-13 Thread David Cole
In the controller you would do:

$this-loadModel('Page');
$this-set('pages', $this-Page-find('list'));

Simple and easy. I don't know if this is the right way, but its what
I was shown long ago and it has never failed me.

On Mar 12, 7:02 am, Graham graham.h.jo...@gmail.com wrote:
 Dear All. I would like some advice please. I am new to CakePHP and so far I
 am loving it. I am keen to do things the “right way” so I am interested in
 any comments.

 What I describe in the following I have working. I am interested in knowing
 if I have gone about it the right or wrong way.

 I have a table with a varchar field that I want to complete with data from
 another table – my choices table. There is no connection between the two
 tables.

 In my controller I have the following:

       App::import('Model', 'Choice');

       $tmpChoice = new Choice();

       $titles = $tmpChoice-find('list', array(

           'fields' = array('item', 'item'),

           'conditions' = array('cat' = 'title'),

           'recursive' = 0

       ));

       $this-set(compact('titles'));

 I have this in my view:

      echo $this-Form-input('title',
 array('type'='select','options'=$titles));

 Above, I needed to instantiate the Choice model class to make it available
 to my code. When I used:

 $titles = $this-MainTable-Choice-find('list',…

 I received an error saying that I was trying to execute a function of an
 object that isn’t a class. I resorted to my above code to resolve the error.

 The “fields” array specifies “('item', 'item')”. This I did so that I could
 have the value and the option the same – I didn’t want to insert the id key
 into the database, I wanted the text. The “conditions” statement is present
 so that I can select the appropriate category of choices.

 Thanks for looking at this and making any comments about the code.

 With regards

 Graham Jones

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Send email on every exception or error?

2012-03-13 Thread majna
Error handler docs:

 * Using the built-in exception handling, you can log all the exceptions
 * that are dealt with by ErrorHandler by setting `Exception.log` to true 
in your core.php.
 * Enabling this will log every exception to CakeLog and the configured 
loggers.

Try http://plugins.cakephp.org/packages?query=EmailLog

On Monday, March 12, 2012 7:10:48 PM UTC+1, Thiago Belem wrote:

 Talking about custom errors and exceptions handlers, which should I 
 implement to send the error/exception message via email BUT without 
 changing the default behavior (log and display the exception message as a 
 404 page)?

 Regrads,
 --
 ***Thiago Belem*
 Desenvolvedor
 Rio de Janeiro - RJ - Brasil

 thiagobelem.net
 cont...@thiagobelem.net

 *Skype / gTalk **»* thiago.belem.web
 *LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt*
 Assando Sites*, curso de CakePHP *»* assando-sites.com.br
  

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Debug in Production Mode

2012-03-13 Thread Sean
Hello all,

I've recently noticed a problem. I am getting debug messages on my 
production site. I have set debug to 0 in core.php, but I am still getting 
these messages. I did a search of all my files and found debug settings, 
but know which ones might be affecting this. This site is built using 
1.2.0.7692 
RC3. I don't know if that makes any difference.

Here is the contents of my core.php:

?php
define('LOG_ERROR', 2);

Configure::write('debug', 0);
Configure::write('Routing.admin', 'admin');

$session = array(
'save' = 'php',
'cookie' = 'MYSITE',
'timeout' = '120',
'start' = true,
'checkAgent' = true,
//'table' = 'cake_sessions',
//'database' = 'default'
);
Configure::write('Session', $session);

$security = array(
'level' = 'medium',
'salt' = 'mysalt'
);
Configure::write('Security', $security);

//Configure::write('Asset.filter.css', 'css.php');
//Configure::write('Asset.filter.js', 
'custom_javascript_output_filter.php');

//Configure::write('Acl.classname', 'DbAcl');
//Configure::write('Acl.database', 'default');

Cache::config('default', array('engine' = 'File'));
?

Here are the files that reference debug:

app/controllers/bids_controller.php: Configure::write('debug', 0);
app/controllers/auctions_controller.php: Configure::write('debug', 0);
app/controllers/auctions_controller.php: Configure::write('debug', 0);
app/controllers/auction_images_controller.php: Configure::write('debug', 0);
app/controllers/sitemaps_controller.php:Configure::write('debug', 
0);
app/controllers/sitemaps_controller.php:   
Configure::write('debug', 0); 
app/controllers/sitemaps_controller.php:   
Configure::write('debug', 0); 
app/controllers/sitemaps_controller.php:   
Configure::write('debug', 0); 
app/controllers/sitemaps_controller.php:   
Configure::write('debug', 0); 
app/controllers/sitemaps_controller.php:   
Configure::write('debug', 0); 
app/controllers/settings_controller.php: Configure::write('debug', 0);
app/controllers/settings_controller.php: Configure::write('debug', 0);
cake/tests/cases/dispatcher.test.php: Configure::write('debug', 0);
cake/tests/cases/dispatcher.test.php: Configure::write('debug', 0);
cake/tests/cases/dispatcher.test.php: Configure::write('debug', 0);
cake/tests/cases/dispatcher.test.php: Configure::write('debug', 0);
cake/tests/cases/dispatcher.test.php: Configure::write('debug', 2);
cake/tests/cases/libs/view/helpers/html.test.php: Configure::write('debug', 
0);
cake/tests/cases/libs/view/helpers/html.test.php: Configure::write('debug', 
$debug);
cake/tests/cases/libs/view/helpers/javascript.test.php: 
Configure::write('debug', 
0);
cake/tests/cases/libs/view/helpers/javascript.test.php: 
Configure::write('debug', 
$debug);
cake/tests/cases/libs/controller/components/auth.test.php: 
Configure::write('debug', 
1);
cake/tests/cases/libs/controller/controller.test.php: Configure::write('debug', 
2);
cake/tests/cases/libs/model/behaviors/translate.test.php: 
Configure::write('debug', 
0);
cake/tests/cases/libs/model/behaviors/translate.test.php: 
Configure::write('debug', 
$debug);
cake/tests/cases/libs/model/model.test.php: Configure::write('debug', 2);
cake/tests/cases/libs/model/model.test.php: Configure::write('debug', 
$this-debug);
cake/tests/cases/libs/model/datasources/dbo_source.test.php: 
Configure::write('debug', 
1);
cake/tests/cases/libs/model/datasources/dbo_source.test.php: 
Configure::write('debug', 
$this-debug);
cake/tests/cases/libs/model/datasources/dbo_source.test.php: 
Configure::write('debug', 
2);
cake/tests/cases/libs/model/datasources/dbo_source.test.php: 
Configure::write('debug', 
$oldDebug);
cake/console/cake.php: Configure::write('debug', 1);
cake/console/libs/templates/skel/config/core.php: Configure::write('debug', 
2);
cake/console/libs/schema.php: Configure::write('debug', 2);

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Automatic data in field

2012-03-13 Thread mohit kumar
Hi Experts,

This might sound a bit silly. But i am unable to figure out the best
possible way to do so. So need help.

I have created a form with username , which must display the username of
current logged in user.

I am using the following plugin.
https://github.com/chetanvarshney/User-Management-Plugin-for-Cakephp-2.x

Any suggestions

-- 
Best Regards,
Mohit Kumar

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cake Bake Model Template - Access Field Data Within Template

2012-03-13 Thread gavrielh
Mark,

Thanks for the reply - but are these variables accessible in the Model 
template.  I can see them in the view template, but having problems 
accessing field names in the model template.

On Tuesday, March 13, 2012 2:02:59 AM UTC-7, gavrielh wrote:

 I'm trying to iterate over model fields within a custom Bake template - I 
 can't seem to figure out what variables might be available that would allow 
 me to iterate over the fields within the model.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Cake NooB trying to install on MAMP

2012-03-13 Thread timska77
Hello, I'm trying to install Cake 2.1 on MAMP 2.01, running Apache
2.2.17 and PHP 5.3.6. Been searching and trying everything I can but
I'm having trouble getting Cake set up, I have Zend working ok so I'm
not totally clueless, but I'm not super skilled at setting up servers
so I hope someone can help. I've got two large, scathing error
messages on the Cake start page:

Error:  The action webroot is not defined in controller AppController

Error:  Create AppController::webroot() in file: app/Controller/
AppController.php.

These are followed by:

?php
class AppController extends AppController {


public function webroot() {

}

}

Any related posts seem to point to mod_rewrites being disabled but I
have a Drupal install on the same MAMP install and rewrites are
working there just fine there, and all of the htaccess files are where
they're supposed to be in the Cake directory/subdirectories. Does
anyone have any suggestions? Thanks in advance for any help or advice!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Data retrieval

2012-03-13 Thread alexkd
Hai,
I am  new to cakePHP. I want to display in my form 'Male' or 'Female'
instead of '1' and '0'.
In my view-index
td?php echo $patient['Patient']['gender']; ?
 /td

Although i searche a lot. I ca't .

Please help me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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