Email with an attachment

2011-08-08 Thread Ambika Kulkarni
Hello folks,

I want to send an email with an attachment. I have used the following
snippet but its not working.

I have created a file called attach.txt in /app/webroot/

$this->Email->filePaths  = array('/www/app/webroot/');
$this->Email->attachments =array('attach.txt');
$this->Email->to  = 'a...@abc.com'; //its a dummy id
 $this->Email->subject = 'Something';
 $this->Email->replyTo = 'amb...@checksuminfosoft.com';
 $this->Email->from= 'amb...@checksuminfosoft.com';
 $this->Email->sendAs  = 'html';
 $mailBody = "Hello ";
 if($this->Email->send("would like to review a file") ){
 die('Email Sent!');
 }else{
die('Failed to send email');
 }

as soon as i execute this i am getting following error

Fatal error: Call to undefined function vendor() in /var/www/pmvc/app/
controllers/components/email.php on line 73

Following function is present at line no 73 in email.php file

  function send()
{
vendor('phpmailer'.DS.'class.phpmailer'); ->This is line no 73

$mail = new PHPMailer();

$mail->IsSMTP();// set mailer to use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Host   = $this->smtpHostNames;
$mail->Username = $this->smtpUserName;
$mail->Password = $this->smtpPassword;

...
}

Regards
Ambika

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


Unable to display Image or logo in an excel file.

2011-07-25 Thread Ambika Kulkarni
Hi folks,

I am exporting data to xls file. All the data is coming, but only
image or logo is not exporting to the xls file. Here is the code that
I have used.

1 ) function campaignxls($campaignId = '0') {

2) $this->layout = 'export_xls';

3)  -- data manipulation --


4)$this->set('campaignMediadetails', $finalarray);

5)$this->render('campaignxls','export_xls');

6) }

Here if I comment line no 2 and 5 then I am able to display the o/p on
the browser inspite in an excel sheet. On commenting these 2 lines I
am getting the logo also. But when I export it to xls file then only
data

in the ctp file I am printing it as below
$data .= "











 



Campaign Details




 





";
$logo1 = 'http://localhost/mvc_1_3/themed/default/img/logo.gif';

Help me to solve this issue

Regards
Ambika

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


Loading Img

2010-09-02 Thread Ambika Kulkarni
Hi all,


Hey I want a loading image as soon as i click some button. The
process  loading image. So that when something is running in the
background of cakephp like fetching data and all, that time it should
show the loading image. So that peolpe will come to nw what is
happening. and they can wait if they find a loading image.


Thanks All,

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: Controller Name in App_controller

2010-08-04 Thread Ambika Kulkarni
yes, got it.

Thank you
On Wed, Aug 4, 2010 at 2:18 PM, Amit Rawat  wrote:

> Hi
>
> You can get controller name and action name by:-
>
> $this->params['controller'] and $this->params['action']
>
> Enjoy,
>
> Amit
>
> On Wed, Aug 4, 2010 at 1:19 PM, Ambika Kulkarni <
> ambikakulkarn...@gmail.com> wrote:
>
>> Hi all,
>>
>> Is their any way to get the controller name in app_controller.php
>> file.
>>
>> The problem scenario is like this.
>>
>> In my app_controller i have written a bunch of code in before_filter()
>> function.
>>
>> I have a right panel like
>> Division
>> Element
>> Purchase and so on...
>>
>> As soon as I click on any of this name (Division or Element ...) then
>> I want the respective controller name in the before_filter() function.
>>  For Division link the  controller name is divisions. As soon as I
>> click in Divisions link I am redirected to divisions_controller.php
>> page.
>>
>> Please help me out to solve this prob
>>
>> Thanks and Regards
>> Ambika
>>
>> 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.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.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


Controller Name in App_controller

2010-08-04 Thread Ambika Kulkarni
Hi all,

Is their any way to get the controller name in app_controller.php
file.

The problem scenario is like this.

In my app_controller i have written a bunch of code in before_filter()
function.

I have a right panel like
Division
Element
Purchase and so on...

As soon as I click on any of this name (Division or Element ...) then
I want the respective controller name in the before_filter() function.
 For Division link the  controller name is divisions. As soon as I
click in Divisions link I am redirected to divisions_controller.php
page.

Please help me out to solve this prob

Thanks and Regards
Ambika

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: ACL problem

2010-07-22 Thread Ambika Kulkarni

I am not understanding how to use aros table...

how to add data in acos, aros and aros_acos table.

Do I need to create model for these 3 tables.

Please some body reply


On Jul 22, 3:10 pm, Ambika Kulkarni 
wrote:
> Hi Folks,
>
> This is the first that I am working on ACL, so I facing lot of
> problems with ACL. I followed cakephp tutorial and did the way as it
> is mentioned in the tutorial. Now when i login I am not able to access
> to any of my controller. As it is giving me following error
>
> Warning (512): AclNode::node() - Couldn't find Aro node identified by
> "Array
> (
>     [Aro0.model] => User
>     [Aro0.foreign_key] => 997
> )
> " [CORE/cake/libs/model/db_acl.php, line 191]
>
> Code | Context
>
> $this   =       Aro
> Aro::$name = "Aro"
> Aro::$hasAndBelongsToMany = array
> Aro::$cacheQueries = false
> Aro::$actsAs = array
> Aro::$useDbConfig = "default"
> Aro::$useTable = "aros"
> Aro::$displayField = "id"
> Aro::$id = false
> Aro::$data = array
> Aro::$table = "aros"
> Aro::$primaryKey = "id"
> Aro::$_schema = array
> Aro::$validate = array
> Aro::$validationErrors = array
> Aro::$tablePrefix = ""
> Aro::$alias = "Aro"
> Aro::$tableToModel = array
> Aro::$logTransactions = false
> Aro::$transactional = false
> Aro::$belongsTo = array
> Aro::$hasOne = array
> Aro::$hasMany = array
> Aro::$Behaviors = BehaviorCollection object
> Aro::$whitelist = array
> Aro::$cacheSources = true
> Aro::$findQueryType = NULL
> Aro::$recursive = 1
> Aro::$order = NULL
> Aro::$__exists = NULL
> Aro::$__associationKeys = array
> Aro::$__associations = array
> Aro::$__backAssociation = array
> Aro::$__insertID = NULL
> Aro::$__numRows = NULL
> Aro::$__affectedRows = NULL
> Aro::$_findMethods = array
> Aro::$_log = NULL
> Aro::$Aco = Aco object
> Aro::$Permission = Permission object
> $ref    =       array(
>         "Aro0.model" => "User",
>         "Aro0.foreign_key" => "997"
> )
> $db     =       DboMysql
> DboMysql::$description = "MySQL DBO Driver"
> DboMysql::$_baseConfig = array
> DboMysql::$startQuote = "`"
> DboMysql::$endQuote = "`"
> DboMysql::$_useAlias = true
> DboMysql::$_commands = array
> DboMysql::$columns = array
> DboMysql::$index = array
> DboMysql::$alias = "AS "
> DboMysql::$fieldCache = array
> DboMysql::$__bypass = true
> DboMysql::$__sqlOps = array
> DboMysql::$connected = true
> DboMysql::$fullDebug = false
> DboMysql::$error = NULL
> DboMysql::$affected = 0
> DboMysql::$numRows = 0
> DboMysql::$took = 0
> DboMysql::$_result = resource
> DboMysql::$_queriesCnt = 0
> DboMysql::$_queriesTime = NULL
> DboMysql::$_queriesLog = array
> DboMysql::$_queriesLogMax = 200
> DboMysql::$_queryCache = array
> DboMysql::$__descriptions = array
> DboMysql::$_sources = array
> DboMysql::$connection = resource
> DboMysql::$config = array
> DboMysql::$configKeyName = "default"
> DboMysql::$_transactionStarted = false
> DboMysql::$cacheSources = true
> DboMysql::$_log = NULL
> DboMysql::$results = resource
> DboMysql::$map = array
> DboMysql::$__booleans = array
> $type   =       "Aro"
> $result =       array()
> $table  =       "aros"
> $name   =       "User"
> $model  =       User
> User::$name = "User"
> User::$primaryKey = "user_id"
> User::$belongsTo = array
> User::$actsAs = array
> User::$validate = array
> User::$useDbConfig = "default"
> User::$useTable = "users"
> User::$displayField = "title"
> User::$id = false
> User::$data = array
> User::$table = "users"
> User::$_schema = array
> User::$validationErrors = array
> User::$tablePrefix = ""
> User::$alias = "User"
> User::$tableToModel = array
> User::$logTransactions = false
> User::$transactional = false
> User::$cacheQueries = false
> User::$hasOne = array
> User::$hasMany = array
> User::$hasAndBelongsToMany = array
> User::$Behaviors = BehaviorCollection object
> User::$whitelist = array
> User::$cacheSources = true
> User::$findQueryType = NULL
> User::$recursive = 1
> User::$order = NULL
> User::$__exists = NULL
> User::$__associationKeys = array
> User::$__associations = array
> User::$__backAssociation = array
> User::$__insertID = NULL
> User::$__numRows = NULL
> User::$__affectedRows = NULL
> User::$_findMethods = array
> User::$_log = NULL
> User::$Group = Group object
> User::$Aro = Aro object
> $tmpRef =    

