Tuesday, March 31, 2009

Re: HELP, Controller displaying multiple duplicate rows

Could you please provide the whole modified SQL statement?

It looks like you are trying to left join the statuses table twice!
Enjoy,
John

On Apr 1, 6:18 am, Louie Miranda <lmira...@gmail.com> wrote:
> Hello,
>
> I think there is a problem on my parameter on the controller. Because once
> my other tables has multiple entries, the data on the row is duplicated for
> my main controller.
>
> See my code and parameter and the SQL query cakephp produces.http://bin.cakephp.org/saved/44445
>
> The default for cakephp
>
>    1. *$this->set('pdffiles', $this->paginate());*
>    2.
>    3. ON (`Pdffile`.`statuses_id` = `Statuses`.`id`) LEFT
> JOIN<http://www.php.net/join>`users`
>    AS `User`
>    4. --- ON (`Pdffile`.`user_id` = `User`.`id`) LEFT
> JOIN<http://www.php.net/join>`comments`
>    AS `Comment`
>    5. ON (`Comment`.`pdffile_id` = `Pdffile`.`id`) LEFT
> JOIN<http://www.php.net/join>`statuses`
>    AS `Status`
>    6. *ON (`Status`.`pdffile_id` = `Pdffile`.`id`) WHERE 1 = 1 LIMIT 20*
>
> The modified, under controller
>
>    1. $this->Pdffile->recursive = 0;
>    2. *$parsedConditions['Pdffile.user_id'] = $this->Auth->User('id');*
>    3. $this->paginate['Pdffile'] = array <http://www.php.net/array>(
>    'conditions' => $parsedConditions, 'limit' => '50', 'order' =>
> array<http://www.php.net/array>
>    ('Pdffile.timestamp' => 'desc'));
>    4. $this->set('pdffiles', $this->paginate());
>    5.
>    6. ON (`Pdffile`.`statuses_id` = `Statuses`.`id`) LEFT
> JOIN<http://www.php.net/join>`users`
>    AS `User`
>    7. --- ON (`Pdffile`.`user_id` = `User`.`id`) LEFT
> JOIN<http://www.php.net/join>`comments`
>    AS `Comment`
>    8. ON (`Comment`.`pdffile_id` = `Pdffile`.`id`) LEFT
> JOIN<http://www.php.net/join>`statuses`
>    AS `Status`
>    9. ON (`Status`.`pdffile_id` = `Pdffile`.`id`) WHERE `Pdffile`.`user_id`
>    = 17
>    10. ORDER BY `Pdffile`.`timestamp` desc LIMIT 50
>
> Missing where 1 = 1?
>
> How could this be fixed?
> --
> Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
>
> Quality Web Hosting -www.axishift.com
> Pinoy Web Hosting, Web Hosting Philippines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

RewriteEngine not allowed here - 500 Internal Server Error

/htdocs/cake/.htaccess: RewriteEngine not allowed here

this is resulting in a 500 Internal Server error, I have checked for
the existence the proper content of all .htaccess files, and have
setup the 'AllowOverride All' and the Load Module for mod_rewrite are
all setup properly, and I even tried adding 'RewriteBase /' to
the .htaccess files

What else could be wrong?

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

HELP, Controller displaying multiple duplicate rows

Hello,

I think there is a problem on my parameter on the controller. Because once my other tables has multiple entries, the data on the row is duplicated for my main controller.

See my code and parameter and the SQL query cakephp produces.
http://bin.cakephp.org/saved/44445

The default for cakephp
  1. $this->set('pdffiles', $this->paginate());
  2.        
  3. ON (`Pdffile`.`statuses_id` = `Statuses`.`id`) LEFT JOIN `users` AS `User`
  4. --- ON (`Pdffile`.`user_id` = `User`.`id`) LEFT JOIN `comments` AS `Comment`
  5. ON (`Comment`.`pdffile_id` = `Pdffile`.`id`) LEFT JOIN `statuses` AS `Status`
  6. ON (`Status`.`pdffile_id` = `Pdffile`.`id`) WHERE 1 = 1 LIMIT 20
The modified, under controller
  1. $this->Pdffile->recursive = 0;
  2. $parsedConditions['Pdffile.user_id'] = $this->Auth->User('id');
  3. $this->paginate['Pdffile'] = array('conditions' => $parsedConditions, 'limit' => '50', 'order' => array('Pdffile.timestamp' => 'desc'));
  4. $this->set('pdffiles', $this->paginate());
  5.  
  6. ON (`Pdffile`.`statuses_id` = `Statuses`.`id`) LEFT JOIN `users` AS `User`
  7. --- ON (`Pdffile`.`user_id` = `User`.`id`) LEFT JOIN `comments` AS `Comment`
  8. ON (`Comment`.`pdffile_id` = `Pdffile`.`id`) LEFT JOIN `statuses` AS `Status`
  9. ON (`Status`.`pdffile_id` = `Pdffile`.`id`) WHERE `Pdffile`.`user_id` = 17
  10. ORDER BY `Pdffile`.`timestamp` desc LIMIT 50
Missing where 1 = 1?

How could this be fixed?
--
Louie Miranda (lmiranda@gmail.com)
http://www.louiemiranda.net

Quality Web Hosting - www.axishift.com
Pinoy Web Hosting, Web Hosting Philippines

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

Re: login problem

Sorry for the noise. It was indeed this line:

$this->Auth->authorize = 'actions';

I thought that because there is no ACO for PagesController there
wouldn't be a problem. In any case, this isn't what I want to do,
after all.

Back to the drawing board ...

