form helper-> checkbox, issue with simpletest

2009-09-28 Thread Crazy

Hi,

When writing tests a project of ours, we used simpletest.
We ran into a problem that the formhelper adds a value to the
checkbox.
This causes that simpletest can not check if the checkbox is checked
or not.

Is there a reason for the 'value=' to be added?, because this value
does not change.

Is this an issue in the formhelper?, we could convert all the
checkboxes with the formhelper to html. But that's something we would
like to avoid.

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



Re: Display Error

2009-09-28 Thread John Andersen

Set the option for error to false in the field, that you don't want
the error to be displayed!
Enjoy,
   John

On Sep 29, 6:34 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> I need to place an error in a specific spot so I used the
>
> error($model . $field); ?>
>
> But the error shows up in 2 places now. Where I have my error code and
> beside the field. How can I remove it from the field so it only displays in
> the spot i want?
>
> Thanks,
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax (jquery) Question - am I doing this right?

2009-09-28 Thread Cronet

Hi Brian,

thanks for your answer.

That's a neat trick to avoid the switch statement!


I've done the redirecting, because i thought it's more DRY. With your
solution (which works perfect!) i need to copy the admin_index method
in the admin_switchStatus method.
(In this particular case, it's only a pagination statement...so no
problem)...

But what if the logic comes complexer? Should I then move it to the
model?


On Sep 29, 2:22 am, brian  wrote:
> On Mon, Sep 28, 2009 at 3:27 PM, cronet  wrote:
>
> > Hey,
>
> > i try to do my first steps with ajax (jquery) - In a list, i would
> > like to have a switch which changes the 'active' paramter in the db
> > for this entry.
>
> > As i understand this topic, I need to do an ajax call to a controller
> > method, which do the changes, and the realod the div with the new
> > entries...
>
> > so this is my controller method:
>
> >        function admin_switchStatus($id) {
> >                $this->News->id = $id;
> >                $news = $this->News->read('active', $id);
>
> >                switch($news['News']['active']) {
> >                        case "1":
> >                                $this->News->saveField('active', 0);
> >                                break;
> >                        case "0":
> >                                $this->News->saveField('active', 1);
> >                                break;
> >                }
>
> >                $this->redirect(array('controller'=>'news', 
> > 'action'=>'index',
> > 'admin'=>true));
> >        }
>
> > the jQuery for this in the admin index view is:
>
> > $('.switchStatus').click(function(){
> >        $.get($(this).attr('href'), function(data){
> >                $('#mainContent').html(data);
> >        });
> >        return false;
> > });
>
> > Is this the correct (?) way to achieve this?
>
> > Basically it works - but cake reloads not the admin_index but the
> > index view...
>
> I'm not sure why it's not rendering the admin view but you shouldn't
> be redirecting. Here's a simpler version:
>
> function admin_switchStatus($id)
> {
>         /* this also sets the model ID
>          */
>         $news = $this->News->read(null, $id);
>
>         /* toggle field
>          */
>         $this->News->saveField('active', 1 - $news['News']['active']);
>
>         /* need to have RequestHandler in $components
>          */
>         if ($this->RequestHandler->isAjax())
>         {
>                 Configure::write('debug', 0);
>                 $this->layout = 'ajax';
>         }
>         $this->render('admin_index');
>
> }
>
> $('.switchStatus').click(function()
> {
>         $.ajax({
>                 url: $(this).attr('href'),
>                 type: 'GET',
>                 success:
>                         function(data)
>                         {
>                                 $('#mainContent').html(data);
>                         },
>                 error:
>                         function (XMLHttpRequest, textStatus, errorThrown)
>                         {
>                                 alert(textStatus);
>                         }
>         });
>         return false;
>
>
>
> });
--~--~-~--~~~---~--~~
You received this 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::setAction heads-up

2009-09-28 Thread Bert Van den Brande
Ok tnx now I understand the problem, though I still can't wrap my head
around the core issue.

Is it that call_user_func_array() can never call private methods ? I found
some comments here and there on the web stating that the new Reflection API
will solve this, but nothing concrete on calling private methods ...

As far as I can tell it can't be an OO issue, since TransactionsController
will inherit the setAction() method from Controller ... therefore calling
setAction() on an instance of TransactionsController should be allowed to
access the private method error() that is defined in the same
TransactionsController class.

I love a good quiz now and then :)

On Mon, Sep 28, 2009 at 5:35 PM, brian  wrote:

>
> On Mon, Sep 28, 2009 at 11:20 AM, Bert Van den Brande 
> wrote:
> > I don't entirely understand why moving the target action from private to
> > protected or public results in the $viewVars being set or not set ?
>
> The first line in setAction() changes the controller's $action:
>
> $this->action = $action;
>
> Then, the last line of the method fails on call_user_func_array()
> because the given action is private:
>
> Warning (2): call_user_func_array()
> [http://php.net/function.call-user-func-array]: First argument is
> expected to be a valid callback, 'TransactionsController::error' was
> given [CORE_1.2.5/cake/libs/controller/controller.php, line 697]
>
> However, it's not a fatal error and the controller's $action has
> already been changed, so it's the view for this that is used in
> render() even though the action is never called.
>
> Anyway, it's not a Cake bug. I just wanted to post this for anyone
> else who might run into it.
>
> >
>

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



autocomplete program code error.

2009-09-28 Thread Jiru

dear cakePHP dvelopers ,

Plz help me in my autocomplete program.

here i adding my program code...hv a look on it,

controller function
-

layout = 'ajax';
//$this->set('items',$this->Autocomplete->find('all',array
('recursive =>3')));

  $this->Autocomplete->recursive = 0;
$this->set('autocompletes', $this->paginate());
//echo "hello";

}
function getData(){

$this->layout = 'ajax';
$this->set('items',$this->Autocomplete->find('all',array()));

}
}
?>
getData.ctp
---








anybody can correct the code in getData funcion or anywhrer.? or
getData.ctp file.

help me for ajax function page and css , js file .

regards,
jiru.



--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



rake routes equivalent?

2009-09-28 Thread p_W

I have recently started developing with CakePHP, but I have experience
with Rails.  I was wondering if there was something in Cake that is
equivalent to Rails' 'rake routes' command.  I always liked testing my
model associations with that command, so I hope there is something
similar in Cake.

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Model Associations on legacy tables with no primary keys

2009-09-28 Thread reesylou

 I have a legacy database and I am unfotunately unable to change the
table structure.

I have the following tables:
CODE
scheduled_models   (no primary key set, but should be model_id)
   model_idint(11)  auto_increment
   model_name  varchar(15)
   ... and other fields

and:
CODE
schedule_dates  (again no primary key, but should have a separate id
field)
   datedatetime
   model_name  varchar(15)

and:
CODE
scheduled_pics   (again no primary key set, but should be pic_id)
   pic_id  int(11)
   model_name  varchar(15)
    and other fields


I have a model for each and I am trying to link them together. The
relationships should be (as best I understand) a scheduled_model
belongsTo schedule_date, a schedule_date hasMany scheduled_model, a
scheduled_model hasMany schedule_pic and a scheduled_pic belongsTo a
scheduled_model.

Nothing I have tried works and I think part of it is because the
tables have no primary keys defined, and part because the foreign keys
are a little odd.