ACL problem

2010-07-22 Thread Ambika Kulkarni
Hi Folks,

This is the first that I am working on ACL, so I facing lot of
problems with ACL. I followed cakephp tutorial and did the way as it
is mentioned in the tutorial. Now when i login I am not able to access
to any of my controller. As it is giving me following error

Warning (512): AclNode::node() - Couldn't find Aro node identified by
"Array
(
[Aro0.model] => User
[Aro0.foreign_key] => 997
)
" [CORE/cake/libs/model/db_acl.php, line 191]

Code | Context

$this   =   Aro
Aro::$name = "Aro"
Aro::$hasAndBelongsToMany = array
Aro::$cacheQueries = false
Aro::$actsAs = array
Aro::$useDbConfig = "default"
Aro::$useTable = "aros"
Aro::$displayField = "id"
Aro::$id = false
Aro::$data = array
Aro::$table = "aros"
Aro::$primaryKey = "id"
Aro::$_schema = array
Aro::$validate = array
Aro::$validationErrors = array
Aro::$tablePrefix = ""
Aro::$alias = "Aro"
Aro::$tableToModel = array
Aro::$logTransactions = false
Aro::$transactional = false
Aro::$belongsTo = array
Aro::$hasOne = array
Aro::$hasMany = array
Aro::$Behaviors = BehaviorCollection object
Aro::$whitelist = array
Aro::$cacheSources = true
Aro::$findQueryType = NULL
Aro::$recursive = 1
Aro::$order = NULL
Aro::$__exists = NULL
Aro::$__associationKeys = array
Aro::$__associations = array
Aro::$__backAssociation = array
Aro::$__insertID = NULL
Aro::$__numRows = NULL
Aro::$__affectedRows = NULL
Aro::$_findMethods = array
Aro::$_log = NULL
Aro::$Aco = Aco object
Aro::$Permission = Permission object
$ref=   array(
"Aro0.model" => "User",
"Aro0.foreign_key" => "997"
)
$db =   DboMysql
DboMysql::$description = "MySQL DBO Driver"
DboMysql::$_baseConfig = array
DboMysql::$startQuote = "`"
DboMysql::$endQuote = "`"
DboMysql::$_useAlias = true
DboMysql::$_commands = array
DboMysql::$columns = array
DboMysql::$index = array
DboMysql::$alias = "AS "
DboMysql::$fieldCache = array
DboMysql::$__bypass = true
DboMysql::$__sqlOps = array
DboMysql::$connected = true
DboMysql::$fullDebug = false
DboMysql::$error = NULL
DboMysql::$affected = 0
DboMysql::$numRows = 0
DboMysql::$took = 0
DboMysql::$_result = resource
DboMysql::$_queriesCnt = 0
DboMysql::$_queriesTime = NULL
DboMysql::$_queriesLog = array
DboMysql::$_queriesLogMax = 200
DboMysql::$_queryCache = array
DboMysql::$__descriptions = array
DboMysql::$_sources = array
DboMysql::$connection = resource
DboMysql::$config = array
DboMysql::$configKeyName = "default"
DboMysql::$_transactionStarted = false
DboMysql::$cacheSources = true
DboMysql::$_log = NULL
DboMysql::$results = resource
DboMysql::$map = array
DboMysql::$__booleans = array
$type   =   "Aro"
$result =   array()
$table  =   "aros"
$name   =   "User"
$model  =   User
User::$name = "User"
User::$primaryKey = "user_id"
User::$belongsTo = array
User::$actsAs = array
User::$validate = array
User::$useDbConfig = "default"
User::$useTable = "users"
User::$displayField = "title"
User::$id = false
User::$data = array
User::$table = "users"
User::$_schema = array
User::$validationErrors = array
User::$tablePrefix = ""
User::$alias = "User"
User::$tableToModel = array
User::$logTransactions = false
User::$transactional = false
User::$cacheQueries = false
User::$hasOne = array
User::$hasMany = array
User::$hasAndBelongsToMany = array
User::$Behaviors = BehaviorCollection object
User::$whitelist = array
User::$cacheSources = true
User::$findQueryType = NULL
User::$recursive = 1
User::$order = NULL
User::$__exists = NULL
User::$__associationKeys = array
User::$__associations = array
User::$__backAssociation = array
User::$__insertID = NULL
User::$__numRows = NULL
User::$__affectedRows = NULL
User::$_findMethods = array
User::$_log = NULL
User::$Group = Group object
User::$Aro = Aro object
$tmpRef =   null
$val=   "997"
$key=   "foreign_key"
$queryData  =   array(
"conditions" => array(
"Aro0.model" => "User",
"Aro0.foreign_key" => "997"
),
"fields" => array(
"id",
"parent_id",
"model",
"foreign_key",
"alias"
),
"joins" => array(
array()
),
"order" => "`Aro`.`lft` DESC"
)


if (!$result) {
trigger_error("AclNode::node() - Couldn't find {$type}
node identified by \"" . print_r($ref, true) . "\"", E_USER_WARNING);

AclNode::node() - CORE/cake/libs/model/db_acl.php, line 191
DbAcl::check() - CORE/cake/libs/controller/components/acl.php, line
235
AclComponent::check() - CORE/cake/libs/controller/components/acl.php,
line 89
AuthComponent::isAuthorized() - CORE/cake/libs/controller/components/
auth.php, line 482
AuthComponent::startup() - CORE/cake/libs/controller/components/
auth.php, line 403
Component::startup() - CORE/cake/libs/controller/component.php, line
112
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 210
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
[main] - APP/webroot/index.php, line 88

Warning (512): DbAcl::check() - Failed ARO/AC

Registration page- password filed making conlict

2010-06-03 Thread Ambika Kulkarni
Hi All,

I have a user model as below

class User extends AppModel {
var $name = 'User';
var $primaryKey = 'user_id';
   //validation for the registration fields
var $validate = array(
'name' => array(
 'notempty' => array(
   'rule' => array(
 'alphaNumeric'),
 'required' =>
true,
 'allowEmpty' =>
false,
'message' =>
'Please enter a value for the First Name field')),

'telephone' => array(
   'rule' => array(
 'alphaNumeric'),
 'required' => true,
 'allowEmpty' => false,
 'message' => 'Please
enter a value for the  Contact Number field'),
'email' => array(
'rule1' => array(
   'rule' => 'notEmpty',
   'required' => true,
   'allowEmpty' => false,
   'message' => 'Please enter
a value for the Email field',
'last' => true),
'rule2' => array(
'rule' => 'email',
'message' => 'Please enter
a proper Email Id'
)),
'username' => array(
   'notempty' => array(
  'rule' =>
'notEmpty',
   'required' => true,
   'allowEmpty' =>
false,
   'message' => 'User
name cannot be empty',
'last' => true
   ),
   'unique' => array(
  'rule' => array('checkUnique',
'username'),
  'message' => 'User name taken.
Use another'
   )
),
 'password' => array(
'notempty' => array(
   'rule' =>
'alphaNumeric',
   'required' => true,
   'allowEmpty' =>
false,
   'message' =>
'Password cannot be empty.',
   'last' => true

   ),
'passwordSimilar' => array(
   'rule' =>
'checkPasswords',
   'message'
=> 'Different password re entered.'
 )
));
   function checkUnique ($data, $fieldName) {
$valid = false;
if ( isset($fieldName) && $this->hasField($fieldName)) {
$valid = $this->isUnique(array($fieldName => $data));
}
return $valid;
}
   function checkPasswords($data) {
   if($data['password'] == $this->data['User']
['password2hashed'])
  return true;
   return false;
}
}

and in the register.ctp file i have number of fileds but i giving the
code snippet only for password filed

 isFieldError('User.password')) {
e($form->error ('User.password',  null,
array( 'class' => 'failure')));  }
?>
create('User', array( 'action' => 'register'));
  ?>
  
   
* 
Password 
password('password',  array('value'
=> '', 'style' => 'width: 30%'))); ?>
   