On Tue, Mar 31, 2009 at 10:14 PM, brian <bally.zijn@gmail.com> wrote:
> The problem is simply that I can't log in. I've done this before but
> I'm trying to build an ACL-controlled site and following along with
> the manual's example app. WHen I try loggin in I get "You are not
> authorized to access that location." I suspect the problem might be
> with the redirect, and not my credentials, as I'm not seeing Auth's
> loginError.
>
> AppController:
>
> function beforeFilter()
> {
>        $this->Auth->fields = array('username' => 'email', 'password' => 'password');
>        $this->Auth->userScope = array( 'User.enabled' => 1);
>        $this->Auth->loginError = 'No matching user found.';
>        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
>        $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
> => 'display', 'home');
>        $this->Auth->logoutRedirect = array('controller' => 'users', 'action'
> => 'login');
>        $this->Auth->authorize = 'actions';
>        $this->Auth->actionPath = 'ROOT/';
> }
>
> UsersController:
>
> function beforeFilter()
> {
>        parent::beforeFilter();
>        if ($this->action == 'login') $this->layout = 'login';
>        $this->Auth->allowedActions = array('reset_password');
> }
>
> public function login() {}
>
> public function logout()
> {
>        $this->Session->setFlash('Good-Bye');
>        $this->redirect($this->Auth->logout());
> }
>
> As you can see, it's not much different than the manual. The
> beforeFilter layout switch is there because none of the pages for this
> site should be public (it's an extranet).
>
> The password is good, and my user is enabled.
>
> I have nothing in my acos table yet, so I think that shouldn't be the
> cause of this. AFAICT, if PagesController::display() is not in acos,
> there shouldn't be any problem. Correct me if I'm wrong, please.
>
> Can anyone see something missing? Or think of something else I can check?
>

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

login problem

The problem is simply that I can't log in. I've done this before but
I'm trying to build an ACL-controlled site and following along with
the manual's example app. WHen I try loggin in I get "You are not
authorized to access that location." I suspect the problem might be
with the redirect, and not my credentials, as I'm not seeing Auth's
loginError.

AppController:

function beforeFilter()
{
$this->Auth->fields = array('username' => 'email', 'password' => 'password');
$this->Auth->userScope = array( 'User.enabled' => 1);
$this->Auth->loginError = 'No matching user found.';
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'pages', 'action'
=> 'display', 'home');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action'
=> 'login');
$this->Auth->authorize = 'actions';
$this->Auth->actionPath = 'ROOT/';
}

UsersController:

function beforeFilter()
{
parent::beforeFilter();
if ($this->action == 'login') $this->layout = 'login';
$this->Auth->allowedActions = array('reset_password');
}

public function login() {}

public function logout()
{
$this->Session->setFlash('Good-Bye');
$this->redirect($this->Auth->logout());
}