Currently, my models are as follows:
PHP Code

 array ( foreignKey => false,
 conditions  => array
(’ScheduledDate.model_name’ => ‘ScheduledModel.model_name’)));
  var $hasMany = "ScheduledPic";
}
?>

PHP Code

 array ( foreignKey => false,
 conditions  => array
(’ScheduledModel.model_name’ => ‘ScheduledDate.model_name’)));
}
?>

PHP Code



Please help with getting these relationships defined. I am a beginner
with cakePHP, and remember they are lagacy tables so cannot be
changed.

Thanks

Maree

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



input text box instead of dropdown list

2009-09-28 Thread Jiru

hii ,

In my project the names are displayed in dropdown list. bt i need it
in input text box with ajax autocomplete code.
--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Display Error

2009-09-28 Thread Dave Maharaj :: WidePixels.com
I need to place an error in a specific spot so I used the 
 
error($model . $field); ?> 
 
But the error shows up in 2 places now. Where I have my error code and
beside the field. How can I remove it from the field so it only displays in
the spot i want?
 
Thanks,
 
Dave

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



Re: Force a specific URL?

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 8:52 PM, tcornett  wrote:
>
> Is it possible to force or redirect an entire site to a specified URL?
>
> For example, http://example.com/ gets redirected to http://www.example.com/
>
> Is this possible?  If so, can someone point me in the right direction?
>

Use mod_rewrite for that. It's called canonical hostname. Put this in
the top-level .htaccess:

RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

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



Validate non-existent Model

2009-09-28 Thread Dave Maharaj :: WidePixels.com

I upload an image using a component which produces this array
 
[Image] => Array
(
[image] => Array
(
[name] => blue_self_shot_m057.jpg
[type] => image/jpeg
[tmp_name] => /var/tmp/phpZ0VP1f
[error] => 0
[size] => 183628
)

)

Now I want to add validation to this but I have no Image model. How can I
validate this?

Thanks

 
Dave


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



cakePHP with FatCow hosting provider - mod_rewrite issue?

2009-09-28 Thread DK

Does anyone have a cakephp application running with the FatCow hosing
provider? I have the base code installed in my /cake directory.
My URL is below:
http://www.laidbacksurf.com/cake/

I get the following on the screen...but the base stylesheet doesn't
appear and no images are found...
Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit
APP/config/core.php

Your database configuration file is present.

Cake is able to connect to the database.

I didn't have to do anything in my local environments and am not
familiar with the details of mod_rewrite or detailed Apache setup. Any
ideas?

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



Force a specific URL?

2009-09-28 Thread tcornett

Is it possible to force or redirect an entire site to a specified URL?

For example, http://example.com/ gets redirected to http://www.example.com/

Is this possible?  If so, can someone point me in the right direction?

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



Extracting PATHS but not the full HTML object

2009-09-28 Thread tcornett

I am curious how I would extract the path of a LINK or an IMAGE
without getting the whole HTML object.  Instead of getting the 'http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Modyfication into beforeSave()

2009-09-28 Thread Marcelo Andrade

On Mon, Sep 28, 2009 at 6:03 PM, kicaj  wrote:
>
> I have relations Post hasMany Tag, and my form look like this:
>
> create('Post');
>                echo $form->input('name');
>                echo $form->input('content');
>                echo $form->input('Tag.0.name');
>                echo $form->input('Tag.1.name');
>                echo $form->end('Submit');       ?>
>
> ...and this form create 3 INSERT queries ($this->Post->saveAll()),
> but I would like adding some fields in beforeSave() function, for
> example:
> $this->data['Tag'][2]['name'] = 'some...';
> $this->data['Tag'][3]['name'] = 'some2...';
>
> But this's not working, why?
> How I can adding fields into beforeSave


Do you have any validation rules?  What's the
output from $this->Post->invalidFields() after
save all?

Best regards.

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

--~--~-~--~~~---~--~~
You received this 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: Ajax (jquery) Question - am I doing this right?

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 3:27 PM, cronet  wrote:
>
> Hey,
>
> i try to do my first steps with ajax (jquery) - In a list, i would
> like to have a switch which changes the 'active' paramter in the db
> for this entry.
>
> As i understand this topic, I need to do an ajax call to a controller
> method, which do the changes, and the realod the div with the new
> entries...
>
>
>
> so this is my controller method:
>
>        function admin_switchStatus($id) {
>                $this->News->id = $id;
>                $news = $this->News->read('active', $id);
>
>                switch($news['News']['active']) {
>                        case "1":
>                                $this->News->saveField('active', 0);
>                                break;
>                        case "0":
>                                $this->News->saveField('active', 1);
>                                break;
>                }
>
>                $this->redirect(array('controller'=>'news', 'action'=>'index',
> 'admin'=>true));
>        }
>
>
>
>
> the jQuery for this in the admin index view is:
>
> $('.switchStatus').click(function(){
>        $.get($(this).attr('href'), function(data){
>                $('#mainContent').html(data);
>        });
>        return false;
> });
>
>
>
> Is this the correct (?) way to achieve this?
>
> Basically it works - but cake reloads not the admin_index but the
> index view...

I'm not sure why it's not rendering the admin view but you shouldn't
be redirecting. Here's a simpler version:

function admin_switchStatus($id)
{
/* this also sets the model ID
 */
$news = $this->News->read(null, $id);

/* toggle field
 */
$this->News->saveField('active', 1 - $news['News']['active']);

/* need to have RequestHandler in $components
 */
if ($this->RequestHandler->isAjax())
{
Configure::write('debug', 0);
$this->layout = 'ajax';
}
$this->render('admin_index');
}


$('.switchStatus').click(function()
{
$.ajax({
url: $(this).attr('href'),
type: 'GET',
success:
function(data)
{
$('#mainContent').html(data);
},
error:
function (XMLHttpRequest, textStatus, errorThrown)
{
alert(textStatus);
}
});
return false;
});

--~--~-~--~~~---~--~~
You received this 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: Intergrate cakephp with just static html pages

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 10:56 AM, dong.l...@gmail.com
 wrote:
>
> Dear all,
>
> I have existed html files for one website, I would like to intergrate
> them with cakephp to add some dynamic methods. At the same time, I
> want to keep all the old static pages to save time. When I put html
> pages in the root folder, it still handle by cakephp. I know it
> because the .htaccess file will look for index.php file in the webroot
> folder first.
>
> So how can I change the .htaccess file to make it work. I want it can
> look for .html files first, if no html files, then it looks for
> index.php.
>
> Below is oringal .htaccess file
>
> 
>   RewriteEngine on
>   RewriteRule    ^$ app/webroot/
>   RewriteRule    (.*) app/webroot/$1 [L]
> 

There's no need to change any of the .htaccess files. Put your HTML
files in app/webroot. The .htaccess file in that directory will only
pass the request to Cake if the file or directory does not exist
there. Note the 2 RewriteCond lines:


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]


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



RE: Validate belongsTo - SOLVED

2009-09-28 Thread Dave Maharaj :: WidePixels.com

 I got it. Was using the State model in error as I am validating state_id in
the Experience

-Original Message-
From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: September-28-09 6:32 PM
To: cake-php@googlegroups.com
Subject: Validate belongsTo