* 
Confirm Password 
password('password2',
array( 'style' => 'width: 30%')));  ?> 
   

end()); ?>

In the controller file
class UsersController extends AppController {
var $uses = array ('User','Group', 'GroupUser');
var $components = array('Auth');
var $helpers = array('Html', 'Form');
function register() {
   if (!empty($this->data)) {
//$this->data['User']['password2hashed'] = $this->Auth-
>password($this->data['User']['password2']);
//$this->set('password', '');
// if (isset($this->data['User']['password2'])) {
//$this->data['User']['password2hashed'] = $this->User-

Re: Using Like operator in condition

2010-06-03 Thread Ambika Kulkarni
Hi thanks a lot it worked.

On Thu, Jun 3, 2010 at 12:37 PM, Jeremy Burns  wrote:

> http://book.cakephp.org/view/1030/Complex-Find-Conditions
>
> Jeremy Burns
> jeremybu...@me.com
>
>
> On 3 Jun 2010, at 08:04, Ambika Kulkarni wrote:
>
> Hi all,
>
> In my controller I have the following code snippet. This is used for
> searching a product name in campaigns tbl.
>
> if($product!='' && $product!='empty') {
>
>$condition=array_merge($condition,array('product'=>
> $product));
>
>  }
> $campaign = $this->Campaign->find('all',
>array(
>'conditions' =>
> $condition));
>
> Here if i enter the product value as "ABC" then it does a whole word
> search. And returns the relevent record. Now I want to do a single
> character search, for which we use LIKE operator in query.
>
> I want to know how to use LIKE operator in cake PHP.
>
> Do I need to write the condition in this way...
>  $condition=array_merge($condition,array('product LIKE '=>$product));
>
> or is their any other proper way to do this.
>
>
> Thanks all,
>
> 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.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


Using Like operator in condition

2010-06-03 Thread Ambika Kulkarni
Hi all,

In my controller I have the following code snippet. This is used for
searching a product name in campaigns tbl.

 if($product!='' && $product!='empty') {

$condition=array_merge($condition,array('product'=>
$product));

  }
 $campaign = $this->Campaign->find('all',
array(
'conditions' =>
$condition));

Here if i enter the product value as "ABC" then it does a whole word
search. And returns the relevent record. Now I want to do a single
character search, for which we use LIKE operator in query.

I want to know how to use LIKE operator in cake PHP.

Do I need to write the condition in this way...
  $condition=array_merge($condition,array('product LIKE '=>$product));

or is their any other proper way to do this.


Thanks all,

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


Deleting record

2010-05-22 Thread Ambika Kulkarni
Hi all,

This is my model groupstore
class GroupStore extends AppModel {
 var $name = 'GroupStore';
 var $primaryKey = 'group_store_id';
 var $belongsTo = array(
 'Group' => array(
   'className' => 'Group',
   'foreignKey' => 'group_id',));
}

group_stroes tbl schema is
( group_store_idgroup_idstore_idactive  deleted )
group_store_id  is primary key

In my conroller i have this code snippet

$this->GroupStore->deleteAll(array('GroupStore.group_id' => $this-
>data['GroupStore']['group_id']));

But on execution of this code snippet I am getting this error

Warning (512): SQL Error: 1054: Unknown column 'GroupStore.id' in
'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line
525]
Query: SELECT `GroupStore`.`id` FROM `group_stores` AS `GroupStore`
WHERE `GroupStore`.`group_id` = 432

Help 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: Not able to update record

2010-05-14 Thread Ambika Kulkarni
ya i removed that and it worked

Thanks a lot

On Fri, May 14, 2010 at 3:12 PM, Jeremy Burns  wrote:

> This is caused by your order statement in your hasMany SubCategory...
>
>  'MainCategory.mainCategory ASC',
>>
>
> Try removing it.
>
>
> Jeremy Burns
> jeremybu...@me.com 
>
>
> On 14 May 2010, at 10:38, Ambika Kulkarni wrote:
>
>
> I changed the file name from maincategory.php to main_category.php
>
> and i put this line of code
>  $this->MainCategory->main_category_id = $_POST['id'];
>  $this->MainCategory->save($this->data);
>
> I am getting this error nw
>
> *Warning* (512): *SQL Error:* 1054: Unknown column 
> 'MainCategory.mainCategory' in 'order clause' 
> [*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]
>
>
>
> On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns  wrote:
>
>> I see several potential problems here, mostly caused by not sticking to
>> conventions.
>>
>> Your model file ought to be called main_category.php
>>
>> If you want to stick to conventions, Id' rename your table's primary key
>> to 'id'. But assuming you won't/can't/don't do this...
>>
>> Why are you using $_POST?
>>
>> It seems as if your form has a field called 'id' that maps to your
>> model/table field main_category_id...baffling.
>>
>> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
>> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
>>
>> Jeremy Burns
>> jeremybu...@me.com
>>
>>
>> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
>>
>> > Hi folks,
>> >
>> > I have a tbl called main_categories
>> > tbl schema is
>> > main_category_id , main_category,type,active,deleted
>> >
>> > model data maincategory.php
>> > class MainCategory extends AppModel {
>> >var $name = 'MainCategory';
>> >var $primaryKey = 'main_category_id';
>> >var $hasMany = array(
>> >   'SubCategory' => array(
>> >'className' => 'SubCategory',
>> >'foreignKey' =>
>> > 'main_category_id',
>> >'dependent' => false,
>> >'conditions' => '',
>> >'fields' => '',
>> >'order' =>
>> > 'MainCategory.mainCategory ASC',
>> >'limit' => '',
>> >'offset' => '',
>> >'exclusive' => '',
>> >'finderQuery' => '',
>> >'counterQuery' => ''),);
>> >
>> > }
>> >
>> > in the main_categories_controller.php
>> > if ( $_POST['a'] == "Update") {
>> >
>> >//$this->MainCategory->recursive = 1;
>> >
>> >$this->MainCategory->mainCategoryId = $_POST['id'];
>> >
>> >$this->MainCategory->save($this->data);
>> >
>> >}
>> > Its not updating the record
>> > $this->MainCategory->id = $_POST['id'];
>> > $this->MainCategory->main_category_id = $_POST['id'];
>> >
>> > not working
>> > Please help 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.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 

Re: Not able to update record

2010-05-14 Thread Ambika Kulkarni
I changed the file name from maincategory.php to main_category.php

and i put this line of code
 $this->MainCategory->main_category_id = $_POST['id'];
 $this->MainCategory->save($this->data);

I am getting this error nw

*Warning* (512) : *SQL Error:* 1054: Unknown
column 'MainCategory.mainCategory' in 'order clause'
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]


On Fri, May 14, 2010 at 1:37 PM, Jeremy Burns  wrote:

> I see several potential problems here, mostly caused by not sticking to
> conventions.
>
> Your model file ought to be called main_category.php
>
> If you want to stick to conventions, Id' rename your table's primary key to
> 'id'. But assuming you won't/can't/don't do this...
>
> Why are you using $_POST?
>
> It seems as if your form has a field called 'id' that maps to your
> model/table field main_category_id...baffling.
>
> Change this line: $this->MainCategory->mainCategoryId = $_POST['id'];
> ...to this: $this->MainCategory->main_category_id = $_POST['id'];
>
> Jeremy Burns
> jeremybu...@me.com
>
>
> On 14 May 2010, at 08:43, Ambika Kulkarni wrote:
>
> > Hi folks,
> >
> > I have a tbl called main_categories
> > tbl schema is
> > main_category_id , main_category,type,active,deleted
> >
> > model data maincategory.php
> > class MainCategory extends AppModel {
> >var $name = 'MainCategory';
> >var $primaryKey = 'main_category_id';
> >var $hasMany = array(
> >   'SubCategory' => array(
> >'className' => 'SubCategory',
> >'foreignKey' =>
> > 'main_category_id',
> >'dependent' => false,
> >'conditions' => '',
> >'fields' => '',
> >'order' =>
> > 'MainCategory.mainCategory ASC',
> >'limit' => '',
> >'offset' => '',
> >'exclusive' => '',
> >'finderQuery' => '',
> >'counterQuery' => ''),);
> >
> > }
> >
> > in the main_categories_controller.php
> > if ( $_POST['a'] == "Update") {
> >
> >//$this->MainCategory->recursive = 1;
> >
> >$this->MainCategory->mainCategoryId = $_POST['id'];
> >
> >$this->MainCategory->save($this->data);
> >
> >}
> > Its not updating the record
> > $this->MainCategory->id = $_POST['id'];
> > $this->MainCategory->main_category_id = $_POST['id'];
> >
> > not working
> > Please help 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.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.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


Not able to update record

2010-05-14 Thread Ambika Kulkarni
Hi folks,

I have a tbl called main_categories
tbl schema is
main_category_id , main_category,type,active,deleted

model data maincategory.php
class MainCategory extends AppModel {
var $name = 'MainCategory';
var $primaryKey = 'main_category_id';
var $hasMany = array(
   'SubCategory' => array(
'className' => 'SubCategory',
'foreignKey' =>
'main_category_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' =>
'MainCategory.mainCategory ASC',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''),);

}

in the main_categories_controller.php
if ( $_POST['a'] == "Update") {

//$this->MainCategory->recursive = 1;

$this->MainCategory->mainCategoryId = $_POST['id'];

$this->MainCategory->save($this->data);

}
Its not updating the record
 $this->MainCategory->id = $_POST['id'];
 $this->MainCategory->main_category_id = $_POST['id'];

not working
Please help 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: sql error 1054 unknown column in 'on clause'

2010-05-13 Thread Ambika Kulkarni
 U r the MASTER sir

Thanks to you, for all your kind help


On Thu, May 13, 2010 at 12:17 PM, Amit Rawat  wrote:

> No acknowledgement 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.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: sql error 1054 unknown column in 'on clause'

2010-05-12 Thread Ambika Kulkarni
Hi John,

That prblem got resolved as i changed the storetype model name to
store_type. And it worked.

Thanks for your kind concern

Thank you,

On Wed, May 12, 2010 at 8:28 PM, John Andersen wrote:

> I'll rephrase my question, can you show me the SQL description of the
> store_types table, like this:
> [code]
> CREATE TABLE `store_types` (
>`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
>`name` VARCHAR(40) NOT NULL,
>PRIMARY KEY (`id`)
> )
> [/code]
>
> I ask because I want to be sure that the table has a primary key named
> "store_type_id"!
>
> Another option is to try to leave out the fields parameter and see
> what you then get!
> Enjoy,
>   John
>
> On May 12, 7:38 am, Ambika Kulkarni 
> wrote:
> > In store_types tbl primary key is store_type_id
> >
> [snip]
>
> 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.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: drop down. elements are not storing.... in to the table..

2010-05-11 Thread Ambika Kulkarni
In your view file put the below code n check

 e($form->select('agencyId',

>array(
>'empty' => '-All Suppliers-',
>$agencies),
>null,
>array(
>'id' => 'agency_id',
>'style' => 'width: 50%'),false));



On Tue, May 11, 2010 at 1:57 PM, Master Ram  wrote:

> hi.. all
>
> i am new to cakePHP.
>
> my table name is : promoters
>
> in this table i have many tables. when i am selecting the element form
> the drop down. in the table only storing "0". when i am changing my
> option also it is storing "0" only..
>
> this is my. controller code:
>
> function promoter(){
>
>//get all data from supplier table
>   $agencies = $this->Agencie->find('list',
>   array(
>   'fields' =>
> array('agency_id','name'),
>'order' =>
>array(
>
>'name
> ASC')));
>
>$this->set('agencies',$agencies);
>
>
>$demographics = $this->Demographic->find('all');
>
>$this->set('demographics', $demographics);
>
>
>if (!empty($this->data)) {
>
>$this->Promoter->create();
>
>$this->data['Promoter']['agency_id'];
>
>$this->data['Promoter']['name'];
>
>$this->data['Promoter']['last_name'];
>
>$this->data['Promoter']['surname'];
>
>$this->data['Promoter']['id_no'];
>
>$this->data['Promoter']['cell'];
>
>$this->Promoter->save($this->data);
>
>$this->Session->setFlash('The User has been registered,
> please login');
>
>$this->redirect(array('action'=>'promoters_step_two'));
>
>}
>
>}
>
> this is my view code:
>
> e($form->select('agencie_agencyId',
>array(
>'empty' => '-All Suppliers-',
>$agencies),
>null,
>array(
>'id' => 'agency_id',
>'style' => 'width: 50%'),false));
>?>
>
> table fiels is: agency_id.
>
> please help me. where i am missing. in this code...
>
> 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.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: sql error 1054 unknown column in 'on clause'

2010-05-11 Thread Ambika Kulkarni
In store_types tbl primary key is store_type_id


On Tue, May 11, 2010 at 8:04 PM, John Andersen wrote:

> As the error says, the table store_types has no column id, which is
> expected, as you have defined that the StoreType model has a primary
> key named store_type_id!
>
> What is the name of the column which is the primary key in the table
> store_types?
> Enjoy,
>   John
>
> On May 11, 4:29 pm, Ambika Kulkarni 
> wrote:
> > SELECT `Store`.`store_id`, `Store`.`branch_code`,
> > `Store`.`store_code`, `Store`.`store_name`, `Store`.`store_type_id`,
> > `Store`.`grm`, `Store`.`lngbranchmanager`, `Store`.`assistant`,
> > `Store`.`lngconregion`, `Store`.`division_id`,
> > `Store`.`division_zapop_id`, `Store`.`region_id`,
> > `Store`.`telcountry`, `Store`.`telarea`, `Store`.`tel`,
> > `Store`.`faxcountry`, `Store`.`faxarea`, `Store`.`fax`,
> > `Store`.`address1`, `Store`.`address2`, `Store`.`address3`,
> > `Store`.`address4`, `Store`.`address5`, `Store`.`po_code`,
> > `Store`.`email`, `Store`.`contact_number`, `Store`.`basevolume`,
> > `Store`.`base_announcement`, `Store`.`virt`, `Store`.`active`,
> > `Store`.`country_id`, `Store`.`weight`, `Store`.`trade_area`,
> > `Store`.`monthly_store`, `Store`.`wine_store`, `Store`.`unavailable`,
> > `Store`.`store_closed`, `Division`.`division_id`, `Division`.`name`,
> > `StoreType`.`store_type_id`, `StoreType`.`name` FROM `stores` AS
> > `Store` LEFT JOIN `divisions` AS `Division` ON (`Store`.`division_id`
> > = `Division`.`division_id`) LEFT JOIN `store_types` AS `StoreType` ON
> > (`Store`.`store_type_id` = `StoreType`.`id`)  WHERE 1 = 1
> >
> > This is query that it it returning after the error
> >
>
> 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.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: sql error 1054 unknown column in 'on clause'

2010-05-11 Thread Ambika Kulkarni
SELECT `Store`.`store_id`, `Store`.`branch_code`,
`Store`.`store_code`, `Store`.`store_name`, `Store`.`store_type_id`,
`Store`.`grm`, `Store`.`lngbranchmanager`, `Store`.`assistant`,
`Store`.`lngconregion`, `Store`.`division_id`,
`Store`.`division_zapop_id`, `Store`.`region_id`,
`Store`.`telcountry`, `Store`.`telarea`, `Store`.`tel`,
`Store`.`faxcountry`, `Store`.`faxarea`, `Store`.`fax`,
`Store`.`address1`, `Store`.`address2`, `Store`.`address3`,
`Store`.`address4`, `Store`.`address5`, `Store`.`po_code`,
`Store`.`email`, `Store`.`contact_number`, `Store`.`basevolume`,
`Store`.`base_announcement`, `Store`.`virt`, `Store`.`active`,
`Store`.`country_id`, `Store`.`weight`, `Store`.`trade_area`,
`Store`.`monthly_store`, `Store`.`wine_store`, `Store`.`unavailable`,
`Store`.`store_closed`, `Division`.`division_id`, `Division`.`name`,
`StoreType`.`store_type_id`, `StoreType`.`name` FROM `stores` AS
`Store` LEFT JOIN `divisions` AS `Division` ON (`Store`.`division_id`
= `Division`.`division_id`) LEFT JOIN `store_types` AS `StoreType` ON
(`Store`.`store_type_id` = `StoreType`.`id`)  WHERE 1 = 1

This is query that it it returning after the error

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


sql error 1054 unknown column in 'on clause'

2010-05-11 Thread Ambika Kulkarni
Hi all,
I am using Store and StoreType models
class Store extends AppModel {
var $name = 'Store';
var $primaryKey = 'store_id';
var $belongsTo = array(
 'Division' => array(
   'className' => 'Division',
   'foreignKey' => 'division_id',
   'conditions' => '',
   'fields' => 'division_id, name',
   'order' => ''),
   'StoreType' => array(
   'className' => 'StoreType',
   'foreignKey' => 'store_type_id',
   'conditions' => '',
   'fields' => 'store_type_id, name',
   'order' => '') );
}
class StoreType extends AppModel {
var $name = 'StoreType';
   var $primaryKey = 'store_type_id';
 var $hasMany = array(
   'Store' => array(
  'className' => 'Store',
  'foreignKey' => 'store_type_id',
  'conditions' => '',
  'fields' => '',
  'order' => ''));
}

in the controller I put this code
$this->Store->recursive = 0;

$store = $this->Store->find('all',
array(
'conditions' =>
$condition));

$this->set('store',$store);

I am getting this error

 SQL Error: 1054: Unknown column 'StoreType.id' in 'on clause' [CORE/
cake/libs/model/datasources/dbo_source.php, line 525]

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


Table relationship making problem to other files

2010-04-27 Thread Ambika Kulkarni
Hi all,

I have 2 models such as below.
class Division extends AppModel {
var $name = 'Division';
var $primaryKey = 'division_id';
var $hasMany = array(
   'Store' => array(
  'className' => 'Store',
  'foreignKey' => 'division_id',
  'conditions' => '',
  'fields' => '',
  'order' => ''));

var $belongsTo = array(
 'Country' => array(
  'className' => 'Country',
  'foreignKey' => 'country_id',
  'conditions' => '',
  'fields' => '',
  'order' => ''));

}
class Country extends AppModel {
var $name = 'Country';
var $primaryKey = 'country_id';
var $hasMany = array(
   'Division' => array(
 'className' => 'division',
 'foreignKey' => 'country_id',
 'dependent' => false,
 'conditions' => '',
 'fields' => '',),);
}
Now i want to fetch the data only from division table. but I am
getting the whole data from both tables.

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: Using condiotion in find()

2010-04-19 Thread Ambika Kulkarni
Hi It worked Thanks :)

On Mon, Apr 19, 2010 at 6:15 PM, Lucca Mordente wrote:

> Hi Ambika,
>
> All of 'fields', 'conditions', 'order' and 'group' arrays must be
> inside the same array which is the second parameter of find()
> function. Like the following:
>
> $maincategories = $this->MainCategory->find('list', array(
>'fields' =>
> array(
>
>  'main_category_id','main_category','type'
> ),
>'conditions'
> => array(
>
>  'MainCategory.type' => ''
> ),
>'order' =>
> 'MainCategory.main_category ASC',
>'group' =>
> 'MainCategory.type'
>   );
>
>
>
>
>
>
> Ambika Kulkarni wrote:
> > Hi all,
> >
> > i am using the following find() function to get the data in a list. I
> > have put the conditions but still its taking all values.
> >
> > $maincategories = $this->MainCategory->find('list', array(
> >   'fields' =>
> array(
> >
> 'main_category_id','main_category','type'
> >   )
> >   ),
> >   array(
> >
> 'conditions' => array(
> >
> 'MainCategory.type' => ''
> >)
> >   ),
> >   array(
> >   'order' =>
> 'MainCategory.main_category ASC'
> >   ),
> >   array(
> >   'group' =>
> 'MainCategory.type'
> >   )
> >  );
> >
> > O/P is
> > 
> >
> > Wrap & pack exp  store
> > Groceries & toiletries 
> > Fruit & vegetables 
> > Deli 
> > Perishables 
> > Fresh meat
> > Major household appliances 
> > Non Foods 
> > Delicatessen dept.
> > Wet fish 
> > Bakery 
> >
> 
> > 
> > Petfood
> > Wine
> > Stationary
> > Toys
> > Non Foods
> > Freezers
> > Fridges
> > Prepacked Fresh Vegetables
> > Prepacked Fresh Fruit
> > Groceries
> > Household
> > Baby Care
> > Self Medication
> > Toiletries
> > 
> > i want the data till the that line.
> > Thanks
> > Ambika
> >
> > 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.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.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


Using condiotion in find()

2010-04-19 Thread Ambika Kulkarni
Hi all,

i am using the following find() function to get the data in a list. I
have put the conditions but still its taking all values.

$maincategories = $this->MainCategory->find('list', array(
'fields' => 
array(

'main_category_id','main_category','type'
)
),
array(
'conditions' => 
array(

'MainCategory.type' => ''
 )
),
array(
'order' => 
'MainCategory.main_category ASC'
),
array(
'group' => 
'MainCategory.type'
)
   );

O/P is


Wrap & pack exp  store
Groceries & toiletries 
Fruit & vegetables 
Deli 
Perishables 
Fresh meat
Major household appliances 
Non Foods 
Delicatessen dept.
Wet fish 
Bakery 


Petfood
Wine
Stationary
Toys
Non Foods
Freezers
Fridges
Prepacked Fresh Vegetables
Prepacked Fresh Fruit
Groceries
Household
Baby Care
Self Medication
Toiletries

i want the data till the that line.
Thanks
Ambika

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 view parameters to javascript function

2010-04-16 Thread Ambika Kulkarni

alert("I am in hello
function"+Form.Element.getValue('Campaign.Name'));
I am getting error. "element null"

On Apr 16, 3:57 pm, Ed Propsner  wrote:
> If it's your Javascript that's not working I would use:
>
> function validate()
>        {
>             var username=Form.Element.getValue('UserUsername');
>             window.alert("username");
>        }
>
> - Ed
>
> On Fri, Apr 16, 2010 at 6:46 AM, Ambika Kulkarni 
>
>
> > wrote:
> > Hi All,
>
> > I want to send the post data to a javascript function. I have put the
> > code below . Please help name
>
> > view.ctp
> > If I am just calling the js function it works.
>
> > .
> > function  validate()    {
> >             window.alert("It's working");
> > }
>
> > create('User', array('action' =>'login'));
> >  echo $form->input(username);
> > echo $form-
>
> > >submit('signin.gif',array('width'=>100,'height'=>22,'onclick'=>'validate()'));
> >  echo $form->end();
> >  ?>
>
> > But when I am trying to do like the following it wont work
>
> >        function validate()
> >        {
> >             var username=document.User.username.value;
> >             window.alert("username");
> >        }
>
> > create('User', array('action' =>'login'));
> >  echo $form->input(username);
> > echo $form->submit('signin.gif',array('width'=>100,
> > 'height'=>22,'onclick'=>'validate()'));
> > echo $form->end(); ?>
>
> > 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.comFor
> >  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: Sending view parameters to javascript function

2010-04-16 Thread Ambika Kulkarni

alert("I am in hello
function"+Form.Element.getValue('Campaign.Name'));
Its giving error. "element is null"

On Apr 16, 3:57 pm, Ed Propsner  wrote:
> If it's your Javascript that's not working I would use:
>
> function validate()
>        {
>             var username=Form.Element.getValue('UserUsername');
>             window.alert("username");
>        }
>
> - Ed
>
> On Fri, Apr 16, 2010 at 6:46 AM, Ambika Kulkarni 
>
>
> > wrote:
> > Hi All,
>
> > I want to send the post data to a javascript function. I have put the
> > code below . Please help name
>
> > view.ctp
> > If I am just calling the js function it works.
>
> > .
> > function  validate()    {
> >             window.alert("It's working");
> > }
>
> > create('User', array('action' =>'login'));
> >  echo $form->input(username);
> > echo $form-
>
> > >submit('signin.gif',array('width'=>100,'height'=>22,'onclick'=>'validate()'));
> >  echo $form->end();
> >  ?>
>
> > But when I am trying to do like the following it wont work
>
> >        function validate()
> >        {
> >             var username=document.User.username.value;
> >             window.alert("username");
> >        }
>
> > create('User', array('action' =>'login'));
> >  echo $form->input(username);
> > echo $form->submit('signin.gif',array('width'=>100,
> > 'height'=>22,'onclick'=>'validate()'));
> > echo $form->end(); ?>
>
> > 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.comFor
> >  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


Sending view parameters to javascript function

2010-04-16 Thread Ambika Kulkarni
Hi All,

I want to send the post data to a javascript function. I have put the
code below . Please help name

view.ctp
If I am just calling the js function it works.

.
function  validate(){
 window.alert("It's working");
}

create('User', array('action' =>'login'));
 echo $form->input(username);
echo $form-
>submit('signin.gif',array('width'=>100,'height'=>22,'onclick'=>'validate()'));
 echo $form->end();
 ?>

But when I am trying to do like the following it wont work

function validate()
{
 var username=document.User.username.value;
 window.alert("username");
}

create('User', array('action' =>'login'));
  echo $form->input(username);
echo $form->submit('signin.gif',array('width'=>100,
'height'=>22,'onclick'=>'validate()'));
echo $form->end(); ?>


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


Using Button to submit the form

2010-04-16 Thread Ambika Kulkarni
Hi all,

I have Back and Next as two buttons in my view file. Which are used
for the navigation between the pages.
Now when i click on Next button It should do the page validation also.
I have put the code below. Please help me.

In campaign.php model page
var $validate = array(
'brand' => array(
'rule' => array('minLength', 1),
'required' => true,
'allowEmpty' => false,
'message' => 'Please enter a value for the Brand field'
),
'product' => array(
'rule' => array('minLength', 1),
'required' => true,
'allowEmpty' => false,
'message' => 'Please enter a value for the Product field'
),
'media' => array(
'rule' => array('minLength', 1),
'required' => true,
'allowEmpty' => false,
'message' => 'Please ensure you have selected Activation
Media for this promotion'
),

  );
In the controller page
 function step_two(){
//get all data from agencies table
$agencies = $this->Agencie->find('all', array('fields' =>
'Agencie.name'));
$this->set('agencies',$agencies);
//get all data from media table
$media = $this->Media->find('all');
$this->set('media',$media);
}
In the view file

isFieldError('User.brand')) e($form->error
 ('User.brand', null, array('class' => 'failure')));
   else if($form->isFieldError('User.product')) e($form->error
 ('User.product', null, array('class' => 'failure')));
   else if($form->isFieldError('User.media')) e($form->error
 ('User.media', null, array('class' => 'failure')));

?>
. . .
create('Campaign', array('action' => 'step_two'));?>
. . .

webroot . 'campaigns/step_one';
echo $form->button('< Back', array('onclick' => 
"location.href='".
$link."'"));
$link = $this->webroot . 'campaigns/step_three';
echo $form->button('Next >', array('onclick' => 
"location.href='".
$link."'"));?>

Thanks in Advance
Ambika

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


hash password

2010-04-13 Thread Ambika Kulkarni
Hi,

I want to change the password encryption type. How to do that. I want
to change it to MYSQL PASSWORD.

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

To unsubscribe, reply using "remove me" as the subject.


Re: After validation data is getting cleared

2010-04-11 Thread Ambika Kulkarni
Hi,

I did the changes that you said. Still value field is empty.

Thanks

On Apr 9, 4:12 pm, Hani Sana  wrote:
> In view :states
> add.ctp
>
> 
> create('State');?>
>         
>                 
>                          echo $form->input('abbr');
>                 echo $form->input('name');
>         ?>
>         
> end('Submit');?>
> 
>
> In Controller :
>
> class StatesController extends AppController {
>
>         var $name = 'States';
>         var $helpers = array('Html', 'Form');
>
>         function add() {
>                 if (!empty($this->data)) {
>                         $this->State->create();
>                         if ($this->State->save($this->data)) {
>                                 $this->Session->setFlash(__('The State has 
> been saved', true));
>                                 $this->redirect(array('action'=>'index'));
>                         } else {
>                                 $this->Session->setFlash(__('The State could 
> not be saved. Please,
> try again.', true));
>                         }
>                 }
>         }
>
> }
>
> In Model :
> class State extends AppModel {
>
>         var $name = 'State';
>         var $validate = array(
>                 'abbr' => array('notempty'),
>                 'name' => array('notempty')
>         );
>
> }
>
> Use this code as Above just copy paste it , and follow as it , its may
> solved ur pm..I hope .
> By.

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

To unsubscribe, reply using "remove me" as the subject.


Re: After validation data is getting cleared

2010-04-09 Thread Ambika Kulkarni
Hi Jeremy,

I did the corrections for minlength and I put data);?> code both in controller and view.
When i submit the form with some empty fields, then error msg is
displaying and in the controller i am getting the data but not in the
view file.

Ambika

On Apr 9, 10:51 am, Jeremy Burns  wrote:
> A few quick observations...
>
> Your 'minLenght' validation rules are spelt incorrectly. Should be 
> 'minLength'.
>
> Try using  echo $this->Form->input('Model.fieldName', array('class' => 
> 'fullwidth')); . Notice I use the model name as well.
>
> This ought to make your $form-error statements redundant too.
>
> Next step is to:  debug($this->data);  ...in both your 
> controller function and your view - see what's in there. If you are still 
> having problems, post the contents of the data array back here.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 9 Apr 2010, at 06:42, Ambika Kulkarni wrote:
>
> > Hi John,
>
> > In the model(user.php) I am doing the validation
> >  > class User extends AppModel {
> >   var $name = 'User';
> >   var $validate = array(
> >   'name' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Name field'
> >   ),
> >    'telephone' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Telephone field'
> >   ),
> >    'email' => array(
> >      'rule' => 'email',
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a value for the Email field'
> >   ),
> >   'username' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a user name'
> >   ),
> >   'password' => array(
> >      'rule' => array('minLenght', 1),
> >      'required' => true,
> >      'allowEmpty' => false,
> >      'message' => 'Please enter a password'
> >   ),
>
> > );
> > }
> > ?>
> > In the users_controller.php
> >  > class UsersController extends AppController {
> >   var $name = 'Users';
> >   var $components = array('Auth');
> >   function register(){
> >   if (!empty($this->data)) {
> >      if(isset($this->data['User']['password2']))
> >         $this->data['User']['password2hashed'] = $this->
> >             Auth->password($this->data['User']['password2']);
> >      $this->User->create();
> >      if ($this->User->save($this->data)) {
> >         $this->Session->setFlash('Congratulations! You have signed
> > up!');
> >       } else {
> >         $this->Session->setFlash('There was an error signing up.
> > Please, try again.');
> >         $this->data = null;
> >      }
> >   }
> > }
> >   function login() {}
> >   function logout() {
> >      $this->Session->setFlash('Logout');
> >      $this->redirect($this->Auth->logout());
> >   }
> > }
> > ?>
> > And in the register.ctp file
> > for error message display
> >  >   // validation error display
> >   if($form->isFieldError('User.name')) e($form->error
> >         ('User.name', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.telephone')) e($form->error
> >         ('User.telephone', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.email')) e($form->error
> >         ('User.email', null, array('class' => 'failure')));
> >   else if($form->isFieldError('User.username')) e($form->error
> >         ('User.username', null, array('class' => 'failure')));
&

Re: After validation data is getting cleared

2010-04-08 Thread Ambika Kulkarni
Hi John,

In the model(user.php) I am doing the validation
 array(
  'rule' => array('minLenght', 1),
  'required' => true,
  'allowEmpty' => false,
  'message' => 'Please enter a value for the Name field'
   ),
'telephone' => array(
  'rule' => array('minLenght', 1),
  'required' => true,
  'allowEmpty' => false,
  'message' => 'Please enter a value for the Telephone field'
   ),
'email' => array(
  'rule' => 'email',
  'required' => true,
  'allowEmpty' => false,
  'message' => 'Please enter a value for the Email field'
   ),
   'username' => array(
  'rule' => array('minLenght', 1),
  'required' => true,
  'allowEmpty' => false,
  'message' => 'Please enter a user name'
   ),
   'password' => array(
  'rule' => array('minLenght', 1),
  'required' => true,
  'allowEmpty' => false,
  'message' => 'Please enter a password'
   ),

);
}
?>
In the users_controller.php
data)) {
  if(isset($this->data['User']['password2']))
 $this->data['User']['password2hashed'] = $this->
 Auth->password($this->data['User']['password2']);
  $this->User->create();
  if ($this->User->save($this->data)) {
 $this->Session->setFlash('Congratulations! You have signed
up!');
   } else {
 $this->Session->setFlash('There was an error signing up.
Please, try again.');
 $this->data = null;
  }
   }
}
   function login() {}
   function logout() {
  $this->Session->setFlash('Logout');
  $this->redirect($this->Auth->logout());
   }
}
?>
And in the register.ctp file
for error message display
isFieldError('User.name')) e($form->error
 ('User.name', null, array('class' => 'failure')));
   else if($form->isFieldError('User.telephone')) e($form->error
 ('User.telephone', null, array('class' => 'failure')));
   else if($form->isFieldError('User.email')) e($form->error
 ('User.email', null, array('class' => 'failure')));
   else if($form->isFieldError('User.username')) e($form->error
 ('User.username', null, array('class' => 'failure')));
?>

n this is my form
create('User', array('action' => 'register')));?>






Firstname 
text('name', array('class'=>
'fullwidth'))); ?>


Lastname 
 text('surname', array('class' 
=>
'fullwidth'))); ?>


Contact Number 
 text('telephone', 
array('class' =>
'fullwidth'))); ?>


Fax 
 text('fax', array('class' =>
'fullwidth'))); ?>


Email 
 text('email', array('class' =>
'fullwidth'))); ?>


Postal Address 
 text('address1', array('class' =>
'fullwidth'))); ?>



 text('address2', array('class' 
=>
'fullwidth'))); ?>



 text('address3', array('class' =>
'fullwidth'))); ?>



 text('postal_code', array('class' =>
'fullwidth'))); ?>


Username 
 text('username', array('class' 
=>
'fullwidth'))); ?>


Password 
 password('password', 
array('class'
=> 'fullwidth'))); ?>


Confirm Password 
 password('cpassword', 
array('class'
=> 'fullwidth'))); ?>


 




 submit('Save',
array('div' => false,'class' => 'submitbutton'))); ?&g

After validation data is getting cleared

2010-04-08 Thread Ambika Kulkarni
Hi all,

After validation the data from the filed is disappearing. How to
restore the values of the field.
I am using
text('name', array('class'=> 'fullwidth'))); ?> tag for
creating fields.

Thanks in advance
Ambika

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

To unsubscribe, reply using "remove me" as the subject.


Re: displaying login details

2010-04-07 Thread Ambika Kulkarni
Hey Sana,

function fetchData()
{
 $this->loadModel('MainCategory','MenuItem','GroupUser','User');
 $main_category  = $this->query("SELECT mi.*, ga.* FROM menu_items as
mi

LEFT JOIN group_access as ga ON mi.menu_item_id 
= ga.menu_item_id

LEFT JOIN group_users as gu ON ga.group_id = 
gu.group_id

LEFT JOIN users as u ON gu.user_id = u.user_id

WHERE u.user_id = '$user_id'

ORDER BY mi.order");
 $this->set('main_category',$main_category);
 }

in the fetch data method i put the above code. n its not taking value
for user_id. Inspite of that if i put 1 the query will work n gives an
array as o/p.




On Apr 7, 5:44 pm, Hani Sana  wrote:
> ur well come !
>
> On Wed, Apr 7, 2010 at 5:30 PM, Ambika Kulkarni
>
>  wrote:
> > Hi thanks,
>
> > It worked..:)
>
> > On Wed, Apr 7, 2010 at 4:59 PM, Hani Sana  wrote:
>
> >> In your App controller
> >> make a >>>>>>>>>>>>>
> >> function beforeRender()
> >> {
> >>  $this->fetchData();
> >> }
> >> below it make a function to fetch data like
> >> function __fetchData()
> >> {
> >>  $this->loadModel('modelname');
> >>  $varname  = $this->modelname->find('all');
> >>  $this->set('varname  ',$varname;
> >> }
>
> >> I hope this will solved your problems ,try it ..Bye.
>
> >> 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
>
> >> To unsubscribe, reply using "remove me" as the subject.
>
> > 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 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: displaying login details

2010-04-07 Thread Ambika Kulkarni
Hi thanks,

It worked..:)

On Wed, Apr 7, 2010 at 4:59 PM, Hani Sana  wrote:

> In your App controller
> make a >
> function beforeRender()
> {
>  $this->fetchData();
> }
> below it make a function to fetch data like
> function __fetchData()
> {
>  $this->loadModel('modelname');
>  $varname  = $this->modelname->find('all');
>  $this->set('varname  ',$varname;
> }
>
> I hope this will solved your problems ,try it ..Bye.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

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


displaying login details

2010-04-07 Thread Ambika Kulkarni
Hi all,

The prob that i am facing is something like this.

I have a login form, I am able to do login after that I am showing
logout link on the left side. with that I want to display some more
contents one after the other. For this the data come from a table
called menu_items.

Now I am not understanding where to put the code for fetching the data
from the database.

I have a line of code:
$this->set('main_category', $this->MainCategory->find('list',
array('fields' => array('main_category_id','main_category'; some
thing like this.

I am using default.ctp page. I placed this code here. But its throwing
error.
(Undefined variable: maincategory)

Where to put this line.

Please help 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

To unsubscribe, reply using "remove me" as the subject.


Re: jQuery to build dynamic selects…

2010-04-05 Thread Ambika Kulkarni
I tried that one, but its not working.
In that article they dint mentioned the keywords they have used. I mean they
have used carModel n not mentioned about it. So I stuck up in that code.

so trying for other thing.

Thanks

On Mon, Apr 5, 2010 at 6:13 PM, jacmoe  wrote:

> Try this:
>
> http://teknoid.wordpress.com/2010/03/10/use-cakephp-jquery-to-build-dynamic-selects/
>
> On Apr 5, 1:21 pm, Ambika Kulkarni  wrote:
> > Hi there,
> >
> > I want a drop down list and on chage another drop down lst has to be
> > done.
> >
> > Please help me out.
> >
> > 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

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: On select of option dynamicaly fetch data from DB and populate in a dropdown

2010-04-05 Thread Ambika Kulkarni
Hey can you please explain it with an eg:

well I have a main_categories and sub_categories table.
I have to take main_cat tbl data in 1 dropdown n on change of it
depending upon the cat_id select data from sub_categories table
and display in a drop down.

Tbl schema is:
main_categories(main_category_id,main_category, type, active)
sub_categories(sub_category_id, sub_category,   main_category_id, type,
active);


Thanks in Advance


On Apr 2, 9:07 pm, cricket  wrote:
> First off, you can save yourself the foreach loop by using
> find('list'), which will give you an array you can pass directly to
> the select() method.
>
> Anyway, this depends on how you're using javascript. If you happen to
> be using jQuery, have a look at the $.ajax() function. Figure out what
> the generated ID of the select list is and do something like this:
>
> $('#theSelectID').change(function()
> {
>         $.ajax({
>                 url: '/controller/action/'+$(this).val(),
>                 cache: false,
>                 success:
>                         function(html)
>                         {
>                                 $('#theSelectID').after(html);
>                         }
>         });
>
> });
>
> Create an action in your controller that accepts a Supplier.id and
> fetches a list. Use RequestHandler to test that it's an AJAX request.
> Populate the new select list in your view. That will be passed back to
> the $.ajax() function.
>
> The way you place the returned html into the document will vary
> according to your layout, of course.
>
> On Apr 2, 3:35 am, Ambika Kulkarni  wrote:
>
> > Hi there,
>
> > I'm pretty new to CakePHP. I have a drop down menu, in which the data
> > comes from DB. Following is the code for that.
> > In Controller file
> > function step_one(){
> >                 $suppliers = $this->Supplier->find('all', array('fields' =>
> > 'Supplier.name'));
> >                 $this->set('suppliers',$suppliers);
>
> > }
>
> > View file
>
> >                         $a = array();
> >                         $i=1;
> >                         foreach( $suppliers as $supplier ):
> >                             $a[$i] = $supplier['Supplier']['name'];
> >                             $i++;
> >                         endforeach;
> >                         echo $form->input('Supplier ', array('options' => 
> > $a));
>
> > This creates a drop down menu. On change I want to have another drop
> > down in which the data is fetched from DB.
>
> > 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

To unsubscribe, reply using "remove me" as the subject.


jQuery to build dynamic selects…

2010-04-05 Thread Ambika Kulkarni
Hi there,

I want a drop down list and on chage another drop down lst has to be
done.

Please help me out.

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

To unsubscribe, reply using "remove me" as the subject.


Table naming convention

2010-04-02 Thread Ambika Kulkarni
Hi,

I have table called main_categories. Now how to declare the model
name, controller name and views folder

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

To unsubscribe, reply using "remove me" as the subject.


Re: Naming convention

2010-04-02 Thread Ambika Kulkarni
Hi,

I have table called more_categories. Now how to declare the model
name, controller name and views folder

Thanks in advance

On Apr 2, 2:45 pm, Ambika Kulkarni  wrote:
> Hi thanks It Worked
>
> On Fri, Apr 2, 2010 at 2:50 PM, Jeremy Burns  wrote:
> > It's not ideal to move away from conventions, but you can use var $useTable
> > = 'myname'; in your Myname model.
>
> > Jeremy Burns
> > jeremybu...@me.com
>
> > On 2 Apr 2010, at 10:17, Ambika Kulkarni wrote:
>
> > > Hi there,
>
> > > I am pretty new to cake.
> > > I am aware of naming conventions in cakePHP as I have created some
> > > more models n controller they are working fine.  Here the table name
> > > itself is in singular name format. And I am not suppose to change the
> > > table name to plural.
>
> > > I am facing a problem while naming the controller name.
>
> > > Here it goes-->
> > > I have a table called myname(id,name)
> > > I created a model as myname.php
> > >  > > class Myname extends AppModel {
> > >   var $name = 'Myname';
> > > }
> > > ?>
> > > I created a controller as myname_controller.php
> > >  > > class MynameController extends AppController {
> > >   var $name = 'Myname';
> > >   var $components = array('Auth');
> > >    . . . . . . .
> > > }
> > > ?>
> > > and a view.ctp file
>
> > > I have several tables of singular name.
> > > Please help me...
>
> > > 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.comFor
> > >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> > > To unsubscribe, reply using "remove me" as the subject.
>
> > 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.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: Naming convention

2010-04-02 Thread Ambika Kulkarni
Hi thanks It Worked

On Fri, Apr 2, 2010 at 2:50 PM, Jeremy Burns  wrote:

> It's not ideal to move away from conventions, but you can use var $useTable
> = 'myname'; in your Myname model.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 2 Apr 2010, at 10:17, Ambika Kulkarni wrote:
>
> > Hi there,
> >
> > I am pretty new to cake.
> > I am aware of naming conventions in cakePHP as I have created some
> > more models n controller they are working fine.  Here the table name
> > itself is in singular name format. And I am not suppose to change the
> > table name to plural.
> >
> > I am facing a problem while naming the controller name.
> >
> > Here it goes-->
> > I have a table called myname(id,name)
> > I created a model as myname.php
> >  > class Myname extends AppModel {
> >   var $name = 'Myname';
> > }
> > ?>
> > I created a controller as myname_controller.php
> >  > class MynameController extends AppController {
> >   var $name = 'Myname';
> >   var $components = array('Auth');
> >. . . . . . .
> > }
> > ?>
> > and a view.ctp file
> >
> > I have several tables of singular name.
> > Please help me...
> >
> > 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.comFor
> >  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
> >
> > To unsubscribe, reply using "remove me" as the subject.
>
> 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.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


Naming convention

2010-04-02 Thread Ambika Kulkarni
Hi there,

I am pretty new to cake.
I am aware of naming conventions in cakePHP as I have created some
more models n controller they are working fine.  Here the table name
itself is in singular name format. And I am not suppose to change the
table name to plural.

 I am facing a problem while naming the controller name.

Here it goes-->
I have a table called myname(id,name)
I created a model as myname.php

I created a controller as myname_controller.php

and a view.ctp file

 I have several tables of singular name.
Please help me...

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

To unsubscribe, reply using "remove me" as the subject.


On select of option dynamicaly fetch data from DB and populate in a dropdown

2010-04-02 Thread Ambika Kulkarni
Hi there,

I'm pretty new to CakePHP. I have a drop down menu, in which the data
comes from DB. Following is the code for that.
In Controller file
function step_one(){
$suppliers = $this->Supplier->find('all', array('fields' =>
'Supplier.name'));
$this->set('suppliers',$suppliers);

}
View file

$a = array();
$i=1;
foreach( $suppliers as $supplier ):
$a[$i] = $supplier['Supplier']['name'];
$i++;
endforeach;
echo $form->input('Supplier ', array('options' => $a));

This creates a drop down menu. On change I want to have another drop
down in which the data is fetched from DB.


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


Undefined variable: javascript

2010-03-31 Thread Ambika Kulkarni
Notice (8): Undefined variable: javascript [APP/views/layouts/
default.ctp, line 6]
Fatal error: Call to a member function link() on a non-object in /var/
www/cake/app/views/layouts/default.ctp on line 6

Controller Code is
 var $components = array('Auth');
 var $helpers = array('Javascript','Form','Html','Event');

default.ctp
css('datepicker')."\n"; ?>
link('datepicker.js')."\n"; ?>

 $helpers array is defined only in AppController

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

To unsubscribe, reply using "remove me" as the subject.