As you can see, it's not much different than the manual. The
beforeFilter layout switch is there because none of the pages for this
site should be public (it's an extranet).

The password is good, and my user is enabled.

I have nothing in my acos table yet, so I think that shouldn't be the
cause of this. AFAICT, if PagesController::display() is not in acos,
there shouldn't be any problem. Correct me if I'm wrong, please.

Can anyone see something missing? Or think of something else I can check?

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

Re: Notice (8): Undefined index: id?

It happens when Saving a Model!

I've no beforeX-Filters, I also had debug($this-data) right before
saving,
but each Model (Accept the hasAndbelongToMany) have an id!

thx
Aurelius

On 31 Mrz., 02:32, mscdex <msc...@gmail.com> wrote:
> On Mar 30, 6:11 pm, Marcelo Andrade <mfandr...@gmail.com> wrote:
>
>
>
> > On Mon, Mar 30, 2009 at 6:44 PM, Aurelius <aurel...@temporaryinbox.com> wrote:
>
> > > What does that mean, and where is the problem?
> > > Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
> > > 1281...on line 77
>
> > > That's line 77:
> > > if ($this->User->save ( $this->data, true , array ( 'firstname',
> > > 'lastname', '....' ))) {
> > > ... }
>
> > > What's wrong?
>
> > It's hard to say.  Maybe you're in an edit action and
> > your $this->data doesn't contain the desired record id.
>
> > Please, tell us more about your scenario.
>
> > Best regards.
>
> > --
> > MARCELO DE F. ANDRADE
> > Belem, PA, Amazonia, Brazil
> > Linux User #221105
>
> >http://mfandrade.wordpress.com
>
> Also, do you have any beforeValidate or beforeSave callbacks that are
> changing the data?
> Sounds like the data for your primary key for your User model is being
> unset somewhere possibly.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: form select/javascript

You can do this:

echo $form->input('Model.year', array('onclick'=>'someAction();',
'label'=>'','style'=>"width: 60px", 'minYear' => '1983', 'maxYear' =>
date('Y')));

kurious oranj wrote:
>
>
> Hi,
>
> I'm quite new to CakePHP and need to have a SELECT with options for
> each year from 1983 to the current year. I can certainly write the
> javascript to do the loop from 1983 to current year, but what's the
> best way to call that javascript to populate the SELECT? I just need
> the general mechanism.
>
> Thanks
>
> >
>
>

--
View this message in context: http://www.nabble.com/form-select-javascript-tp22808833p22817340.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: form select/javascript

 echo $form->input('Model.field', array('onclick'=>'someAction()', 'label'=>'', 'minYear' => '1910', 'maxYear' => '2010'));

2009/3/31 mscdex <mscdex@gmail.com>

On Mar 31, 12:18 pm, Kalt <pierre.fring...@gmail.com> wrote:
> echo $form->dateTime(
>         'fieldname',
>         'DMY',
>         'NONE',
>         null,
>         array(
>                 'minYear' => 1983,
>                 'maxYear' => date('Y')
>         ),
>         false
> )

You can also do:

echo $form->year('Model.fieldname', 1983, date("Y"), null, array(),
false);




--
Juan Carlos Michaca Lucero
PAASEL
Consultoría en Matemáticas Aplicadas
Insurgentes Sur 1700 Despacho 102
Col. Florida C.P, 01030
Deleg. Alvaro Obregón, México D.F.
Tel. + 52 (55) 5663 4175
http://www.paasel.com
juan.michaca@paasel.com

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

Re: Router pass email

I guess the .de looks like an extension. Why it would strip it from
your route is another question.

You could avoid this altogether (depending on your situation) by
POSTing the email address to your action. If this link is
auto-generated and included in a newsletter email, I guess that'd be
out of the question. Unless you provided a generic link and had the
user submit their email from a form.

On Tue, Mar 31, 2009 at 1:28 PM, hasentopf
<mathias.koelling@googlemail.com> wrote:
>
> Hi again.
>
> In my routes.php I also got:       Router::parseExtensions('rss');
>
> This entry is necessary for creating a RSS feed with the RssHelper.
>
> When the Router::parseExtensions('rss'); comes before Router::connect
> ('/newsletter/unsubscribe/:email', array('controller'
> => 'newsletterReceivers', 'action' => 'unsubscribe'), array('pass' =>
> array('email')));  the email parameter is passed correctly.
>
> Can anyone explain this?
>
> Best
> >
>

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

Re: auto submit sitemap to Google

Google provides for creating and sending them a sitemap:

http://www.google.com/support/webmasters/bin/answer.py?answer=40318&hl=en

On Tue, Mar 31, 2009 at 12:13 PM, Kalt <pierre.fringant@gmail.com> wrote:
>
> I'm not 100% sure of that but if your robots.txt have the following
> line :
> Sitemap: <sitemap_location>
> search engines will crawl your sitemap automatically.
>
> On 31 mar, 17:54, koala kid <alexhob...@gmail.com> wrote:
>> Hi,
>>
>> I am working on a site for a client using cakePHP. I found a great
>> article in the bakery that outputs the sitemap in the correct XML
>> format and is accessible via the browser.  I want to automate the
>> submission of this using a cron job. Does anyone have an example
>> script that would call the xml file and send it to the http address
>> that Google provides specifically for this?
>>
>> 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Why is validation called twice?

For now I had to manipulate the sessions to make sure the first value
is used and not over written.

/**
* Validate recaptcha
* @param array $data
* @return boolean
*/
function recaptcha($data) {
App::import('Vendor', 'recaptcha', array('file' => 'recaptcha.php'));
App::import('Component', 'Session');

$Session = new SessionComponent();
$private = Configure::read('Settings.captcha_private');
$public = Configure::read('Settings.captcha_public');

$verify = recaptcha_check_answer($private, env('REMOTE_ADDR'), $this-
>data[$this->name]['recaptcha_challenge'], $this->data[$this->name]
['recaptcha']);

if ($Session->read('Recaptcha.time') == time()) {
$response = $Session->read('Recaptcha.response');
} else {
$response = ($verify->is_valid) ? 'pass' : 'fail';
$Session->write('Recaptcha.response', $response);
$Session->write('Recaptcha.time', time());
}

return ($response == 'pass') ? true : 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Why is validation called twice?

Well thats not the problem, I simply had more rules and in the example
I am only showing one.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Why is validation called twice?

Well, you have too many 'recaptcha'-s:

'recaptcha' => array(
'recaptcha' => array(
'rule' => array('recaptcha'),
'message' => 'captchaFailed'
)
)

Just try to name those differently and try again, for example:

'myrecaptcha' => array(
'recaptcha2' => array(
'rule' => array('recaptcha'),
'message' => 'captchaFailed'
)
)

Hope this helps.

On Mar 31, 11:43 pm, Miles J <mileswjohn...@gmail.com> wrote:
> Thats my last resort type of deal. Just wondering why its called twice?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: media view and files on the fly

are you sure it is app_media.php then?
i only got it to work by leaving it the same name "media.php" in /app/
views/

mark

On 31 Mrz., 21:45, "Mark (Germany)" <dereurom...@googlemail.com>
wrote:
> nice :)
> thx
>
> On 31 Mrz., 15:17, Matt Curry <m...@mcurry.net> wrote:
>
> > I had to do this with pdf/xls files returned by a webservice.  I took
> > the default media view (/cake/libs/views/media.php) and copied it to /
> > app/views/app_media.php.
>
> > Then I modified it so that it checked for a $content view var and
> > wrote that to a tmpfile.
> > Here's the diff:http://bin.cakephp.org/view/1310700342
>
> > -Matthttp://www.pseudocoder.com
>
> > On Mar 30, 1:05 pm, "Mark (Germany)" <dereurom...@googlemail.com>
> > wrote:
>
> > > i tried to use the media view for files generated on thefly(some
> > > exported text inside a export.txt or whatever)
> > > but it seems like the media view can only handle downloads of
> > > "existing" files on the server
>
> > > trying to rewrite it did not turn out very well
> > > so, did anyone manage to create a txt file to download, that is filled
> > > with the echoed content
>
> > > echo 'blabla'
> > > or
> > > $content = 'blabla' transfered to the media view
>
> > > without creating locale (temp.) files on the server?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Why is validation called twice?

Thats my last resort type of deal. Just wondering why its called twice?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: DebugKit's toolbar not working

After reading your posts I could see that the css and toolbar were
loading. I tried installing a it on a fresh cakephp app, to ensure it
wasnt a CSS clash, and notices that cakephp had no styling...

Then I realised that this issue boiled down to mod_rewrite not being
on!

Thanks for the replies, and thanks for an awesome plugin Mark.

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

Re: media view and files on the fly

nice :)
thx

On 31 Mrz., 15:17, Matt Curry <m...@mcurry.net> wrote:
> I had to do this with pdf/xls files returned by a webservice.  I took
> the default media view (/cake/libs/views/media.php) and copied it to /
> app/views/app_media.php.
>
> Then I modified it so that it checked for a $content view var and
> wrote that to a tmpfile.
> Here's the diff:http://bin.cakephp.org/view/1310700342
>
> -Matthttp://www.pseudocoder.com
>
> On Mar 30, 1:05 pm, "Mark (Germany)" <dereurom...@googlemail.com>
> wrote:
>
> > i tried to use the media view for files generated on the fly (some
> > exported text inside a export.txt or whatever)
> > but it seems like the media view can only handle downloads of
> > "existing" files on the server
>
> > trying to rewrite it did not turn out very well
> > so, did anyone manage to create a txt file to download, that is filled
> > with the echoed content
>
> > echo 'blabla'
> > or
> > $content = 'blabla' transfered to the media view
>
> > without creating locale (temp.) files on the server?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: form select/javascript