I am trying to validate Country and State models from there related models
$belongsTo
 
In the form users select Country and State which is populated from the db.
 
So each has an id...
 
Now I want to make sure someone is not messing with the values with Firebug.

So in my Experience controller this is the 

debug($this->data); right before the save();
 
Array
(
[Experience] => Array
(
[company] => Sants Workshop
[position] => Head Elf
[city] => Secret
[state_id] => 31
[country_id] => 3
[respons] => 
[start] => 2055
[finished] => 
)

)

So I change a State value to ABCD which is not in the DB as an ID

Array
(
[Experience] => Array
(
[company] => Sants Workshop
[position] => Head Elf
[city] => Secret
[state_id] => ABCD
[country_id] => 3
[respons] => 
[start] => 2055
[finished] => 
)

)

State Model:

function checkStateValues($data)
  {
  $valid = false;
  if (!empty($this->data)) {
  $san = new Sanitize();
  $this->data = $san->paranoid($this->data);
 $results = array_diff($this->data,
$this->find('list', array('fields' => 'id', 'order' => 'id ASC')));
  if (empty($results)) 
  $valid = true;
  }
return $valid;
  }

Do I need to set both State and Country to their models? I have in the
controller:

$black = array('id', 'user_id');
  if ($this->Experience->save($this->data, true,
array_diff(array_keys($this->Experience->schema()), $black))) {

So it should be checking validation before save with 'true' no? Or does it
only validate the Experience Model?

Thanks

Dave




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



Modyfication into beforeSave()

2009-09-28 Thread kicaj

I have relations Post hasMany Tag, and my form look like this:

create('Post');
echo $form->input('name');
echo $form->input('content');
echo $form->input('Tag.0.name');
echo $form->input('Tag.1.name');
echo $form->end('Submit');   ?>

...and this form create 3 INSERT queries ($this->Post->saveAll()),
but I would like adding some fields in beforeSave() function, for
example:
$this->data['Tag'][2]['name'] = 'some...';
$this->data['Tag'][3]['name'] = 'some2...';

But this's not working, why?
How I can adding fields into beforeSave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validate belongsTo

2009-09-28 Thread Dave Maharaj :: WidePixels.com

I am trying to validate Country and State models from there related models
$belongsTo
 
In the form users select Country and State which is populated from the db.
 
So each has an id...
 
Now I want to make sure someone is not messing with the values with Firebug.

So in my Experience controller this is the 

debug($this->data); right before the save();
 
Array
(
[Experience] => Array
(
[company] => Sants Workshop
[position] => Head Elf
[city] => Secret
[state_id] => 31
[country_id] => 3
[respons] => 
[start] => 2055
[finished] => 
)

)

So I change a State value to ABCD which is not in the DB as an ID

Array
(
[Experience] => Array
(
[company] => Sants Workshop
[position] => Head Elf
[city] => Secret
[state_id] => ABCD
[country_id] => 3
[respons] => 
[start] => 2055
[finished] => 
)

)

State Model:

function checkStateValues($data)
  {
  $valid = false;
  if (!empty($this->data)) {
  $san = new Sanitize();
  $this->data = $san->paranoid($this->data);
 $results = array_diff($this->data,
$this->find('list', array('fields' => 'id', 'order' => 'id ASC')));
  if (empty($results)) 
  $valid = true;
  }
return $valid;
  }

Do I need to set both State and Country to their models? I have in the
controller:

$black = array('id', 'user_id');
  if ($this->Experience->save($this->data, true,
array_diff(array_keys($this->Experience->schema()), $black))) {

So it should be checking validation before save with 'true' no? Or does it
only validate the Experience Model?

Thanks

Dave


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



Sorting Paginated Results Question

2009-09-28 Thread Paul Redmond

I have searched high and low for an answer to this question...

I have a 1 to 1 relationship in my database.

A Restaurant has one Coupon

The coupon is optional, so the restaurant without coupons should be
included in the result set, however, when I try to sort by restaurants
that have a coupon first, then by Restaurant Name ASC, restaurants
without coupons are mixed in the results. I would like to sort by the
following:

Sort by whether or not restaurant has a coupon (yes before no)
Sort by Restaurant Name ASC

So all coupon results first A-Z and then all non-coupon restaurants A-
Z.

The best I could do is sort by Coupon.id DESC, but the sort should be
by Whether they have a coupon or not, and then by restaurant name.
Here is my controller paginate var. :

var $paginate = array(
'Restaurant' => array(
'limit' => 50, 'page' => 1,
'order' => array('Coupon.id' => 'DESC',
'Restaurant.tier'=>'ASC', 'Restaurant.name' => 'ASC'),
'contain' => array('Address', 'Coupon'),
'fields' => array(
'Restaurant.id', 'Restaurant.name', 'Restaurant.tier',
'Coupon.id', 'Coupon.restaurant_id', 'Coupon.value', 'Coupon.type',
'Coupon.restaurant_tier', 'Coupon.restaurant_name',
'Coupon.description','Coupon.terms','Coupon.title','Coupon.exp_date',
'Address.*',
),
'recursive' => 0,
)
);

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



habtm limit

2009-09-28 Thread bram

In my app, I have a User model that has a habtm association with
'Event'. In one of the views, I want to show a list of Users and their
most recent event.

I ended up with this definition in the User model:

var $hasAndBelongsToMany = array(
'Event' => array(
'className' => 'Event',
'joinTable' => 'events_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'event_id',
'unique' => true,
'limit' => 1,
'order' => 'Event.date DESC'
)
);

find('all') returns the list of all users and only one of them has an
associated event.

When increasing the limit, it does show associated events, but when
some user don't have events associated, some other users will have
multiple events returned.

Is this a cake bug or do I have the wrong impression of the limit in a
habtm association?

Cheers,

Bram
--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Ajax (jquery) Question - am I doing this right?

2009-09-28 Thread cronet

Hey,

i try to do my first steps with ajax (jquery) - In a list, i would
like to have a switch which changes the 'active' paramter in the db
for this entry.

As i understand this topic, I need to do an ajax call to a controller
method, which do the changes, and the realod the div with the new
entries...



so this is my controller method:

function admin_switchStatus($id) {
$this->News->id = $id;
$news = $this->News->read('active', $id);

switch($news['News']['active']) {
case "1":
$this->News->saveField('active', 0);
break;
case "0":
$this->News->saveField('active', 1);
break;
}

$this->redirect(array('controller'=>'news', 'action'=>'index',
'admin'=>true));
}




the jQuery for this in the admin index view is:

$('.switchStatus').click(function(){
$.get($(this).attr('href'), function(data){
$('#mainContent').html(data);
});
return false;
});



Is this the correct (?) way to achieve this?

Basically it works - but cake reloads not the admin_index but the
index view...




--~--~-~--~~~---~--~~
You received this 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: Ayuda con obtencion de dato phpCake

2009-09-28 Thread Steven Granados
Thank you very much!!

God bless you!!

On Wed, Sep 23, 2009 at 9:22 PM, Marcelo Andrade wrote:

>
> 2009/9/23 stevengc :
> > (..)
> > Necesito que a la hora de guardar los valores.. al title yo pueda
> > concatenarle el text de subCategory
> >
> > ejemplo: necesito que la salida sea algo asi:  Titulo prueba (San
> > Ramon)
> >
> > Yo hice lo siguiente
> > :
> > $this->data['Categoriesinad']['title'] = $this->data['Categoriesinad']
> > ['title'].' ('.$this->data['Categoriesinad']['subcategory_id'].')';
> >
> > pero la salida es ésta: Titulo prueba (1), quiero decir que obtengo el
> > id pero necesito el texto.
>
> Trivial: just fetch the value for the Subcategory.
>
> $this->Categoriessinad->Subcategory->id=
> $this->data['Categoriesinad']['subcategory_id'];
> $subcat= $this->Categoriessinad->Subcategory->read();
> $val= $subcat['Subcategory']['description'];
>
> $this->data['Categoriesinad']['title'] =
> $this->data['Categoriesinad']['title'].' ('.$val.')';
>
> Adjust to your case.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> >
>

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Intergrate cakephp with just static html pages

2009-09-28 Thread dong.l...@gmail.com

Dear all,

I have existed html files for one website, I would like to intergrate
them with cakephp to add some dynamic methods. At the same time, I
want to keep all the old static pages to save time. When I put html
pages in the root folder, it still handle by cakephp. I know it
because the .htaccess file will look for index.php file in the webroot
folder first.

So how can I change the .htaccess file to make it work. I want it can
look for .html files first, if no html files, then it looks for
index.php.

Below is oringal .htaccess file


   RewriteEngine on
   RewriteRule^$ app/webroot/
   RewriteRule(.*) app/webroot/$1 [L]


Thx a lot!

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Oracle 10g

2009-09-28 Thread osamo101

Hi

I have a problem connecting to Oracle 10g database.

When I put 'driver' => 'oracle', I got an error in the homepage so I
changed it to ODBC but also I am not able to connect.
My configuration is as follows:

var $default = array(
'driver' => 'odbc',
'persistent' => false,
'host' => 'MyServer',
'login' => 'UserID',
'password' => 'Password',
'schema' => 'MySchema',
'database' => 'orcl',
'prefix' => '',
'encoding' =>''
);

I am waiting for a solution from you.

Thanks in advance.

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



Modula approach

2009-09-28 Thread Wilhelm

Hi,

I am a relative newbie when working with CakePhp with only a few
simple sites made. I would like to make a site using a modular
approach, where I can give users access to different sections and
ideally but not necessary at this point be able to assign the same
module to a user with a different name. What I would like to ask you
guys is if possible to point to where I can find more information or
examples of this. I have taken a look at the "Designing a modular
application using CakePHP plugins" which seems to be what I want to do
it goes does not have enough information for me to follow at the
moment with my knowledge.

Any help would be greatly appreciated

Regards
Wilhelm

--~--~-~--~~~---~--~~
You received this 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: Doubt in cake php

2009-09-28 Thread Jon Bennett

hi Mark

> 1.3 will not be implementing object results from models.  1.3 is still
> php4 compatible, and is a _minor_ version release.  Switching out the
> lower levels of how models work is not a minor change.  Perhaps you
> are thinking of CakePHP 2.x?

Ahh, ahem - yes, I was


-- 

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

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



Re: Doubt in cake php

2009-09-28 Thread mark_story

1.3 will not be implementing object results from models.  1.3 is still
php4 compatible, and is a _minor_ version release.  Switching out the
lower levels of how models work is not a minor change.  Perhaps you
are thinking of CakePHP 2.x?

-Mark

On Sep 24, 3:25 pm, Jon Bennett  wrote:
> Hi,
>
> > Basically i am looking for something similar like View Helpers in
> > Zend. We can access the model data in views using view Helpers. Is
> > there something similar in cakephp.
>
> Short answer: you can't.
>
> Longer answer: as the current version of cake is both php4 and 5
> compatible, it uses arrays for data, not objects because objects are v
> slow and limited in php4. This is why you pass the data from the model
> to the controller to the view, and can't access models directly, even
> read only, from the view.
>
> Cake 1.3 I believe will use objects, certainly the future cakephp 2 and 3 
> will.
>
> hth
>
> Jon
> ps: A more descriptive subject would probably have led to an answer
> sooner - I only looked because I was curious, not because I knew I
> could help
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Password getting hashed before validation

2009-09-28 Thread Marcelo Andrade

On Mon, Sep 28, 2009 at 1:58 PM, walkerfx  wrote:
>
> I have a user auth system based on the Simple Acl tutorial. I've run
> into a problem however in that my password data is getting hashed
> before validation. So my validation isn't working correctly when
> adding or editing a user.

Apply your validation rules to the password confirmation field.

Best regards.

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

--~--~-~--~~~---~--~~
You received this 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: Run a cron Job

2009-09-28 Thread Dave Maharaj :: WidePixels.com

Yeah the CP has basic and advanced. Basic you select days/month/min/time and
so on and enter /path/to/cake/console/cake -app /path/to/your/app
shell_task_name 
Advanced is the *** input 

Will give it another shot.

But based on the set up above if I have my shell code (reports.php) in
app/vendors/shell I would use something like /mypath/to/cake/console/cake
-app /mypath/app reports (mypath being changed obviously)

Dave

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: September-28-09 2:15 PM
To: cake-php@googlegroups.com
Subject: Re: Run a cron Job


On Mon, Sep 28, 2009 at 12:24 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> Yeah I set up a reports.php like they did in the Cookbook but even 
> when I try to run it from the control panel I keep getting '/bin/sh: 
> 15: command not found'

It looks like you're trying to feed the shell the example I posted.
The "15" being the first part, which the shell doesn't understand. The
"15 0 * * *" part of the line is what tells cron when to run the job.

How does your control panel set up cron jobs? Does it have a widget for
setting the time of day? If so, you probably want to do that and then
provide just this part as the job:

/path/to/cake/console/cake -app /path/to/your/app shell_task_name

Those paths are from root.



--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Password getting hashed before validation

2009-09-28 Thread walkerfx

I have a user auth system based on the Simple Acl tutorial. I've run
into a problem however in that my password data is getting hashed
before validation. So my validation isn't working correctly when
adding or editing a user.

I made certain that I'm not applying the hash myself and discovered
that it is AuthComponent. In the auth startup, there's this line:
$this->data = $controller->data = 
$this->hashPasswords($controller-
>data);

This is interfering with my validation and I'm not sure what to do. I
can think of a couple ways to get around this (ie change the name of
my password field, or don't use $this->data when adding or editing
user data), but I'd really like to know the 'proper' way to go about
this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Run a cron Job

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 12:24 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> Yeah I set up a reports.php like they did in the Cookbook but even when I
> try to run it from the control panel I keep getting '/bin/sh: 15: command
> not found'

It looks like you're trying to feed the shell the example I posted.
The "15" being the first part, which the shell doesn't understand. The
"15 0 * * *" part of the line is what tells cron when to run the job.

How does your control panel set up cron jobs? Does it have a widget
for setting the time of day? If so, you probably want to do that and
then provide just this part as the job:

/path/to/cake/console/cake -app /path/to/your/app shell_task_name

Those paths are from root.

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Scriptaculous effect running two times on $ajax->div

2009-09-28 Thread Kappa

Hi everybody,
today I was doing a country-> region -> city selection page
and i was trying to dynamically update the same $ajax->div('list');
according to the selected item.

Everything was ok, until i tried to apply some effect on the 'before'
callback (the same happened with the 'after' callback): what happens
is that the effect I put on the div  $('list').slideUp() it is
executed twice, one before the ajax request is sent and one on the
updated div (after the ajax response, and the consecutive view
rendering).

Does anybody can tell me why?

Should i use different div ID's between the ayax calls?

--~--~-~--~~~---~--~~
You received this 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: Run a cron Job

2009-09-28 Thread Dave Maharaj :: WidePixels.com

Yeah I set up a reports.php like they did in the Cookbook but even when I
try to run it from the control panel I keep getting '/bin/sh: 15: command
not found'

I will just leave it for now and run it myself from admin.

Dave


-Original Message-
From: Miles J [mailto:mileswjohn...@gmail.com] 
Sent: September-28-09 1:49 PM
To: CakePHP
Subject: Re: Run a cron Job


Cron isn't run through PHP, I think thats what your trying to get at.
You have to setup cron jobs through your hosts control panel, or at least
figure out where you define your cron jobs.

On Sep 28, 8:58 am, brian  wrote:
> On Mon, Sep 28, 2009 at 10:02 AM, Dave Maharaj :: WidePixels.com
>
>  wrote:
>
> > Ok, thanks,
>
> > I want the cron to run by its self at a specific time. SoI do not 
> > have to do it myself daily. Can this be done in your approach? New to
cron set up.
>
> Yes, this is exactly what cron is for. You'd enter it like so:
>
> 15 0 * * * /path/to/cake/console/cake -app /path/to/your/app 
> shell_task_name
>
> Have a look online how to set up jobs at a particular time.


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



Re: Run a cron Job

2009-09-28 Thread Miles J

Cron isn't run through PHP, I think thats what your trying to get at.
You have to setup cron jobs through your hosts control panel, or at
least figure out where you define your cron jobs.

On Sep 28, 8:58 am, brian  wrote:
> On Mon, Sep 28, 2009 at 10:02 AM, Dave Maharaj :: WidePixels.com
>
>  wrote:
>
> > Ok, thanks,
>
> > I want the cron to run by its self at a specific time. SoI do not have to do
> > it myself daily. Can this be done in your approach? New to cron set up.
>
> Yes, this is exactly what cron is for. You'd enter it like so:
>
> 15 0 * * * /path/to/cake/console/cake -app /path/to/your/app shell_task_name
>
> Have a look online how to set up jobs at a particular time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing related issue

2009-09-28 Thread brian

I believe the problem was that you were giving jQuery an incomplete
URL. It should be:
url: '/publishers/update_city_select'

On Mon, Sep 28, 2009 at 12:37 AM, stevel  wrote:
>
>
> I figured it out finally. To solve the problem, I use the $html->url
> helper.
> In this case it will be
>
> url: "url('/publishers/update_city_select'); ?>"
>
> Perhaps this might help someone else with the same problem.
>
> cheers,
> Steve
>
> >
>

--~--~-~--~~~---~--~~
You received this 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: Empty records in database (even with validation and ACL in place)

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 3:04 AM, Jeroen  wrote:
>
> Hi all,
>
> I've run into the strangest problem, and have no idea where to start
> looking: I've got an community platform website, where members
> (sometimes only admins) can post content. Somehow, about once a day on
> different times and without other content being posted at the same
> time, empty records appear in my database. As far as I know, this
> shouldn't be possible:

Do you have access to the DB config? If so, set it to log all
inserts/updates (don't forget to change it back for production unless
you want that).

> - all models have pretty tight validation rules that should prevent
> this kind of behaviour
> - all add/edit methods are protected by ACL, so only users can add/
> edit. Some of them are even admin-only accessible
> - every save action fills the user_id field just before saving, but
> the user_id for the empty records is 0 (zero)
>
> Since the user_id isn't saved, I guess creation of the new record
> doesn't happen through the add/edit methods in the controller. That
> might also explain why validation rules are ignored.
>
> As I said, don't know where to start looking. This must be triggered
> by some kind of user action, but how, why and where is a huge problem
> to find out. Anyone?

How do you get the User.id? From $this->Auth->user() or somewhere in
$this->data?

How many tables does this affect? If just one, it should be easy
enough to narrow down which actions are responsible. Put some
$this->log() calls in there.

--~--~-~--~~~---~--~~
You received this 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: Run a cron Job

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 10:02 AM, Dave Maharaj :: WidePixels.com
 wrote:
>
> Ok, thanks,
>
> I want the cron to run by its self at a specific time. SoI do not have to do
> it myself daily. Can this be done in your approach? New to cron set up.
>

Yes, this is exactly what cron is for. You'd enter it like so:

15 0 * * * /path/to/cake/console/cake -app /path/to/your/app shell_task_name

Have a look online how to set up jobs at a particular time.

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



Re: Need little help with cake image paths

2009-09-28 Thread brian

I think you'd need to extend HtmlHelper yourself and give it a class
variable to set. In HtmlHelper::image() there's a $path var that's set
but it's not a class var. If you changed it to use something like
$this->img_path you could query the helper after calling your image()
method.

On Mon, Sep 28, 2009 at 11:07 AM, Ernesto  wrote:
>
> Hello.
>
> i'm in a multi-app environment and my images could be in app/webroot/
> img or shared_items/vendors/img
>
> when i use HtmlHelper i write only the img's name... and then cake
> searches for it in every img folder.
>
> is there any way to get the resultant path? i need it in TCPDF's image
> method
>
>
> >
>

--~--~-~--~~~---~--~~
You received this 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: neighbors sort

2009-09-28 Thread euromark (munich)

i ended up writing some highly complicated function for it myself
not only for your problem, but for "correct" neighbors in general

if you use UUIDs you dont have sorted IDs anyway
and sometimes you have to sort by more than just 1 field etc..


On 25 Sep., 17:27, mklappen  wrote:
> Hi
>
> Is there a way I can sort a query and then have the find (neighbors)
> based on that sort?
>
> I'm trying to sort my results by title and then would like prev/next
> elements returned by neighbors to be the prev/next title in alpha
> order. However, neighbors is returing the prev/next ids which are not
> in alpha order.
>
> $this->Game->find('neighbors',array
> ('fields'=>'Game.title','order'=>'Game.title ASC'));
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller::setAction heads-up

2009-09-28 Thread brian

On Mon, Sep 28, 2009 at 11:20 AM, Bert Van den Brande  wrote:
> I don't entirely understand why moving the target action from private to
> protected or public results in the $viewVars being set or not set ?

The first line in setAction() changes the controller's $action:

$this->action = $action;

Then, the last line of the method fails on call_user_func_array()
because the given action is private:

Warning (2): call_user_func_array()
[http://php.net/function.call-user-func-array]: First argument is
expected to be a valid callback, 'TransactionsController::error' was
given [CORE_1.2.5/cake/libs/controller/controller.php, line 697]

However, it's not a fatal error and the controller's $action has
already been changed, so it's the view for this that is used in
render() even though the action is never called.

Anyway, it's not a Cake bug. I just wanted to post this for anyone
else who might run into it.

--~--~-~--~~~---~--~~
You received this 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::setAction heads-up

2009-09-28 Thread Bert Van den Brande
I don't entirely understand why moving the target action from private to
protected or public results in the $viewVars being set or not set ?

On Mon, Sep 28, 2009 at 5:05 PM, brian  wrote:

>
> OK, I suppose that wasn't very clear. What I was getting at is that,
> if calling setAction(), the target action must have either public or
> protected access.
>
> On Sun, Sep 27, 2009 at 11:20 PM, Martin Radosta
>  wrote:
> >
> > On 09/27/2009 04:31 PM, brian wrote:
> >> The comment for setAction() says that it "Internally redirects one
> >> action to another." However, it doesn't really *redirect* so much as
> >> simply call the action using call_user_func_array(). It amounts to
> >> about the same thing, more or less, but there's something to keep in
> >> mind:
> >>
> >> public function someAction()
> >> {
> >>   $this->setAction(
> >>   'error',
> >>   'This error message should display.',
> >>   array('foo' =>  'bar')
> >>   );
> >> }
> >>
> >> private function error($msg = '', $data = array())
> >> {
> >>   $this->set(compact('msg', 'data'));
> >> }
> >>
> >> This will display the error view *but* the $viewVars will not be set.
> >> In order to make this work, set the access to the called action to
> >> protected (or public, obviously), because setAction() is defined in
> >> the parent class (Controller). If you absolutely need it to be
> >> private, you'll have to override setAction() in your own controller.
> >>
> > Don't know if I understand "exactly" your problem, but maybe an
> > auxiliary function should do the job:
> >
> > public function someAction() {
> > $this->setVars('varA', 'varB', 'varN');
> > $this->setAction('error');
> > }
> >
> > private function error() {
> > $this->set('vars', $this->getVars());
> > }
> >
> > Hope this helps...
> >
> > MARTIN
> >
> >
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
You received this 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: Getting started with Ajax

2009-09-28 Thread Bert Van den Brande
Can you show the code where you changed the line ?

I always use
$this->layout = "ajax";
in the controller method when I want to render the ajax layout.


Friendly greetings,
Bert

On Mon, Sep 28, 2009 at 4:22 PM, Jürgen  wrote:

>
> Anyone?
>
> On 24 sep, 20:01, Jürgen  wrote:
> > Hi,
> >
> > I've just been getting started with Ajax and I've been able to set up
> > a simple website using the pagesController that comes with cake. As
> > for now I'm not yet using any databases.
> >
> > Today I started to try integrating some Ajax in my site. It's quite
> > simple: I want to load the pages into the 'content' div without
> > reloading the entire layout. So what I tried was the following: I
> > edited the pagesController by copying the display function and naming
> > it display_ajax(); Then all I changed was in the last line in the
> > render() function I added 'ajax'.
> >
> > Now when I press an ajax link that loads the new display_ajax function
> > it displays in the 'content' div an error message saying that it can't
> > find the $javascript variable in my default.ctp layout file. That's on
> > the line where I load the javascript files ajax needs.
> >
> > Now maybe I don't really understand how cake works yet, but I think
> > this is weird. First off, I thought by setting the 'ajax' value in the
> > render function, the layout shouldn't be loaded at all. And even if it
> > should (apparently so, can someone explain?) then why does it return
> > this error, when it doesn't return any errors if I use the standard
> > display() function. The functions are the same!
> >
> > I hope someone can help me with this! Thanks.
> >
>

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



Need little help with cake image paths

2009-09-28 Thread Ernesto

Hello.

i'm in a multi-app environment and my images could be in app/webroot/
img or shared_items/vendors/img

when i use HtmlHelper i write only the img's name... and then cake
searches for it in every img folder.

is there any way to get the resultant path? i need it in TCPDF's image
method


--~--~-~--~~~---~--~~
You received this 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::setAction heads-up

2009-09-28 Thread brian

OK, I suppose that wasn't very clear. What I was getting at is that,
if calling setAction(), the target action must have either public or
protected access.

On Sun, Sep 27, 2009 at 11:20 PM, Martin Radosta
 wrote:
>
> On 09/27/2009 04:31 PM, brian wrote:
>> The comment for setAction() says that it "Internally redirects one
>> action to another." However, it doesn't really *redirect* so much as
>> simply call the action using call_user_func_array(). It amounts to
>> about the same thing, more or less, but there's something to keep in
>> mind:
>>
>> public function someAction()
>> {
>>       $this->setAction(
>>               'error',
>>               'This error message should display.',
>>               array('foo' =>  'bar')
>>       );
>> }
>>
>> private function error($msg = '', $data = array())
>> {
>>       $this->set(compact('msg', 'data'));
>> }
>>
>> This will display the error view *but* the $viewVars will not be set.
>> In order to make this work, set the access to the called action to
>> protected (or public, obviously), because setAction() is defined in
>> the parent class (Controller). If you absolutely need it to be
>> private, you'll have to override setAction() in your own controller.
>>
> Don't know if I understand "exactly" your problem, but maybe an
> auxiliary function should do the job:
>
> public function someAction() {
>     $this->setVars('varA', 'varB', 'varN');
>     $this->setAction('error');
> }
>
> private function error() {
>     $this->set('vars', $this->getVars());
> }
>
> Hope this helps...
>
> MARTIN
>
>
> >
>

--~--~-~--~~~---~--~~
You received this 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: Getting started with Ajax

2009-09-28 Thread Jürgen

Anyone?

On 24 sep, 20:01, Jürgen  wrote:
> Hi,
>
> I've just been getting started with Ajax and I've been able to set up
> a simple website using the pagesController that comes with cake. As
> for now I'm not yet using any databases.
>
> Today I started to try integrating some Ajax in my site. It's quite
> simple: I want to load the pages into the 'content' div without
> reloading the entire layout. So what I tried was the following: I
> edited the pagesController by copying the display function and naming
> it display_ajax(); Then all I changed was in the last line in the
> render() function I added 'ajax'.
>
> Now when I press an ajax link that loads the new display_ajax function
> it displays in the 'content' div an error message saying that it can't
> find the $javascript variable in my default.ctp layout file. That's on
> the line where I load the javascript files ajax needs.
>
> Now maybe I don't really understand how cake works yet, but I think
> this is weird. First off, I thought by setting the 'ajax' value in the
> render function, the layout shouldn't be loaded at all. And even if it
> should (apparently so, can someone explain?) then why does it return
> this error, when it doesn't return any errors if I use the standard
> display() function. The functions are the same!
>
> I hope someone can help me with this! Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Run a cron Job

2009-09-28 Thread Dave Maharaj :: WidePixels.com

Ok, thanks,

I want the cron to run by its self at a specific time. SoI do not have to do
it myself daily. Can this be done in your approach? New to cron set up.

Will check into the shell approach.

Dave 

-Original Message-
From: Martin Westin [mailto:martin.westin...@gmail.com] 
Sent: September-28-09 9:33 AM
To: CakePHP
Subject: Re: Run a cron Job


The cake shell is prefect for this.
I do cron tasks by creating Cake shell tasks and from there I do a
requestAction if I really need to call an action.

This is what I tell cron:
/ful/path/to/cake/console/cake -app /full/path/to/app shellname >>/dev/ null
2>&1

The last bit (dev/null and that) makes the shell totally silent which is
needed unless you want the cron to terminate unexpectedly. But when testing
yourself you should leave that out so you can see the output.



On Sep 27, 6:27 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Trying to set up an action to run at a specific time. Found a few 
> sites saying replace require CORE_PATH.'cake'.DS.'bootstrap.php';
> in index.php but no longer appears to be there.
>
> Any good places to look where to set this up?
>
> Thanks
>
> Dave


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



Re: Javascript inside a ajax content not work

2009-09-28 Thread Martin Westin

Some (most?) javascript libraries will strip the response of live
javascript. You should configure the ajax call to evaluate the script
instead. Exactly how you do that depends on the library.



On Sep 28, 10:34 am, "marco.rizze...@gmail.com"
 wrote:
> Hi
> I use ajax helper to load the content of a div inside my page.
> In this ajax content I have this:
> codeBlock('var value='.$value.';');        ?>
>
> But when I try to use the javascript variable value I get the error
> that the value doesn't exist.
> In my ajax call I have set eval to true.
> Can someone tell me what is the best practise to use javascript inside
> ajax content?
> Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Run a cron Job

2009-09-28 Thread Martin Westin

The cake shell is prefect for this.
I do cron tasks by creating Cake shell tasks and from there I do a
requestAction if I really need to call an action.

This is what I tell cron:
/ful/path/to/cake/console/cake -app /full/path/to/app shellname >>/dev/
null 2>&1

The last bit (dev/null and that) makes the shell totally silent which
is needed unless you want the cron to terminate unexpectedly. But when
testing yourself you should leave that out so you can see the output.



On Sep 27, 6:27 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Trying to set up an action to run at a specific time. Found a few sites
> saying replace
> require CORE_PATH.'cake'.DS.'bootstrap.php';
> in index.php but no longer appears to be there.
>
> Any good places to look where to set this up?
>
> Thanks
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Self Join query

2009-09-28 Thread Bert Van den Brande
I typed this code out of the top of my head, but it might be worth a try :

$this->User->Behaviors->attach('Containable');
$this->User->bindModel(array(
'hasOne' => array( // Model linking type is 'hasOne', this
forces Cake to make joins
'UserB' => array( // User other name than 'User' to avoid
data arrays being mixed up in the result
'className' => 'User',
'foreignKey' => false, // Force conditions in query as
defined below
'type' => 'LEFT',
'conditions' => array('User.company_id =
UserB.company_id'))
)));
$result = $this->User->find('all', array('conditions' =>
array('User.id' => 2)));


Friendly greetings,
Bert

On Mon, Sep 28, 2009 at 1:43 PM, Bert Van den Brande wrote:

> I would use the Containable behavior here, combined with a custom binding
> that you attach on the fly.
>
> Have no idea however how exactly to expres a self-join binding ... try and
> play around with it :)
>
>
> On Mon, Sep 28, 2009 at 12:04 PM, hunny wrote:
>
>>
>>
>>
>> On Sep 28, 2:19 pm, Aivaras  wrote:
>> > Hey, take a look at this:
>> http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find
>> this
>> > handy.
>> >
>> > On Mon, Sep 28, 2009 at 12:04, hunny 
>> wrote:
>> >
>> > > Hi All,
>> >
>> > > I am new to cakephp. I would like to execute the following SELF Join
>> > > query.
>> >
>> > > SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
>> > > ON A.id = 2 where A.company_id = B.company_id
>> >
>> > > Could some one guide or refer some tutorials, on how to achieve this
>> > > in cake php.
>> >
>> > > Thanks in advance
>> >
>> >
>>
>> Hi All,
>>
>> Bad me, I think should have explained my problem properly.
>>
>> Lets say following are the contents of my users table:
>>
>> id | name | company id
>>
>> 1 | abc | 123
>> 2 | def | 123
>> 3 | ghi | 124
>> 4 | jkl | 123
>>
>> Now what I want is to retrieve, for a member (say 'abc') all the
>> people who are working in the same company.
>>
>> Even though company_id is a foreign key, I am not interested in the
>> data of that table. What you suggested above is how to get the data
>> from the company table.
>>
>> The simple sql query if I want all the members working in same company
>> as id = 2 would be:
>>
>> SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
>> ON A.id = 2 where A.company_id = B.company_id
>>
>> Since this includes JOIN with the table itself, I am not sure how to
>> achieve using Association Type.
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



two way mirrors in trial room

2009-09-28 Thread ashi raheel

This site is specially designed for those people who feel tired while
surfing internet or during work on internet. You can enjoy your time
here. Hope you all like and send your best comments to update site.

http://itstime2enjoy.blogspot.com/2009/08/beware-of-two-way-mirrors-in-trial.html
--~--~-~--~~~---~--~~
You received this 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: slow static multilingual site made with cakephp

2009-09-28 Thread Martin Westin


Loads very fast most of the time but it does load very slowly at other
times. I get results mostly around 0.06-0.1s but a few were all the
way up at 4.5s.

To me that suggests either some problem with disk speed. Are you on
(an overloaded) shared server or is this site all that is running on
the system?

Set debug to 0. Anything else and cach will not work at full capacity.
At debug 1 Cake will re-write the language cache, database schema
cache, paths... every 10s or so. That in combination with an
overloaded or for some other reason slow server could account the the
intermittent slowness.

If the server is under your control in any way I would also check if
it is hacked or someone trying to hack it (bombing the ftp or some
other service with logins). Check the logs. Is the web access log full
of requests to things that do not exist (like windows exploits on a
Linux server)? Is the general logs full of failed logins? Is some
process taking up a lot of cpu when it shouldn't? And so on...

/Martin


On Sep 27, 11:41 am, Number 23  wrote:
> Hello, i made a static website with cakephp, using the
> internazionalization functionality.
>
> preview is at http:\\www.sunchaser.it, login/pwd is emo/emo.
>
> The initial loading is very slow, and i don't understand why, the page
> is very light. Any help please? can it depend because cakephp is
> translating the text?
>
> thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Self Join query

2009-09-28 Thread Bert Van den Brande
I would use the Containable behavior here, combined with a custom binding
that you attach on the fly.

Have no idea however how exactly to expres a self-join binding ... try and
play around with it :)

On Mon, Sep 28, 2009 at 12:04 PM, hunny  wrote:

>
>
>
> On Sep 28, 2:19 pm, Aivaras  wrote:
> > Hey, take a look at this:
> http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find
> this
> > handy.
> >
> > On Mon, Sep 28, 2009 at 12:04, hunny  wrote:
> >
> > > Hi All,
> >
> > > I am new to cakephp. I would like to execute the following SELF Join
> > > query.
> >
> > > SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> > > ON A.id = 2 where A.company_id = B.company_id
> >
> > > Could some one guide or refer some tutorials, on how to achieve this
> > > in cake php.
> >
> > > Thanks in advance
> >
> >
>
> Hi All,
>
> Bad me, I think should have explained my problem properly.
>
> Lets say following are the contents of my users table:
>
> id | name | company id
>
> 1 | abc | 123
> 2 | def | 123
> 3 | ghi | 124
> 4 | jkl | 123
>
> Now what I want is to retrieve, for a member (say 'abc') all the
> people who are working in the same company.
>
> Even though company_id is a foreign key, I am not interested in the
> data of that table. What you suggested above is how to get the data
> from the company table.
>
> The simple sql query if I want all the members working in same company
> as id = 2 would be:
>
> SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> ON A.id = 2 where A.company_id = B.company_id
>
> Since this includes JOIN with the table itself, I am not sure how to
> achieve using Association Type.
>
> >
>

--~--~-~--~~~---~--~~
You received this 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: Doubt in cake php

2009-09-28 Thread John Andersen

It will not be much more fat, as the only thing each function used by
a requestAction should be doing, is to call the model and return the
models data.
Enjoy,
   John

On Sep 28, 12:46 pm, hunny  wrote:
> On Sep 25, 10:27 am, John Andersen  wrote:
>
> > Look into the controllers method "requestAction", which allows you to
> > retrieve the list of clubs in a view!
> > Enjoy,
> >    John
>
> > On Sep 24, 11:59 am, hunny  wrote:
[snip]
> Hi All,
>
> Thanks for your help. I was just reluctant to put the code in the
> controller because it makes your controller fat.
--~--~-~--~~~---~--~~
You received this 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: Self Join query

2009-09-28 Thread hunny



On Sep 28, 2:19 pm, Aivaras  wrote:
> Hey, take a look at 
> this:http://voveris.eu/2009/09/05/left-join-with-cakephp/I am sure you find 
> this
> handy.
>
> On Mon, Sep 28, 2009 at 12:04, hunny  wrote:
>
> > Hi All,
>
> > I am new to cakephp. I would like to execute the following SELF Join
> > query.
>
> > SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> > ON A.id = 2 where A.company_id = B.company_id
>
> > Could some one guide or refer some tutorials, on how to achieve this
> > in cake php.
>
> > Thanks in advance
>
>

Hi All,

Bad me, I think should have explained my problem properly.

Lets say following are the contents of my users table:

id | name | company id

1 | abc | 123
2 | def | 123
3 | ghi | 124
4 | jkl | 123

Now what I want is to retrieve, for a member (say 'abc') all the
people who are working in the same company.

Even though company_id is a foreign key, I am not interested in the
data of that table. What you suggested above is how to get the data
from the company table.

The simple sql query if I want all the members working in same company
as id = 2 would be:

SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
ON A.id = 2 where A.company_id = B.company_id

Since this includes JOIN with the table itself, I am not sure how to
achieve using Association Type.

--~--~-~--~~~---~--~~
You received this 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: Doubt in cake php

2009-09-28 Thread hunny



On Sep 25, 10:27 am, John Andersen  wrote:
> Look into the controllers method "requestAction", which allows you to
> retrieve the list of clubs in a view!
> Enjoy,
>    John
>
> On Sep 24, 11:59 am, hunny  wrote:
>
> > Hi Guys,
>
> > I am new to cakephp. I am having the following issue:
>
> > I am displaying list of checkbox containing clubs to a login user. The
> > list of clubs I am passing through the models via controllers in the
> > traditional way.
>
> > Now the logged in user should see his list of clubs automatically
> > ticked. This list is present in another database.
>
> > One solution is to get the list of user clubs in the controller itself
> > and pass it to the view.
>
> > But is there any alternative way, where I can access the user clubs in
> > the view itself without loading in the controller.
>
> > Basically i am looking for something similar like View Helpers in
> > Zend. We can access the model data in views using view Helpers. Is
> > there something similar in cakephp.
>
> > P.S: I have asked this question to a few people who knew cake php and
> > their first reaction is that you shouldn't access model data in views
> > as it is against MVC. But let me assure you we can access model data
> > in view as long as it is read only. At least that is what we are used
> > to follow in Zend Framework. :)
>
>
Hi All,

Thanks for your help. I was just reluctant to put the code in the
controller because it makes your controller fat.

--~--~-~--~~~---~--~~
You received this 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: Self Join query

2009-09-28 Thread Aivaras
Hey, take a look at this:
http://voveris.eu/2009/09/05/left-join-with-cakephp/ I am sure you find this
handy.


On Mon, Sep 28, 2009 at 12:04, hunny  wrote:

>
> Hi All,
>
> I am new to cakephp. I would like to execute the following SELF Join
> query.
>
> SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
> ON A.id = 2 where A.company_id = B.company_id
>
> Could some one guide or refer some tutorials, on how to achieve this
> in cake php.
>
> Thanks in advance
>
> >
>

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



Self Join query

2009-09-28 Thread hunny

Hi All,

I am new to cakephp. I would like to execute the following SELF Join
query.

SELECT B.* FROM `users` AS A LEFT JOIN `users` AS B
ON A.id = 2 where A.company_id = B.company_id

Could some one guide or refer some tutorials, on how to achieve this
in cake php.

Thanks in advance

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



Javascript inside a ajax content not work

2009-09-28 Thread marco.rizze...@gmail.com

Hi
I use ajax helper to load the content of a div inside my page.
In this ajax content I have this:
codeBlock('var value='.$value.';');   ?>

But when I try to use the javascript variable value I get the error
that the value doesn't exist.
In my ajax call I have set eval to true.
Can someone tell me what is the best practise to use javascript inside
ajax content?
Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: slow static multilingual site made with cakephp

2009-09-28 Thread DIV

> Hello, i made a static website with cakephp, using the
> internazionalization functionality.
Are you using .po files or the i18n database table? Or both?

> preview is at http:\\www.sunchaser.it, login/pwd is emo/emo.
>
> The initial loading is very slow, and i don't understand why, the page
> is very light. Any help please? can it depend because cakephp is
> translating the text?
Loaded just fine for me. Could be that on your initial loading the .po
cache (in app/tmp/cache/persistent) needs to be created first.

--~--~-~--~~~---~--~~
You received this 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: Translate field names

2009-09-28 Thread emmexx



On 25 Set, 12:47, "rich...@home"  wrote:
> No, you only want to translate the label, not the field name :
>
> echo $form->input("field_name", array("label"=>__("field_name")));

Ok, thank you, not a recipe as simple as I imagined but easy enough to
do it by hand.

bye
   maxx
--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---



Empty records in database (even with validation and ACL in place)

2009-09-28 Thread Jeroen

Hi all,

I've run into the strangest problem, and have no idea where to start
looking: I've got an community platform website, where members
(sometimes only admins) can post content. Somehow, about once a day on
different times and without other content being posted at the same
time, empty records appear in my database. As far as I know, this
shouldn't be possible:

- all models have pretty tight validation rules that should prevent
this kind of behaviour
- all add/edit methods are protected by ACL, so only users can add/
edit. Some of them are even admin-only accessible
- every save action fills the user_id field just before saving, but
the user_id for the empty records is 0 (zero)

Since the user_id isn't saved, I guess creation of the new record
doesn't happen through the add/edit methods in the controller. That
might also explain why validation rules are ignored.

As I said, don't know where to start looking. This must be triggered
by some kind of user action, but how, why and where is a huge problem
to find out. Anyone?

Jeroen
--~--~-~--~~~---~--~~
You received this 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
-~--~~~~--~~--~--~---