On Mar 31, 12:18 pm, Kalt <pierre.fring...@gmail.com> wrote:
> echo $form->dateTime(
>         'fieldname',
>         'DMY',
>         'NONE',
>         null,
>         array(
>                 'minYear' => 1983,
>                 'maxYear' => date('Y')
>         ),
>         false
> )

You can also do:

echo $form->year('Model.fieldname', 1983, date("Y"), null, array(),
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Setting Layout for Scaffolding?

Thanks Amit but unfortunately that walkthrough helps for modifying the
HTML that the scaffolding functionality uses -- but it does not
address the layout. The layout remains "default".

I also tried setting [ $this->layout = "XXXX" ] in those view / .ctp
files and no change.

I also tried [ $this->layout = "XXXX" ] in _beforeScaffold() -- no
change.

What I find bizarre is that it seems that not many others need this
functionality?
public frontend = layout1
private backend = layout2

Does everyone use the same layout for the scaffolding?

On Mar 30, 6:11 pm, Amit <a...@amitvaria.com> wrote:
> Here's a good walkthrough:http://teknoid.wordpress.com/2009/01/31/take-control-over-your-bake-a...
>
> On Mar 30, 5:05 pm, Amit <a...@amitvaria.com> wrote:
>
> > I think you're referring to cake/libs/views/scaffold/(add|edit|
> > view.ctp). These will let you alter the way scaffolding looks
>
> > On Mar 30, 2:42 am, bbf <builtbyf...@gmail.com> wrote:
>
> > > I've searched the groups and Google and can't find an answer for this.
>
> > > How do I set a different layout for the scaffolding?
>
> > > Thanks for your 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: looking for a method to record 'page views'

Another thing to consider (especially if it's a busy site) is to not
track the views in real time. Instead scan your webserver logs hourly/
daily and update the counts that way. This allows you to cache the
pages and still keep track of visits.

-Matt
http://www.pseudocoder.com

On Mar 30, 11:14 am, JamesF <usaexportexpe...@gmail.com> wrote:
> Hi all,
>
> I am looking for a simple way of keeping track of page views. The
> application is a rental properties website and I would like
> advertisers who list their properties to know how many times they have
> been viewed.
>
> Anyone have a tried and true method for 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: looking for a method to record 'page views'

Have you considered using an existing solution with metrics and
reporting surrounding it? You can give read only access to clients as
well.

http://edwardawebb.com/programming/php-programming/cakephp/piwik-analyze-visits-cakephp-site

On Mar 30, 1:39 pm, JamesF <usaexportexpe...@gmail.com> wrote:
> i did see that article but i think im goign to go with a different
> approach...
>
> i'm making a table called visits with four fields
>
> id ->auto increment
> listing_id ->related listing id
> timestamp ->now()
> ip_address ->users ip
>
> basically whenever a listing is view i will execute an insert on the
> database logging the information. when i display the stats i will run
> queries off the table.
> i have a feeling this isn't going to be very MVC compliant but bottom
> line is i need to get it working. i have a few concerns about database
> performance but i think it will be better to do it this way than a log
> file/cron job method.
>
> On Mar 30, 12:21 pm, brian <bally.z...@gmail.com> wrote:
>
> > Have a look at this HitCountBehaviorhttp://dsi.vozibrale.com/articles/view/simple-hitcount-behavior-for-c...
>
> > I haven't used this, though it's been on my list of things to investigate.
>
> > On Mon, Mar 30, 2009 at 11:14 AM, JamesF <usaexportexpe...@gmail.com> wrote:
>
> > > Hi all,
>
> > > I am looking for a simple way of keeping track of page views. The
> > > application is a rental properties website and I would like
> > > advertisers who list their properties to know how many times they have
> > > been viewed.
>
> > > Anyone have a tried and true method for 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Does anybody know how can I limit the join table fields when I user joins condition?

I highly recommend checking out the Containable behavior:

http://book.cakephp.org/view/474/Containable

It will simplify this code and let you easily add fields.

On Mar 31, 8:28 am, joshua <josh...@gmail.com> wrote:
> For example:
> One task has many users.
> ########################
>         $condition = array();
>         $condition['joins'] = array(
>             array(
>                 'table' => 'users',
>                 'alias' => 'User',
>                 'type' => 'inner',
>                 'foreignKey' => 'user_id',
>                 'conditions'=> array('User.id =
> Task.user_id','User.deleted=0')
>         ));
> ########################
> I just want to find the user name , not all the fields in User table. I try
> to add the 'fields' property in this array, but it seems not.
> --
> Thanks
> Joshua
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Double left join?

Take a look at the Containable behavior. You should able to something
as simple as:

http://book.cakephp.org/view/474/Containable

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

Re: Multiple hasMany relationships to one model?

Brian - that'd be a good option if an image can belong to many movies
and many episodes.

Adam - is that the case? Or can an image only belong to either 1 movie
or 1 episode? From the description you put up it sounds like hasMany
is the right association, it's just making a good db design underneath
it.

On Mar 31, 9:39 am, brian <bally.z...@gmail.com> wrote:
> I'd go HABTM for this, I think.
>
> movies
> videos
> images
> images_movies
> images_videos
>
>
>
> On Tue, Mar 31, 2009 at 2:09 AM, Adam M <adam.mcnam...@gmail.com> wrote:
>
> > Hi All,
>
> > How can I PROPERLY set up my database so that several models have
> > multiple images?  Each image belongs to a particular model, so they
> > are definitely hasMany relationships.  Example:
>
> > Episode
> > -id
> > -name
> > -date
>
> > Movie
> > -id
> > -name
> > -date
> > -producer
>
> > Image
> > -id
> > -name
> > -caption
> > -path
>
> > Episode hasMany Image
> > Movie hasMany Image
>
> > Does the paradigm of adding a foreign key to the Image table still
> > apply if I have multiple hasMany relationships?  That is, would I add
> > multiple foreign keys to the table as follows?:
> > Image
> > -id
> > -movie_id
> > -episode_id
> > -name
> > -caption
> > -path
>
> > 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Webroot problem when accessing cake app through service provider's SSL

I can get the system to work with a VERY ugly fix:

In layout if i replace these:

echo $html->css('cake.generic'); => echo preg_replace( "/ssl/",
"thesite.com", $html->css('cake.generic') );
echo $content_for_layout; => echo preg_replace( "/ssl/",
"thesite.com", $content_for_layout );
etc.

But I really don't like doing it like this. If anyone has a better
suggestion please tell me!

On Mar 31, 12:37 pm, karma <karma....@gmail.com> wrote:
> Thanks for your help!
>
> I still can't get it to work however. I tried any possible settings in
> the .htaccess.
>
> The problem is that cake defines the webroot directory in views as "/
> ssl/application_name/" when it shoud be because of the SSL "/
> thesite.com/application_name/".
>
> Because that directory is set wrong all includes (css, javascript) and
> form actions point to that wrong directory. Where does cake get this
> directory? It can be echoed in a view (echo $this->webroot). Is there
> some setting where I can change this value?
>
> On Mar 30, 3:45 pm, Martin Westin <martin.westin...@gmail.com> wrote:
>
> > Just guessing but try this:
>
> >http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess
>
> > The last part about setups that have already been "rewritten". Your
> > provider might be using mod_rewrite for it's ssl urls and then Cake's
> > rewriting will not work as expected.
>
> > /Martin
>
> > On Mar 29, 8:02 pm, karma <karma....@gmail.com> wrote:
>
> > > Hi!
>
> > > I have a problem getting cakephp to set correct webroot directory.
> > > I've the webroot installed in "/ssl/application_name
> > > /webroot" folder at the service providers server. The application
> > > works perfectly when I access it through
> > > "www.thesite.com/ssl/application_name".
>
> > > BUT
>
> > > The service provider offers SSL-encryption through this centered
> > > service, where the site is accessed through address "https://
> > > ssl.serviceprovider.com/thesite.com/application_name/". This messes
> > > the application up cause the webroot is not set correctly. I tried to
> > > change WWW_ROOT constant but it doesn't help. If I echo $this->webroot
> > > in a view it says "/ssl/application_name/". I need to get this
> > > application to work through this centered SSL.
>
> > > So, how could I get the application work correctly in this kind of a
> > > setup? I'm in quite a hurry to get this to work so any help is
> > > appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Webroot problem when accessing cake app through service provider's SSL

Thanks for your help!

I still can't get it to work however. I tried any possible settings in
the .htaccess.

The problem is that cake defines the webroot directory in views as "/
ssl/application_name/" when it shoud be because of the SSL "/
thesite.com/application_name/".

Because that directory is set wrong all includes (css, javascript) and
form actions point to that wrong directory. Where does cake get this
directory? It can be echoed in a view (echo $this->webroot). Is there
some setting where I can change this value?

On Mar 30, 3:45 pm, Martin Westin <martin.westin...@gmail.com> wrote:
> Just guessing but try this:
>
> http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess
>
> The last part about setups that have already been "rewritten". Your
> provider might be using mod_rewrite for it's ssl urls and then Cake's
> rewriting will not work as expected.
>
> /Martin
>
> On Mar 29, 8:02 pm, karma <karma....@gmail.com> wrote:
>
> > Hi!
>
> > I have a problem getting cakephp to set correct webroot directory.
> > I've the webroot installed in "/ssl/application_name
> > /webroot" folder at the service providers server. The application
> > works perfectly when I access it through
> > "www.thesite.com/ssl/application_name".
>
> > BUT
>
> > The service provider offers SSL-encryption through this centered
> > service, where the site is accessed through address "https://
> > ssl.serviceprovider.com/thesite.com/application_name/". This messes
> > the application up cause the webroot is not set correctly. I tried to
> > change WWW_ROOT constant but it doesn't help. If I echo $this->webroot
> > in a view it says "/ssl/application_name/". I need to get this
> > application to work through this centered SSL.
>
> > So, how could I get the application work correctly in this kind of a
> > setup? I'm in quite a hurry to get this to work so any help is
> > appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

I need to compare how I work to how you work

Hi!

Once, I created a topic here, asking for help, then I got one reply.
Unfortunately, it was not enough help to solve the problem. I kept
posting my progress, waiting for a reply and I must have posted three
times, but I waited days to get one reply again. Fortunately, It was
enough help to solve the problem.

I am afraid of waiting. Regarding waiting...

Before waiting: how much do you google? While you are waiting: do you
keep trying to solve the problem yourself? or other problems in your
project? or other people's problems (in message boards, in chat rooms
etc)? how often do you check your inbox for a reply? After waiting: do
you work around? or delay? or quit?

How dependent / independent are you? How I can I be more like you???

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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Hosting Migration Problem - The requested address was not found on this server

Hi Martin,

Thanks for your offer, email on it's way to you.

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

Re: How to silently redirects to login page ?

Since you only mentioned a problem on the "index page" I did not go
into anything more complicated.

You can either remove it from the session before displaying the login
screen. Then it will pop up anywhere else.

Alternatively you can make an if-clause:
if ( $this->Auth->user() ) {
// user is logged in show error message if needed
$this->Auth->authError = 'Hey, be nice, only admins can do that';
} else {
// no user logged in, show nice message
$this->Auth->authError = 'Hi, and welcome. Please login before
proceeding.';
}

... or something similar.


On Mar 30, 9:28 pm, iFeghali <igor.fegh...@gmail.com> wrote:
> Hi Martin,
>
> Yes I am talking exactly about that message. Changing it the way you
> suggest would make it very weird to users already logged in that are
> trying to access resources they are not allowed to. Also, I would like
> to have no message at all... just the login form.
>
> Thank you.
>
> On 30 mar, 15:28, Martin Westin <martin.westin...@gmail.com> wrote:
>
> > That would be the authError message you are seeing.
>
> > You can set it (from AppController::beforeFilter for example) like
> > this:
>
> > $this->Auth->authError = 'Hi, and welcome. Please login before
> > proceeding.';
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: How to silently redirects to login page ?

$this->Auth->authError = null?

But in my opinion its a real bad idea to redirect an already logged in
(!) user to a login again. That will look to the user like the app is
acting wrong and is confusing. If hes logged in but not allowed to
access a certain area he should get a notice that can't be overlooked
displayed telling him "Sorry, you dont have permissions to access this
area!".

I would do a check if the user is logged in, change the AuthError
message in this case and redirect him back to the page from where he
came.

On Mar 30, 9:28 pm, iFeghali <igor.fegh...@gmail.com> wrote:
> Hi Martin,
>
> Yes I am talking exactly about that message. Changing it the way you
> suggest would make it very weird to users already logged in that are
> trying to access resources they are not allowed to. Also, I would like
> to have no message at all... just the login form.
>
> Thank you.
>
> On 30 mar, 15:28, Martin Westin <martin.westin...@gmail.com> wrote:
>
>
>
> > That would be the authError message you are seeing.
>
> > You can set it (from AppController::beforeFilter for example) like
> > this:
>
> > $this->Auth->authError = 'Hi, and welcome. Please login before
> > proceeding.';
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Hosting Migration Problem - The requested address was not found on this server

Since "php_value" was causing the 500, perhaps you should try
"restoring" the .htaccess files to the ones from the "old" server (but
without the php_value naturally).

The 1.1 files have to be downloaded from the svn repository afaik.
https://trac.cakephp.org/browser/branches/1.1.x.x
You can "open" each .htaccess file and choose "download.." ( centered
at the bottom of the while space) or download the whole thing as an
archive.

If the standard files don't work could you perhaps detail the folder
structure you have on the server now? Which folder is the apache
document root (aka public_html) and where all the Cake-related folders
are in relation to that.

The "standard" production deploy is to have the document root point to
webroot. On shared hosts this will usually be a bit tricky and involve
rearranging the folder a bit and making configurations to match.

Folder structure can be seen at (half way down)
http://book.cakephp.org/view/308/Installing-CakePHP


Or, if you are in a trusting mood, send me some login-info in an email
and I'll have a quick look. I have installed 1.1 apps on a number of
servers so I might see the problem immediately and know the magic
trick. I am a pretty trustworthy guy... as long as I get my cup of
coffee ;)

/Martin


On Mar 31, 10:04 am, jmdesign <webmas...@jmdesignsolutions.com> wrote:
> Hi Jon,
>
> Okay I'll try downloading the 1.1 htaccess files, stupid question but
> where do I get them from? I can only see the 1.2 download links on the
> main Cake site?
>
> The only log files I've got access to are the standard erorr logs
> which aren't picking up anything now.
>
> Thanks,
>
> James
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Where to DL RC2?

https://svn.cakephp.org/repo/tags

On Mar 31, 8:55 am, rocket <justin...@gmail.com> wrote:
> I can't find the link to download Cake 1.2 RC2. I'm trying to run a
> site that was built on RC2 that doesn't work with the current release.
> Can anyone direct me?
>
> thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Hosting Migration Problem - The requested address was not found on this server

Okay I've found a version of 1.1.12 and copied across the htaccess
files from that but it's still reading a 404 error.

Thanks,

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

Re: Hosting Migration Problem - The requested address was not found on this server

Hi Jon,

Okay I'll try downloading the 1.1 htaccess files, stupid question but
where do I get them from? I can only see the 1.2 download links on the
main Cake site?

The only log files I've got access to are the standard erorr logs
which aren't picking up anything now.

Thanks,

James

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

Re: How to silently redirects to login page ?

Well, you can do some additional checks and remove the error message
from the session when you don't want it displayed. This should happen
in the afterFilter() callback of the appropriate controller I think.

On Mar 30, 8:26 pm, iFeghali <igor.fegh...@gmail.com> wrote:
> Hello,
>
> I have followed [1] to get a simple login form working. Currently when
> a visitor tries to reach '/' one is redirected to the login form,
> which is desirable, but an error message is displayed "You are not
> authorized to access that location.", which is not desirable. Any clue
> how do I prevent this error only in the case where the user is going
> to login ?
>
> Thank you.
>
> [1]http://book.cakephp.org/view/172/Authentication
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Monday, March 30, 2009

Where to DL RC2?

I can't find the link to download Cake 1.2 RC2. I'm trying to run a
site that was built on RC2 that doesn't work with the current release.
Can anyone direct me?

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

Adding/Deleting HABTM on existing records

Hi, I have searched this forum and read the manuals, and finally got
my code working, BUT am I doing this right or have I just found a
cludge by dumb luck?

I have 2 tables Questions and Games joined correctly thru
games_questions table. Users can attach or detach Questions from a
Game (drag 'n drop) but I was having trouble writing/deleting into the
games_questions x-ref.

The post on this forum titled "not understanding simple HABTM save/
delete" by Ryan McKillen gave me my solution (adapted version below),
along with http://teknoid.wordpress.com/2008/07/11/notes-on-cakephp-habtm-part-2-saving-data/

So my question is: Do I have to read the existing relationships ($this-
>Question->find) just to insert/remove a new relationship? I have used
containable to make the read as efficient as possible, but it seems
wasteful.

If I don't populate the array then all existing relationships get
replaced by the new one, and this is the only way I found to get it to
work.

//Read the existing Question to get current relationships...
$data=$this->Question->find('first',array(
'conditions'=>array('Question.id'=>$q_id),
'contain'=>array('Game.id')
));
// Extract only the Game's ids into an array
$existing=Set::extract('/Game/id',$data);
// Build a new datastructure
$this->data['Question']['id']=$q_id;
$this->data['Game']=$existing;
$this->data['Game'][]=$target_game_id'];

if ($this->Question->save($this->data)){
/// Yay it saved
}


I haven't written the code to Detach a Question from a Game yet, but
unless I hear otherwise I guess I'll do something similar:
1. Read existing relationships
2. Remove the target from the array
3. Save the Question (the delete would be implied)

Somehow it seems unnatural IMO to use Save on a model to Insert, Save,
and Delete HABTM relationships, but I'll get used to it, if that's
what it takes.

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

Re: Useing different database for the different actions

Great, Thanks! I guess was searching for the wrong terms.

On 30 Mrz., 20:57, Alfredo Quiroga-Villamil <laww...@gmail.com> wrote:
> Yep, even better.
>
> Tx Martin.
>
> On Mon, Mar 30, 2009 at 2:54 PM, Martin Westin
>
> <martin.westin...@gmail.com> wrote:
>
> > I think this is what you are looking for
>
> >http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-mast...
>
> > On Mar 30, 6:28 pm, Alfredo Quiroga-Villamil <laww...@gmail.com>
> > wrote:
> >> Pippo:
>
> >> I've never done this or even thought about how to do it; so there
> >> might be a better way to accomplish what you want. Perhaps what I am
> >> about to tell you might not be a valid solution; but one thing that
> >> comes to mind is the following:
>
> >> Assuming that what you want is to read from one DB and perform CUD
> >> operations on the other one (Master), you could try to:
>
> >> Overwrite the methods related to "select" in AppModel and specify the
> >> DB to use for those cases. Do the same for methods that will be of CUD
> >> type in AppModel and point in this case to the other database you
> >> would like to use (master in this case)
>
> >> Everyone, please keep me honest here.
>
> >> Regards,
>
> >> Alfredo
>
> >> On Mon, Mar 30, 2009 at 11:42 AM, Pippo <phil...@wuermli.com> wrote:
>
> >> > Hi
>
> >> > We would like to use scalr.net and amazon webservices in order to be
> >> > able to scale if we have more and more users.
>
> >> > We would like to use one master Database and some slave Databases. The
> >> > synchronization in between of the different databases will go only in
> >> > one way, from the master to the slaves. This would mean that we need
> >> > to be able to differentiate in between of the actions done to the
> >> > database. All the Select statements (cakephp function find) would need
> >> > to go to the slaves, the Insert and Update statements should go to the
> >> > master database. The different Databases are on different Servers
> >> > (IP).
>
> >> > I couldn't find any information how this could be done with cakephp. I
> >> > have seen that I can use different databases by defining  useDbConfig
> >> > (http://book.cakephp.org/view/435/useDbConfig) but this would mean
> >> > that it would do all the type of SQL statement to one Database, no
> >> > matter whether it is a SELECT (read data) or an UPDATE or INSERT
> >> > (edit, create data).
>
> >> > Did someone have the same issue and does someone have a solution for
> >> > 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Why is validation called twice?

On Mar 30, 10:33 pm, Miles J <mileswjohn...@gmail.com> wrote:
> How am I to fix this problem?

One workaround may be just setting some sort of flag on the model or
elsewhere to determine you have already checked the recaptcha
validation.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Security white paging (blackholes) on certain pages

I found this, Im assuming it will bypass these fields so it wont
blackhole.

$this->Security->disabledFields = array('field1', 'field2');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Why is validation called twice?

Ive noticed this numerous times when creating my own methods for model
validation. When I do a debug() within the method, it outputs the data
twice, which means the validation is happening twice. Now this hasnt
been a problem until now. Im trying to get recaptcha working correctly
using model validation, heres my code:

/**
* Validate recaptcha
* @param array $data
* @return boolean
*/
function recaptcha($data) {
App::import('Vendor', 'recaptcha', array('file' => 'recaptcha.php'));
$private = Configure::read('Settings.captcha_private');
$public = Configure::read('Settings.captcha_public');

$verify = recaptcha_check_answer($private, env('REMOTE_ADDR'), $this-
>data[$this->name]['recaptcha_challenge'], $this->data[$this->name]
['recaptcha']);

debug($verify);

return ($verify->is_valid) ? true : false;
}


And the model validation:

'recaptcha' => array(
'recaptcha' => array(
'rule' => array('recaptcha'),
'message' => 'captchaFailed'
)
)

The problem is that recaptcha is valid the first time, but since it
validates twice, it fails the second time, thus causing my form never
to validate. As you can see in the debug below, its called twice.

app/app_model.php (line 157)

ReCaptchaResponse Object
(
[is_valid] => 1
[error] =>
)


app/app_model.php (line 157)

ReCaptchaResponse Object
(
[is_valid] =>
[error] => incorrect-captcha-sol
)

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

Re: Hosting Migration Problem - The requested address was not found on this server

Hi James,

> I've added the Rewrite Base line but I'm still seeing a 500 error
> page, this is what my htaccess file currently reads:
>
> <IfModule mod_rewrite.c>
>        RewriteEngine on
>        RewriteBase /~palacevi/cakephp/
>        RewriteRule    ^webstats/(.*)    webstats/$1 [L]
>        RewriteRule    ^$ app/webroot/    [L]
>        RewriteRule    (.*) app/webroot/$1 [L]
> </IfModule>

The above doesn't look like the standard cakephp htaccess. try
downloading the most recent stable of 1.1 (which I think you're using)
and replace (backup first!) the htaccess files in each folder with
their defaults.

Not sure if that'll do it, but need to start somewhere.

What does the apache logs say? anything more than just a 404? what
about php logs?

cheers,

Jon

--

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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Notice (8): Undefined index: id?

On Mar 30, 6:11 pm, Marcelo Andrade <mfandr...@gmail.com> wrote:
> On Mon, Mar 30, 2009 at 6:44 PM, Aurelius <aurel...@temporaryinbox.com> wrote:
>
> > What does that mean, and where is the problem?
> > Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
> > 1281...on line 77
>
> > That's line 77:
> > if ($this->User->save ( $this->data, true , array ( 'firstname',
> > 'lastname', '....' ))) {
> > ... }
>
> > What's wrong?
>
> It's hard to say.  Maybe you're in an edit action and
> your $this->data doesn't contain the desired record id.
>
> Please, tell us more about your scenario.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> http://mfandrade.wordpress.com

Also, do you have any beforeValidate or beforeSave callbacks that are
changing the data?
Sounds like the data for your primary key for your User model is being
unset somewhere possibly.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Couldn't use method named 'object'

I got what you said. Thanks!

On Mon, Mar 30, 2009 at 11:54 PM, brian <bally.zijn@gmail.com> wrote:

On Mon, Mar 30, 2009 at 10:54 AM, joshua <joshokn@gmail.com> wrote:
> You have totally answered my questions. Thanks! But I still have a question
> for the ticket 4026 which has already been closed.
> It was suggested we use boolean. If so, how can use several values in a
> boolean field? I don't think this bug has been solved.

What do you mean by "several values"? Like, 1, 2, 3, ... etc? You can
use smallint to get around Cake's treating tinyint as a boolean. That
convention, while not terrific, exists to deal with other issues.





--
Thanks
Joshua

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

Re: CakePHP on Hiawatha web server

Again, I have to set var $base into var $base = "/APP_NAME/index.php",
so that scaffolding points to correct URL (add/view/edit/delete)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Hosting Migration Problem - The requested address was not found on this server

Okay it's actually reading a 404 Error now (it's late...)!

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

Re: Hosting Migration Problem - The requested address was not found on this server

At this point I don't have any new ideas, I will keep pondering...

Sam D


On Mon, Mar 30, 2009 at 3:17 PM, jmdesign
<webmaster@jmdesignsolutions.com> wrote:
>
> Error log reads the following erron on the htaccess file:
>
> "Invalid command 'php_value', perhaps misspelled or defined by a
> module not included in the server configuration"
>
> I've removed the php_value line from the htaccess file, there's no
> error in the logs now but the 500 error is still showing!
>
> I knew this wouldn't be straight forward but I wasn't expecting it to
> be this difficult!
>
> James
> >
>

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

Re: CakePHP on Hiawatha web server

well, after creating model and controller, I must change the var
$webroot into fixed path, ie var $webroot = '/APP_NAME/app/webroot/',
change APP_NAME with your main APP (cake) folder, because all
controller is callled with index.php/controller_name, so webroot has
to be in the fixed location.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Hosting Migration Problem - The requested address was not found on this server

Error log reads the following erron on the htaccess file:

"Invalid command 'php_value', perhaps misspelled or defined by a
module not included in the server configuration"

I've removed the php_value line from the htaccess file, there's no
error in the logs now but the 500 error is still showing!

I knew this wouldn't be straight forward but I wasn't expecting it to
be this difficult!

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

Re: Notice (8): Undefined index: id?

On Mon, Mar 30, 2009 at 6:44 PM, Aurelius <aurelius@temporaryinbox.com> wrote:
>
> What does that mean, and where is the problem?
> Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
> 1281...on line 77
>
> That's line 77:
> if ($this->User->save ( $this->data, true , array ( 'firstname',
> 'lastname', '....' ))) {
> ... }
>
> What's wrong?

It's hard to say. Maybe you're in an edit action and
your $this->data doesn't contain the desired record id.

Please, tell us more about your scenario.

Best regards.

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

http://mfandrade.wordpress.com

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

Re: Setting Layout for Scaffolding?

Here's a good walkthrough:
http://teknoid.wordpress.com/2009/01/31/take-control-over-your-bake-and-scaffold-html-templates/

On Mar 30, 5:05 pm, Amit <a...@amitvaria.com> wrote:
> I think you're referring to cake/libs/views/scaffold/(add|edit|
> view.ctp). These will let you alter the way scaffolding looks
>
> On Mar 30, 2:42 am, bbf <builtbyf...@gmail.com> wrote:
>
>
>
> > I've searched the groups and Google and can't find an answer for this.
>
> > How do I set a different layout for the scaffolding?
>
> > Thanks for your 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Setting Layout for Scaffolding?

I think you're referring to cake/libs/views/scaffold/(add|edit|
view.ctp). These will let you alter the way scaffolding looks

On Mar 30, 2:42 am, bbf <builtbyf...@gmail.com> wrote:
> I've searched the groups and Google and can't find an answer for this.
>
> How do I set a different layout for the scaffolding?
>
> Thanks for your 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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

CakePHP on Hiawatha web server

Recently I just moved from apache/lighttpd to hiawatha, but
unfortunately dealing with mod_rewrite is very time consuming. So, my
problem with cakePHP (and other MVC with mod_rewrite) is unable to
access webroot folder. The main site is just showing the plain HTML,
no CSS, favicon and so on.

So, here is what I've done to make CakePHP works in hiawatha without
adding urltoolkit into main httpd config file.

Edit file dispatcher.php, find var $webroot and change its value into
'app/webroot/', next jump to line 360th and comment that line ($this-
>webroot = $base .'/')

Now cakePHP works in hiawatha (I mean webroot dir is now direct to app/
webroot, so that CSS, favicon, etc in webroot is now accessible).

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

Notice (8): Undefined index: id?

What does that mean, and where is the problem?
Notice (8): Undefined index: id [CORE/cake/libs/model/model.php, line
1281...on line 77

That's line 77:
if ($this->User->save ( $this->data, true , array ( 'firstname',
'lastname', '....' ))) {
... }

What's wrong?

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

BUG? srand() is seeded with a constant in Security::cipher()

Later calls to shuffle() or other functions which do not use the
mt_srand() seed then return the same predictable results time and time
again.

Shouldn't the seed be set to a new seed at the end of the function
before the return? This behavior is in the latest version of CakePHP
and has been in for awhile.

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