Re: Radio button value null after post, but appears in post headers upon inspection

2009-01-03 Thread WebbedIT

That looks like an unusual array dump to me.

Multiple radio button fields with the same name should result in a
single variable being passed back to the controller.  Can you even
build an array with multiple instances of the same key-value pairing
as shown above?

My guess would be that IF you have managed to get the above array
passed to the controller that last instance of data[EdibleUndy]
[underwear_type_id] would be the one read and that doesn't have a
value.

Can you show us the HTML code for the form including the radio buttons
and the hidden field you mention, and also could you supply the PHP
you are using to create the form?
--~--~-~--~~~---~--~~
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: in the link have a parameter 'CAKEPHP'

2009-01-03 Thread Mike Bernat
That's cakePHP's session ID. It's appearing because the server believes you
don't have cookies enabled. You can't turn it off as it is a php core
behavior.

On Sat, Jan 3, 2009 at 2:44 AM, Rimoe meiyo...@gmail.com wrote:

 hi,
 everyone,
 in my link have a parameter CAKEPHP.
 for example
 http://www.mysite.com/mails/add?CAKEPHP=3831a0f2e1fb52c9ae15d163f57c4695
 how to remove it,
 recently I have read a topic about to remove the parameter,
 but I have forget to it.
 If you know, please tell me.
 Thank you.

 rimoe

 


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



show image from layout

2009-01-03 Thread piyushsharmajec


How can one show image either logo or any other from layout file as this file
is present in webroot folder so there is confution over image address.
Thanks
Piyush 
-- 
View this message in context: 
http://www.nabble.com/show-image-from-layout-tp21263881p21263881.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Validation errors for the wrong form

2009-01-03 Thread Nature Lover

Hi!

Are the forms for both login and register differ.
or you have included the login element within the registration form?

thanks!

On Jan 1, 9:33 am, mariacheu...@gmail.com mariacheu...@gmail.com
wrote:
 Hi all,
 Apologies if this has been addressed before, but I've searched and
 can't find a thing.

 I have a register page, with a login element in the sidebar. The login
 element is on every page in the sidebar. When I try register with
 invalid data, the correct validation errors show for the register
 form. However, the errors are also showing on the login form, even
 though that hasn't been submitted. The login form is using jQuery Ajax
 to submit.

 Any ideas anyone?

 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: Validation errors for the wrong form

2009-01-03 Thread mariacheu...@gmail.com

They are both different forms, the register form is from a view and
the login is part of a sidebar element. Both forms have different
names too.

Thanks for your reply!

On Jan 3, 6:21 pm, Nature Lover nature_lover1...@yahoo.co.in wrote:
 Hi!

 Are the forms for both login and register differ.
 or you have included the login element within the registration form?

 thanks!

 On Jan 1, 9:33 am, mariacheu...@gmail.com mariacheu...@gmail.com
 wrote:

  Hi all,
  Apologies if this has been addressed before, but I've searched and
  can't find a thing.

  I have a register page, with a login element in the sidebar. The login
  element is on every page in the sidebar. When I try register with
  invalid data, the correct validation errors show for the register
  form. However, the errors are also showing on the login form, even
  though that hasn't been submitted. The login form is using jQuery Ajax
  to submit.

  Any ideas anyone?

  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: Radio button value null after post, but appears in post headers upon inspection

2009-01-03 Thread Drinkspiller

 Can you show us the HTML code for the form including the radio buttons
 and the hidden field you mention, and also could you supply the PHP
 you are using to create the form?

 Can you show us the HTML code for the form including the radio buttons
 and the hidden field you mention, and also could you supply the PHP
 you are using to create the form?
Sure thing. In my add action:
$this-set('user', $this-user);
$underwear_types = 
$this-EdibleUndy-UnderwearType-find('all');
$this-set(compact('underwear_types'));

Because I want to get all the fields in UnderwearType (id, name AND
image), I am doing passing 'all' to find instead of 'list'.

Then, in the view, since I want to customize the output of radio
buttons, I loop though the array and specify a single option each
time. Here's the view snippet:

?
echo $form-create('EdibleUndy', array('url'=$appCallbackUrl .
/ . $this-params['url']['url'])); //
echo 'table class=undietypes';
echo 'tr';
foreach($underwearTypes as $type){
echo 'td';
echo $form-input('underwear_type_id', 
array('type'='radio',

 'legend'=false,

 'label'='',

 'div'=false,

 
'options'=array($type['UnderwearType']['id']='')));

echo 'h2' . 
$type['UnderwearType']['name'] . '/h2';
echo $html-image($appCallbackUrl . 
'img/' . $type
['UnderwearType']['image']);
echo '/td';
}
echo '/tr';

echo 'tr';
echo 'td colspan=4';
echo $form-submit('Select', array
('type'='submit','div'='submit_container'));
echo '/td';
echo '/tr';
echo '/table';


echo $form-end();
?

The resulting HTML output is this:

form method=post action=http://www.mydomain.com/underwear/undies/
add
fieldset style=display:none;
input type=hidden name=_method value=POST /
/fieldset
table class=undietypes
tr
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId1 value=1  /
h2Boxers/h2
img src=http://www.syntax101.com/facebook/
edible_underwear/img/boxers.gif alt= /
/td
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId2 value=2  /
h2Briefs/h2
img src=http://www.syntax101.com/facebook/
edible_underwear/img/briefs.gif alt= /
/td
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId3 value=3  /
h2Panties/h2
img src=http://www.syntax101.com/facebook/
edible_underwear/img/panties.gif alt= /
/td
/tr
tr
td colspan=4
div class=submit_containerinput type=submit
type=submit value=Wear //div
/td
/tr
/table
/form

Thanks for your insight!
--~--~-~--~~~---~--~~
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: Radio button value null after post, but appears in post headers upon inspection

2009-01-03 Thread Drinkspiller

 Can you show us the HTML code for the form including the radio buttons
 and the hidden field you mention, and also could you supply the PHP
 you are using to create the form?

 Can you show us the HTML code for the form including the radio buttons
 and the hidden field you mention, and also could you supply the PHP
 you are using to create the form?
Sure thing. In my add action:
$this-set('user', $this-user);
$underwear_types = 
$this-EdibleUndy-UnderwearType-find('all');
$this-set(compact('underwear_types'));

Because I want to get all the fields in UnderwearType (id, name AND
image), I am doing passing 'all' to find instead of 'list'.

Then, in the view, since I want to customize the output of radio
buttons, I loop though the array and specify a single option each
time. Here's the view snippet:

?
echo $form-create('EdibleUndy', array('url'=$appCallbackUrl .
/ . $this-params['url']['url'])); //
echo 'table class=undietypes';
echo 'tr';
foreach($underwearTypes as $type){
echo 'td';
echo $form-input('underwear_type_id', 
array('type'='radio',

 'legend'=false,

 'label'='',

 'div'=false,

 
'options'=array($type['UnderwearType']['id']='')));

echo 'h2' . 
$type['UnderwearType']['name'] . '/h2';
echo $html-image($appCallbackUrl . 
'img/' . $type
['UnderwearType']['image']);
echo '/td';
}
echo '/tr';

echo 'tr';
echo 'td colspan=4';
echo $form-submit('Select', array
('type'='submit','div'='submit_container'));
echo '/td';
echo '/tr';
echo '/table';


echo $form-end();
?

The resulting HTML output is this:

form method=post action=http://www.mydomain.com/underwear/undies/
add
fieldset style=display:none;
input type=hidden name=_method value=POST /
/fieldset
table class=undietypes
tr
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId1 value=1  /
h2Boxers/h2
img src=http://www.mydomain.com/edible_underwear/img/
boxers.gif alt= /
/td
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId2 value=2  /
h2Briefs/h2
img src=http://www.mydomain.com/edible_underwear/img/
briefs.gif alt= /
/td
td
input type=hidden name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
input type=radio name=data[EdibleUndy]
[underwear_type_id] id=EdibleUndyUnderwearTypeId3 value=3  /
h2Panties/h2
img src=http://www.mydomain.com/]/edible_underwear/
img/panties.gif alt= /
/td
/tr
tr
td colspan=4
div class=submit_containerinput type=submit
type=submit value=Wear //div
/td
/tr
/table
/form
--~--~-~--~~~---~--~~
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: Adding table row with AJAX

2009-01-03 Thread Steven Wright

Thanks for the reply. This is mostly working but there is something I am
still missing.

I tried two different things.

1) If I call the 'edit' action I get a jQuery error ( 'div is null' ' elem =
jQuery.makeArray( div.childNodes ); ')
I am not sure what div its looking for. The second problem with that is that
although I can see the table row returned at the start of the response
string the rest of the content for the view is also returned and I don't
know why.

2) If I call the 'add_ingredient_row' action I only get the content for the
view in the response but no new row.


So two questions:
1) Why is CakePHP returning all the content for the view?
2) Why is jQuery giving me that error?


Thanks again. If I can just get over this hurdle I will be off and running.


VIEW

h2Testing AJAX with CakePHP and Prototype and Scriptaculous/h2

table id=the_table
tr id=row1
tdRow1/td
/tr
/table

div id=mydiv
This is a div
/div

div id=the_buttonClick/div


CONTROLLER

class AjaxtestsController extends AppController
{

var $components = array( 'RequestHandler' );


function index()
{
$this-pageTitle = 'Index Page';
}

function view()
{
$this-pageTitle = 'View Page';
}

function edit()
{
$this-pageTitle = 'Edit Page';
if($this-RequestHandler-isAjax())
{
$this-layout = 'ajax';
echo 'trtdThis is a row/td/tr';

}
}

function add_ingredient_row()
{
echo 'trtdThis is a row/td/tr';

}

}


JAVASCRIPT

$(document).ready(function()
{
$('#the_button').click(function()
{
$.ajax({
url: 'add_ingredient_row/',
type: 'GET',
data: 'data string',
dataType: 'html',
timeout: 2000,
error: function(XMLHttpRequest, textStatus,
errorThrown)
{
// ...
alert('There has been an error');
},
success: function(msg)
{
//alert(msg);
$('#the_table').append(msg);
}
}); // ends ajax
}); // ends click 
}); // ends document.ready

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of brian
Sent: Friday, January 02, 2009 8:26 PM
To: cake-php@googlegroups.com
Subject: Re: Adding table row with AJAX


On Fri, Jan 2, 2009 at 7:45 PM, Steven Wright rhythmicde...@gmail.com
wrote:

 Hi Adam,
 Thanks for writing back. How would you get the data back for the row 
 from CakePHP?

 My row contains four columns with the following inputs:

 amount [text]
 measurement_type [select]
 description [text]
 ingredient [select]

 This is normally rendered from an element as a table row. I would like 
 the output of that element appended to my table.  So on the button 
 click I call the action add_ingredient_row and it should return the 
 content of the element. How do I get that content appended to my table.

 I can do this without CakePHP. But for me this exercise is to use the 
 framework.


Being a jQuery user, I never bother with Cake's ajax() stuff. But jQuery is
dead simple (mostly) to use, so I don't mind having to write out a few lines
of JS. To do what you describe, I'd do something like
this:


$(document).ready()
{
$('#the_button').click(function()
{
$.ajax({
url: the_href,
type: 'GET',
data: the_data,
dataType: 'html',
timeout: 2000,
error: function(XMLHttpRequest, textStatus,
errorThrown)
{
// ...
},
success: function(msg)
{
/* assuming your controller is returning
'tr.../tr'
 */
$('#the_table').append(msg);
}
});
});
});



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

Re: $this-Auth-user not refreshing after edit

2009-01-03 Thread webjay


Here's how I do it:

private function reload () {
$this-Auth-login($this-User-read());
}

So just call $this-reload() from your controller.
-- 
View this message in context: 
http://n2.nabble.com/%24this-%3EAuth-%3Euser-not-refreshing-after-edit-tp526651p2106151.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: without default Database Configuration: Fatal error: ConnectionManager::getDataSource - Non-existent data source default

2009-01-03 Thread Smelly_Eddie

Sounds like you want to use multiple configurations based on the
location of the app (live versus dev)

There are a few ways to solve this. I wrote an article outlining my
preferred method.

You should read through the user comments as they add some helpful
insight, including how to use this method while still allowing the
bake commands to work.

http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp

On Jan 2, 11:48 am, james revillini ja...@revillini.com wrote:
 I'm debating whether or not this is a bug.  What do you think:

 If I use the bake script and create a database conf called local,
 then run it again and create one called live, then start trying to
 build models, it will fail with this error message:

 Fatal error: ConnectionManager::getDataSource - Non-existent data
 source default in C:\tmp\1.2.x.x\cake\libs\model
 \connection_manager.php on line 109

 The exact step of model building that it will fail on is right after
 you answer the question about adding validation criteria for the model
 fields.  I'm guessing cake is hard coded to use default somewhere,
 but I think it's a bug since it did ask me which db config to use and
 I told it to use the local one at the outset of running the bake
 script.

 Incidentally, the work around is to create a db config for default,
 and make sure it points to the database that has the correct structure
 for your bake.  Another option is to turn it into a drinking game,
 where you need to chug every time you get a fatal error, and
 eventually the situation will smooth itself out.

 Thanks,
 Jim
--~--~-~--~~~---~--~~
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: API

2009-01-03 Thread Steven Wright

Not one really specific thing. In general the Cookbook does not seem to
answer my questions so I find myself going to look at the API. Most methods
seem to accept options but there is almost never a description of what those
options are. I suppose given time I will figure this out, its just difficult
for a new user to get past. 

Thanks for replying.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Webweave
Sent: Friday, January 02, 2009 11:43 PM
To: CakePHP
Subject: Re: API


My experience is that you are much better off looking at the cookbook for
that sort of information.

In a few cases the API docs are very clear as to what the options are and
how to use them, but often it requires a lot of digging to understand them.

What part of the API are you having trouble with ?

On Dec 29 2008, 6:18 pm, rhythmicde...@gmail.com
rhythmicde...@gmail.com wrote:
 I am looking at the API trying to figure some stuff out. I keep 
 getting stuck when they docs talk about options but dont actually give 
 the options. How am I supposed to figure out what options are 
 available for a particular class? Some of the time I can find the 
 option in class or method definition but there is no real explanation 
 of what it's for.


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



How can we edit uploaded file

2009-01-03 Thread mona

hi all
On my edit view i have one option to update uploaded file but when i
do this they are taking first character of file and in size also it
will take character value so how can i edit uploaded file value in
cake php
--~--~-~--~~~---~--~~
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: Radio button value null after post, but appears in post headers upon inspection

2009-01-03 Thread WebbedIT

 The resulting HTML output is this:

 form method=post action=http://www.mydomain.com/underwear/undies/
 add
         fieldset style=display:none;
         input type=hidden name=_method value=POST /
         /fieldset
     table class=undietypes
         tr
                 td
                 input type=hidden name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                 input type=radio name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId1 value=1  /
                 h2Boxers/h2
                 img src=http://www.mydomain.com/edible_underwear/img/
 boxers.gif alt= /
                         /td
             td
                 input type=hidden name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                 input type=radio name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId2 value=2  /
                 h2Briefs/h2
                 img src=http://www.mydomain.com/edible_underwear/img/
 briefs.gif alt= /
             /td
             td
                 input type=hidden name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                 input type=radio name=data[EdibleUndy]
 [underwear_type_id] id=EdibleUndyUnderwearTypeId3 value=3  /
                 h2Panties/h2
                 img src=http://www.mydomain.com/]/edible_underwear/
 img/panties.gif alt= /
                         /td
                 /tr
         tr
             td colspan=4
                 div class=submit_containerinput type=submit
 type=submit value=Wear //div
             /td
         /tr
     /table
 /form

I have just created a list of radio buttons (was a select list in one
of my forms) using the form helper

echo $form-input('user_id', array('empty'='None', 'type'='radio'));

and it produced this ...

input name=data[Person][user_id] id=PersonUserId_ value=
type=hidden
input name=data[Person][user_id] id=PersonUserId1 value=1
type=radiolabel for=PersonUserId1PaulGardner/label
input name=data[Person][user_id] id=PersonUserId2 value=2
type=radiolabel for=PersonUserId2IanForster/label
input name=data[Person][user_id] id=PersonUserId3 value=3
type=radiolabel for=PersonUserId3SteveGinn/label

Your code is adding a hidden field for every radio option whereas mine
only has one at the very top.  That could be interfering with things,
not that I'm sure why it adds a hidden field for every radio button?!?


--~--~-~--~~~---~--~~
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: Data validation doesn't work

2009-01-03 Thread Lucas

Hi gearvOsh,

Unfortunately nothing happens again :(
I tryed with both options (required = true and notEmpty rule) and
nothing happens.

More tips?

Thanks!

On 29 dez 2008, 23:24, gearvOsh mileswjohn...@gmail.com wrote:
 You either need to have:

 required = true

 Or use the notEmpty rule.

 http://book.cakephp.org/view/127/One-Rule-Per-Fieldhttp://book.cakephp.org/view/740/notEmpty

--~--~-~--~~~---~--~~
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: Data validation doesn't work

2009-01-03 Thread Lucas

Hi gearvOsh,

Unfortunately nothing happens again :(
I tryed with both options (required = true and notEmpty rule) and
nothing happens.

More tips?

Thanks!

On 29 dez 2008, 23:24, gearvOsh mileswjohn...@gmail.com wrote:
 You either need to have:

 required = true

 Or use the notEmpty rule.

 http://book.cakephp.org/view/127/One-Rule-Per-Fieldhttp://book.cakephp.org/view/740/notEmpty

--~--~-~--~~~---~--~~
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: Radio button value null after post, but appears in post headers upon inspection

2009-01-03 Thread Drinkspiller

WebbedIt:

When you submit this form does the selected radio button's valueshow
up or does it arrive at validation and the SQL as null like it does
for me?

Cheers!


On Jan 3, 11:01 am, WebbedIT p...@webbedit.co.uk wrote:
  The resulting HTML output is this:

  form method=post action=http://www.mydomain.com/underwear/undies/
  add
          fieldset style=display:none;
          input type=hidden name=_method value=POST /
          /fieldset
      table class=undietypes
          tr
                  td
                  input type=hidden name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                  input type=radio name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId1 value=1  /
                  h2Boxers/h2
                  img src=http://www.mydomain.com/edible_underwear/img/
  boxers.gif alt= /
                          /td
              td
                  input type=hidden name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                  input type=radio name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId2 value=2  /
                  h2Briefs/h2
                  img src=http://www.mydomain.com/edible_underwear/img/
  briefs.gif alt= /
              /td
              td
                  input type=hidden name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId_ value= /
                  input type=radio name=data[EdibleUndy]
  [underwear_type_id] id=EdibleUndyUnderwearTypeId3 value=3  /
                  h2Panties/h2
                  img src=http://www.mydomain.com/]/edible_underwear/
  img/panties.gif alt= /
                          /td
                  /tr
          tr
              td colspan=4
                  div class=submit_containerinput type=submit
  type=submit value=Wear //div
              /td
          /tr
      /table
  /form

 I have just created a list of radio buttons (was a select list in one
 of my forms) using the form helper

 echo $form-input('user_id', array('empty'='None', 'type'='radio'));

 and it produced this ...

 input name=data[Person][user_id] id=PersonUserId_ value=
 type=hidden
 input name=data[Person][user_id] id=PersonUserId1 value=1
 type=radiolabel for=PersonUserId1PaulGardner/label
 input name=data[Person][user_id] id=PersonUserId2 value=2
 type=radiolabel for=PersonUserId2IanForster/label
 input name=data[Person][user_id] id=PersonUserId3 value=3
 type=radiolabel for=PersonUserId3SteveGinn/label

 Your code is adding a hidden field for every radio option whereas mine
 only has one at the very top.  That could be interfering with things,
 not that I'm sure why it adds a hidden field for every radio button?!?
--~--~-~--~~~---~--~~
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: show image from layout

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 6:07 AM, piyushsharmajec
piyushsharma...@gmail.com wrote:


 How can one show image either logo or any other from layout file as this file
 is present in webroot folder so there is confution over image address.
 Thanks

It does not matter that the layout file is stored in
app/views/layouts/ and the images in app/webroot/img. The layouts
directory is simply a folder to store template files; they are not
served from there in the same manner as, say an HTML file would be.
Any paths inside of a layout file should be relative to root
(app/webroot/) not the layouts directory.

So, if you have an image file at app/webroot/img/my_img.png you can
put the following in your layout:

img src=/img/my_img.png alt=...

Likewise, if you have CSS rules which refer to images, you can either
set the URLs to be relative from root - url(/img/my_img.png) or
from the CSS directory - url(my_img_foloder/my_img.png)

where the latter refers to an image stored at
app/webroot/css/my_img_foloder/my_img.png and the former to the
regular img directory.

--~--~-~--~~~---~--~~
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: show image from layout

2009-01-03 Thread Mike Bernat
You can also use the image method from the html helper.

echo $html-image('my_logo.jpg');

On Sat, Jan 3, 2009 at 12:51 PM, brian bally.z...@gmail.com wrote:


 On Sat, Jan 3, 2009 at 6:07 AM, piyushsharmajec
 piyushsharma...@gmail.com wrote:
 
 
  How can one show image either logo or any other from layout file as this
 file
  is present in webroot folder so there is confution over image address.
  Thanks

 It does not matter that the layout file is stored in
 app/views/layouts/ and the images in app/webroot/img. The layouts
 directory is simply a folder to store template files; they are not
 served from there in the same manner as, say an HTML file would be.
 Any paths inside of a layout file should be relative to root
 (app/webroot/) not the layouts directory.

 So, if you have an image file at app/webroot/img/my_img.png you can
 put the following in your layout:

 img src=/img/my_img.png alt=...

 Likewise, if you have CSS rules which refer to images, you can either
 set the URLs to be relative from root - url(/img/my_img.png) or
 from the CSS directory - url(my_img_foloder/my_img.png)

 where the latter refers to an image stored at
 app/webroot/css/my_img_foloder/my_img.png and the former to the
 regular img directory.

 


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



Radio Button onClick

2009-01-03 Thread Nick

What Im trying to do is list some events as radio buttons.  When one
of the buttons is clicked I wanted it to populate three textareas with
the data from that event record.  ie: when clicking on wedding the
Event.name, Event.description, Event.information would be populated
into the three textareas.

The problem Im having is how to use the $form helper to get it to
work.  The following are what I've tried

// Option #1
//
// controllers/events_controller.php
//
$events = $this-Event-find('list');
$this-set(compact('events'));

//
// views/events/create_event.ctp
//
echo $form-input('Event', array(
'div' = true,
'label' = true,
'type' = 'radio',
'options' = $events,
'onClick' = '$(EventName).value=aklsdjflkj'
));

problem with #1 is that I need to loop to access the correct
Event.name, Event.description, Event.information for the onClick
event.  Right now with the find set to 'list', I don't have access to
that.

If I use the find query from step two here, I wouldn't know how to
access the correct Event.name, Event.description, Event.information
without being in a loop.  Plus the label says array rather than the
appropriate Event.name.

// Option #2
//
// controllers/events_controller.php
//
$events = $this-Event-find('all',
array(
conditions = array(
Event.template = 1
)
)
);
$this-set(compact('events'));
//
// views/events/create_event.ctp
//
foreach($events as $event)
{
echo $form-input('Event.name', array(
'div' = true,
'label' = true,
'type' = 'radio',
'options' = $event[Event][name],
'value' = $event[Event][id]
));

}

// Problem with #2 is that when I put this in a loop, everything gets
messed up with the ids and the names of the inputs.  Plus they are all
in there own div rather than being together.


Im pretty new at cake, but have been programming php for many years.
Any help is greatly appreciated.

Thanks so much,
Nick
--~--~-~--~~~---~--~~
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: show image from layout

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 1:21 PM, Mike Bernat bern...@gmail.com wrote:
 You can also use the image method from the html helper.

 echo $html-image('my_logo.jpg');


Yes, I should have mentioned that. I was just trying to clarify the
paths issue. I suspect the OP is confused by the location of the
layouts dir, thinking of it as a normal directory under root from
whence HTML pages are served for a site.

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

2009-01-03 Thread mark_story

Steven, if you could give some concrete examples perhaps we could
improve the doc blocks :)

-Mark

On Jan 3, 11:36 am, Steven Wright rhythmicde...@gmail.com wrote:
 Not one really specific thing. In general the Cookbook does not seem to
 answer my questions so I find myself going to look at the API. Most methods
 seem to accept options but there is almost never a description of what those
 options are. I suppose given time I will figure this out, its just difficult
 for a new user to get past.

 Thanks for replying.

 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf

 Of Webweave
 Sent: Friday, January 02, 2009 11:43 PM
 To: CakePHP
 Subject: Re: API

 My experience is that you are much better off looking at the cookbook for
 that sort of information.

 In a few cases the API docs are very clear as to what the options are and
 how to use them, but often it requires a lot of digging to understand them.

 What part of the API are you having trouble with ?

 On Dec 29 2008, 6:18 pm, rhythmicde...@gmail.com
 rhythmicde...@gmail.com wrote:
  I am looking at the API trying to figure some stuff out. I keep
  getting stuck when they docs talk about options but dont actually give
  the options. How am I supposed to figure out what options are
  available for a particular class? Some of the time I can find the
  option in class or method definition but there is no real explanation
  of what it's for.
--~--~-~--~~~---~--~~
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: $form-year not saving

2009-01-03 Thread markfm

In case someone stumbles upon this, an even more elegant solution
would be to ditch the controller code and use one line in your view:

? echo $form-input('movie_years', array('type' = 'date',
'dateFormat' = 'Y', 'minYear' = '1930', 'maxYear' = date('Y'))); ?

Much better!

--Mark

On Dec 22 2008, 8:19 pm, markfm m...@p-m-w.com wrote:
 Never used $form-year before.  Maybe somebody else can come up with a
 fix for you.

 However, here's how I would skin this cat...

 In your controller, put in this code:

 $yearsToDisplay = range('1930', date('Y'));
 $movieYears = array_combine($yearsToDisplay, $yearsToDisplay);
 $this-set('movieYears', $movieYears);

 Then in your view:

 ?php echo $form-input('movie_year', array('type' = 'select',
 'options' = $movieYears)); ?

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



Deleting from multiple models

2009-01-03 Thread rhythmicde...@gmail.com

I have a model Recipe that has a one to many relationship with a model
IngredientList

I want to delete a single recipe from the Recipe model which should
also delete all the records from the IngredientList model that have
the recipe's ID.

I would have thought that there would be a single line command like
there is for insert.

if ($this-Recipe-saveAll($this-data))

But this is only way I could find to do it:

function delete($id)
{
$this-IngredientList-deleteAll(IngredientList.recipe_id = 
$id,
true);
$this-Recipe-del($id);
$this-flash('The recipe with id: '.$id.' has been deleted.', '/
recipes');
}
--~--~-~--~~~---~--~~
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: API

2009-01-03 Thread rhythmicde...@gmail.com

Ahh I dont want to be all whiny about it :)

Essentially if there are options the options should be listed.




On Jan 3, 1:50 pm, mark_story mark.st...@gmail.com wrote:
 Steven, if you could give some concrete examples perhaps we could
 improve the doc blocks :)

 -Mark

 On Jan 3, 11:36 am, Steven Wright rhythmicde...@gmail.com wrote:

  Not one really specific thing. In general the Cookbook does not seem to
  answer my questions so I find myself going to look at the API. Most methods
  seem to accept options but there is almost never a description of what those
  options are. I suppose given time I will figure this out, its just difficult
  for a new user to get past.

  Thanks for replying.

  -Original Message-
  From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf

  Of Webweave
  Sent: Friday, January 02, 2009 11:43 PM
  To: CakePHP
  Subject: Re: API

  My experience is that you are much better off looking at the cookbook for
  that sort of information.

  In a few cases the API docs are very clear as to what the options are and
  how to use them, but often it requires a lot of digging to understand them.

  What part of the API are you having trouble with ?

  On Dec 29 2008, 6:18 pm, rhythmicde...@gmail.com
  rhythmicde...@gmail.com wrote:
   I am looking at the API trying to figure some stuff out. I keep
   getting stuck when they docs talk about options but dont actually give
   the options. How am I supposed to figure out what options are
   available for a particular class? Some of the time I can find the
   option in class or method definition but there is no real explanation
   of what it's for.
--~--~-~--~~~---~--~~
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: Cakephp on MAMP, Mac OSX

2009-01-03 Thread b...@superstan.com

Thanks! This was the same issue i had. Once i copied over
the .htaccess file to my cake app folder in the MAMP htdocs folder,
all was good.

Bob

On Dec 26 2008, 2:45 pm, Chad Casselman ccassel...@gmail.com
wrote:
 I am running the same setup.  The only problem I ran into was, I extracted
 cake to my download folder and then copied and pasted it to where I wanted
 to code in it.  Little did I know, the .htaccess files did not copy and
 paste even though I grabbed the whole directory.

 Extract cake to where you want to work on it.

 Chad

 On Fri, Dec 26, 2008 at 5:41 PM, Mickiii michael.la...@gmail.com wrote:

  Thanks for your reply, I have checked the httpd.conf located in the
  mamp folder /mamp/conf/apache/httpd.conf, and checked for the lines:

  LoadModule rewrite_module modules/mod_rewrite.so
  DocumentRoot /Users/user_name/Development/my_app and finally that
  this directory has AllowOverride set to All

  What else can be wrong?

  On Dec 26, 10:41 pm, Gwoo gwoo.cake...@gmail.com wrote:
   mod_rewrite needs to be enabled and AllowOverride All in the httpd.conf

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

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 3:18 PM, rhythmicde...@gmail.com
rhythmicde...@gmail.com wrote:

 Ahh I dont want to be all whiny about it :)

 Essentially if there are options the options should be listed.


Agreed. The API docs are a misery to wade through at times. Especially
for figuring out things like $options.

It'd also be nice if there were a few comment blocks *within* some of
the class methods. I do realise that that wouldn't be trivial to deal
with, though.

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

2009-01-03 Thread Steven Wright

Yeah. I am pretty sure the docs are auto created probably like Java Doc.
But I cant really bitch too much about what is essentially a free framework.



 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of brian
Sent: Saturday, January 03, 2009 3:43 PM
To: cake-php@googlegroups.com
Subject: Re: API


On Sat, Jan 3, 2009 at 3:18 PM, rhythmicde...@gmail.com
rhythmicde...@gmail.com wrote:

 Ahh I dont want to be all whiny about it :)

 Essentially if there are options the options should be listed.


Agreed. The API docs are a misery to wade through at times. Especially for
figuring out things like $options.

It'd also be nice if there were a few comment blocks *within* some of the
class methods. I do realise that that wouldn't be trivial to deal with,
though.



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



saveField with out modifying 'modified'

2009-01-03 Thread brian

Is there any way to use saveField without having my 'modified' column
updated? Looking at the save() method, I thought, at first, that this
should work:

$this-User-saveField('last_login', date('Y-m-d H:i:s'),
array('fieldList' = array('last_login')));

However, it's disregarded. The block that sets the modified column begins with:

if ($this-hasField($updateCol)  !in_array($updateCol, $fields)) {

... meaning, if I don't provide the modified column, it will be
updated. As I'm using saveField, there's no way to do so.

Shouldn't there be an option to override Cake's default behavior?
While I'd normally like 'modified' to be updated, it's superfluous in
this instance, as I don't consider this to be a modification to the
User model, per se.

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

2009-01-03 Thread mark_story

Its not bitching if you are willing to point out where the problems
are and perhaps offer some solutions to those problems.  That's called
contributing in my books.  As for the API it is automatically
generated via doxygen.  But just because it is auto generated means it
should be poor.  So again, some places where you think the API is weak
would help as you are probably not the only person who has experienced
issues with it.

-Mark

On Jan 3, 3:47 pm, Steven Wright rhythmicde...@gmail.com wrote:
 Yeah. I am pretty sure the docs are auto created probably like Java Doc.
 But I cant really bitch too much about what is essentially a free framework.

 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf

 Of brian
 Sent: Saturday, January 03, 2009 3:43 PM
 To: cake-php@googlegroups.com
 Subject: Re: API

 On Sat, Jan 3, 2009 at 3:18 PM, rhythmicde...@gmail.com
 rhythmicde...@gmail.com wrote:

  Ahh I dont want to be all whiny about it :)

  Essentially if there are options the options should be listed.

 Agreed. The API docs are a misery to wade through at times. Especially for
 figuring out things like $options.

 It'd also be nice if there were a few comment blocks *within* some of the
 class methods. I do realise that that wouldn't be trivial to deal with,
 though.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Edit multiple models in the same page: possible?

2009-01-03 Thread Jaime

Hi all,

I wonder if it's possible to have two different forms for two
different (but related) models in the same page.

Imagine a page where the logged in user can edit his profile (model
Profile) as well as to add a photo into his gallery (model Image).

?php echo $form-create('Profile'); ?
...

?php echo $form-create('Image'); ?
...

The problem here is that after submiting one of the forms, the user is
redirected to /model/edit/, and not back to the current page.

I cannot imagine how to fit both forms in the same page without
loosing the validationErrors info.

Any clue?
--~--~-~--~~~---~--~~
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: API

2009-01-03 Thread gearvOsh

I usually open the files myself instead of using the API online. I
usually have to go through the methods themselves to find out the
options.
--~--~-~--~~~---~--~~
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: Deleting from multiple models

2009-01-03 Thread Alexandru

yes it is. check http://book.cakephp.org/view/80/hasOne for dependent
key
dependent: When the dependent key is set to true, and the model’s
delete() method is called with the cascade parameter set to true,
associated model records are also deleted. In this case we set it true
so that deleting a User will also delete her associated Profile.

On Jan 3, 9:56 pm, rhythmicde...@gmail.com rhythmicde...@gmail.com
wrote:
 I have a model Recipe that has a one to many relationship with a model
 IngredientList

 I want to delete a single recipe from the Recipe model which should
 also delete all the records from the IngredientList model that have
 the recipe's ID.

 I would have thought that there would be a single line command like
 there is for insert.

 if ($this-Recipe-saveAll($this-data))

 But this is only way I could find to do it:

         function delete($id)
         {
                 $this-IngredientList-deleteAll(IngredientList.recipe_id = 
 $id,
 true);
                 $this-Recipe-del($id);
                 $this-flash('The recipe with id: '.$id.' has been deleted.', 
 '/
 recipes');
         }
--~--~-~--~~~---~--~~
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: in the link have a parameter 'CAKEPHP'

2009-01-03 Thread Rimoe
Thank You. [?]

2009/1/3 Mike Bernat bern...@gmail.com

 That's cakePHP's session ID. It's appearing because the server believes you
 don't have cookies enabled. You can't turn it off as it is a php core
 behavior.

 On Sat, Jan 3, 2009 at 2:44 AM, Rimoe meiyo...@gmail.com wrote:

 hi,
 everyone,
 in my link have a parameter CAKEPHP.
 for example
 http://www.mysite.com/mails/add?CAKEPHP=3831a0f2e1fb52c9ae15d163f57c4695
 how to remove it,
 recently I have read a topic about to remove the parameter,
 but I have forget to it.
 If you know, please tell me.
 Thank you.

 rimoe




 


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

inline: 000.gif

Re: API

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 6:58 PM, mark_story mark.st...@gmail.com wrote:

 Its not bitching if you are willing to point out where the problems
 are and perhaps offer some solutions to those problems.  That's called
 contributing in my books.  As for the API it is automatically
 generated via doxygen.  But just because it is auto generated means it
 should be poor.  So again, some places where you think the API is weak
 would help as you are probably not the only person who has experienced
 issues with it.


I think there's a source documentation problem throughout. I don't
think it's a matter of any one file. Perhaps that's a decision the
devs made to keep the files slim, although I'm unaware of any
significant impact lots of comments has on performance. I doubt it's
relevant.

There have been times when I've been studying some method and, once
the clue fairy appears, have thought that a particular inline comment
or explanation at the top of the method would help considerably. But I
doubt that Trac submissions just for source comment additions would be
welcomed if too many people did so. Perhaps I'm wrong; I don't kow how
the devs feel about that.

As with any code source, though, a bit (well, more than a bit) of
effort does, eventually, lead to a more comprehensive understanding of
the framework.

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

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 7:36 PM, gearvOsh mileswjohn...@gmail.com wrote:

 I usually open the files myself instead of using the API online. I
 usually have to go through the methods themselves to find out the
 options.

You can get to the source of any method by following the link,
Definition at line [#] in the method description.

--~--~-~--~~~---~--~~
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: Edit multiple models in the same page: possible?

2009-01-03 Thread thatsgreat2345

Use Ajax?

On Jan 3, 4:07 pm, Jaime ja...@iteisa.com wrote:
 Hi all,

 I wonder if it's possible to have two different forms for two
 different (but related) models in the same page.

 Imagine a page where the logged in user can edit his profile (model
 Profile) as well as to add a photo into his gallery (model Image).

 ?php echo $form-create('Profile'); ?
 ...

 ?php echo $form-create('Image'); ?
 ...

 The problem here is that after submiting one of the forms, the user is
 redirected to /model/edit/, and not back to the current page.

 I cannot imagine how to fit both forms in the same page without
 loosing the validationErrors info.

 Any clue?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



storing user_ids

2009-01-03 Thread ymadh

I want to have the logged in user information stored with each
record.  Is there a way to set this on the controller or do I have to
rely on hidden fields in the views?

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

2009-01-03 Thread Steven Wright

Well here is one example. What are the options for this particular method?

Return JavaScript text for an observer...

Parameters:
string  $klass Name of JavaScript class
string  $name
array   $options Ajax options

Returns:
string Formatted JavaScript 

Definition at line 864 of file ajax.php.

References remoteFunction(), and Helper::value().

Referenced by observeField(), and observeForm().


 On php.net all the functions are very well documented for instance it's
immediately clear what this function does and what it's parameters do and
what they are.

http://us.php.net/manual/en/function.mysql-affected-rows.php











-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of mark_story
Sent: Saturday, January 03, 2009 6:59 PM
To: CakePHP
Subject: Re: API


Its not bitching if you are willing to point out where the problems are and
perhaps offer some solutions to those problems.  That's called contributing
in my books.  As for the API it is automatically generated via doxygen.  But
just because it is auto generated means it should be poor.  So again, some
places where you think the API is weak would help as you are probably not
the only person who has experienced issues with it.

-Mark

On Jan 3, 3:47 pm, Steven Wright rhythmicde...@gmail.com wrote:
 Yeah. I am pretty sure the docs are auto created probably like Java Doc.
 But I cant really bitch too much about what is essentially a free
framework.

 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
 Behalf

 Of brian
 Sent: Saturday, January 03, 2009 3:43 PM
 To: cake-php@googlegroups.com
 Subject: Re: API

 On Sat, Jan 3, 2009 at 3:18 PM, rhythmicde...@gmail.com 
 rhythmicde...@gmail.com wrote:

  Ahh I dont want to be all whiny about it :)

  Essentially if there are options the options should be listed.

 Agreed. The API docs are a misery to wade through at times. Especially 
 for figuring out things like $options.

 It'd also be nice if there were a few comment blocks *within* some of 
 the class methods. I do realise that that wouldn't be trivial to deal 
 with, though.


--~--~-~--~~~---~--~~
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: Deleting from multiple models

2009-01-03 Thread Steven Wright

Thank you.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Alexandru
Sent: Saturday, January 03, 2009 7:42 PM
To: CakePHP
Subject: Re: Deleting from multiple models


yes it is. check http://book.cakephp.org/view/80/hasOne for dependent key
dependent: When the dependent key is set to true, and the model’s
delete() method is called with the cascade parameter set to true, associated
model records are also deleted. In this case we set it true so that deleting
a User will also delete her associated Profile.

On Jan 3, 9:56 pm, rhythmicde...@gmail.com rhythmicde...@gmail.com
wrote:
 I have a model Recipe that has a one to many relationship with a model 
 IngredientList

 I want to delete a single recipe from the Recipe model which should 
 also delete all the records from the IngredientList model that have 
 the recipe's ID.

 I would have thought that there would be a single line command like 
 there is for insert.

 if ($this-Recipe-saveAll($this-data))

 But this is only way I could find to do it:

         function delete($id)
         {
                 
 $this-IngredientList-deleteAll(IngredientList.recipe_id = $id, 
 true);
                 $this-Recipe-del($id);
                 $this-flash('The recipe with id: '.$id.' has been 
 deleted.', '/ recipes');
         }


--~--~-~--~~~---~--~~
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: storing user_ids

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 8:18 PM, ymadh ad...@dogtrainersearch.com wrote:

 I want to have the logged in user information stored with each
 record.  Is there a way to set this on the controller or do I have to
 rely on hidden fields in the views?


Each record of what? Is there a user_id column in the table? Is the
User model associated with 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: storing user_ids

2009-01-03 Thread ymadh

Each record of the associated tables. So if a client is created under
a logged in user, I want it to autopopulate the db with user_id which
is in the session.  That way each user only sees their clients..make
sense? My client table would have client info, and of course a user_id
field.

I didn't link the models ... Would that create extra overhead on every
page that needs that user_id field??

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: storing user_ids

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 9:02 PM, ymadh ad...@dogtrainersearch.com wrote:

 Each record of the associated tables. So if a client is created under
 a logged in user, I want it to autopopulate the db with user_id which
 is in the session.  That way each user only sees their clients..make
 sense? My client table would have client info, and of course a user_id
 field.

 I didn't link the models ... Would that create extra overhead on every
 page that needs that user_id field??

If you have a user_id column in a model's table, then you should
associated it with the User model. That way, you'll have to do very
little to store it.

In your view, you can add a hidden field:

echo $form-hidden('User.id', array('value' = $session-read('User.id')));

That will give your controller a $data array something along these lines:

array(
'YourModel' = array(
'some field' = 'some value',
...
),
'User' = array(
'id' = 42
)
)

That presupposes that only logged-in users will use that form. And,
again, that this model is properly associated with User.

As for overhead, you can use the ContainableBehavior to adjust what
Cake queries the DB for.

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



saving to habtm models from checkbox groups.

2009-01-03 Thread mike

I posted about this earlier but I'm still having trouble.  I think I
have my models set up properly now:

class User extends AppModel
{
var $name = 'User';
var $hasAndBelongsToMany = array ( 'Ethnicity' = array(
'className'= 'Ethnicity',
'joinTable' =
'ethnicities_users',
'foreignKey'= 'user_id',
'associationForeignKey' =
'ethnicity_id'
)
);
}


class Ethnicity extends AppModel
{
var $name = 'Ethnicity';
var $hasAndBelongsToMany = array ( 'User' = array(
'className'= 'User',
'joinTable' =
'ethnicities_users',
'foreignKey'= 'ethnicity_id',
'associationForeignKey' = 'user_id'
)
);
}

I've been trying different stuff in the controller, this is what I
have now:
function add() {
$this-User-create();
if(!empty($this-data)) {
if($this-User-save($this-data)) {
$this-data['User']['Ethnicity']['user_id'] = 
$this-User-
getLastInsertId();
$this-User-Ethnicity-save($this-data);
$this-Session-setFlash(User Saved!);
}
}
}

here is what I have in the view, which I don't think is correct:

? echo $form-create('User', array('action'='add')); ?
? echo $form-input('User.Ethnicity', array( 'type' = 'select',
'multiple' = 'checkbox' ),$ethnicities); ?
?php echo $form-end('Submit'); ?br/

form the research I've done, I feel like the input fieldname should be
'User.Ethnicity. .id' or something like that.  However, anytime I add
the 'id' into the fieldname, the checkboxes don't get created in the
html anymore.  here's how $ethnicities is populated in the controller,
if that matters:

$this-set('ethnicities',$this-Ethnicity-find('list', array('fields'
= array('id','ethnicityName';

the result right now is this:

[data] = Array
(
[User] = Array
(
[Ethnicity] = Array
(
[0] = 1
[1] = 3
[user_id] = 34
)

[age] = 50
[about_me] = sadfadfs
)

)

but my understanding is I need something like this:
[data] = Array
(
[User] = Array
(
[Ethnicity] = Array
(
[ethnicity_id] = 1
[user_id] = 34,

[ethnicity_id] = 2
[user_id] = 34
)

[age] = 50
[about_me] = sadfadfs
)

)


here is a link to my other thread for reference:

http://groups.google.com/group/cake-php/browse_thread/thread/2c74ee5184fe8d90/62788d3299b36a31?lnk=gstq=checkbox+groups#62788d3299b36a31

any help apprciated. 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: Adding table row with AJAX

2009-01-03 Thread rhythmicde...@gmail.com

Hi Brian,
I was wondering if you had an answer to this issue I am having. I dont
understand the error, or why the data is not appending.

Thanks.



On Jan 3, 9:43 am, Steven Wright rhythmicde...@gmail.com wrote:
 Thanks for the reply. This is mostly working but there is something I am
 still missing.

 I tried two different things.

 1) If I call the 'edit' action I get a jQuery error ( 'div is null' ' elem =
 jQuery.makeArray( div.childNodes ); ')
 I am not sure what div its looking for. The second problem with that is that
 although I can see thetablerowreturned at the start of the response
 string the rest of the content for the view is also returned and I don't
 know why.

 2) If I call the 'add_ingredient_row' action I only get the content for the
 view in the response but no newrow.

 So two questions:
 1) Why is CakePHP returning all the content for the view?
 2) Why is jQuery giving me that error?

 Thanks again. If I can just get over this hurdle I will be off and running.

 VIEW

 h2Testing AJAX with CakePHP and Prototype and Scriptaculous/h2

 tableid=the_table
         tr id=row1
                 tdRow1/td
         /tr
 /table

 div id=mydiv
 This is a div
 /div

 div id=the_buttonClick/div

 CONTROLLER

 class AjaxtestsController extends AppController
 {

         var $components = array( 'RequestHandler' );

         function index()
         {
                 $this-pageTitle = 'Index Page';
         }

         function view()
         {
                 $this-pageTitle = 'View Page';
         }

         function edit()
         {
                 $this-pageTitle = 'Edit Page';
                 if($this-RequestHandler-isAjax())
                 {
                         $this-layout = 'ajax';
                         echo 'trtdThis is arow/td/tr';

                 }
         }

         function add_ingredient_row()
         {
                 echo 'trtdThis is arow/td/tr';

         }

 }

 JAVASCRIPT

 $(document).ready(function()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: 'add_ingredient_row/',
                         type: 'GET',
                         data: 'data string',
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                                 alert('There has been an error');
                         },
                         success: function(msg)
                         {
                                 //alert(msg);
                                 $('#the_table').append(msg);
                         }
                 }); // ends ajax
         }); // ends click

 }); // ends document.ready
 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf

 Of brian
 Sent: Friday, January 02, 2009 8:26 PM
 To: cake-php@googlegroups.com
 Subject: Re:Addingtablerowwith AJAX

 On Fri, Jan 2, 2009 at 7:45 PM, Steven Wright rhythmicde...@gmail.com
 wrote:

  Hi Adam,
  Thanks for writing back. How would you get the data back for therow
  from CakePHP?

  Myrowcontains four columns with the following inputs:

  amount [text]
  measurement_type [select]
  description [text]
  ingredient [select]

  This is normally rendered from an element as atablerow. I would like
  the output of that element appended to mytable.  So on the button
  click I call the action add_ingredient_row and it should return the
  content of the element. How do I get that content appended to mytable.

  I can do this without CakePHP. But for me this exercise is to use the
  framework.

 Being a jQuery user, I never bother with Cake's ajax() stuff. But jQuery is
 dead simple (mostly) to use, so I don't mind having to write out a few lines
 of JS. To do what you describe, I'd do something like
 this:

 $(document).ready()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: the_href,
                         type: 'GET',
                         data: the_data,
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                         },
                         success: function(msg)
                         {
                                 /* assuming your controller is returning
 'tr.../tr'
                                  */
                                 $('#the_table').append(msg);
                         }
                 });
         });
 });
--~--~-~--~~~---~--~~
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 

RE: Adding table row with AJAX

2009-01-03 Thread Steven Wright

In addition, just to prove I am not a complete dope. I get how this works,
just not with CakePHP.

AJAX_TEST.PHP

?php

$row_count = ($_POST['row_count'] + 1);

echo tr id=\row$row_count\tdContent for row $row_count/td/tr;

?


AJAX_TEST.HTML

html
head
title/title
script type=text/javascript src=javascript/jquery-1.2.6.js/script
script type=text/javascript
$(document).ready(function()
{
$('#button').click(function()
{
$.ajax({
url: 'ajax_test.php',
type: 'POST',
data: row_count= +
document.getElementById('mytable').rows.length,
dataType: 'html',
timeout: 2000,
error: function(XMLHttpRequest, textStatus,
errorThrown)
{
// ...
alert('There has been an error');
},
success: function(msg)
{
//alert(msg);
$('#mytable').append(msg);
}
}); // ends ajax
}); // ends click 
}); // ends document.ready
/script
head
body

table id=mytable
tr id=row1 
tdContent for row 1/td
/tr
/table

div id=buttonClick/div

/body
/html 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of rhythmicde...@gmail.com
Sent: Saturday, January 03, 2009 9:45 PM
To: CakePHP
Subject: Re: Adding table row with AJAX


Hi Brian,
I was wondering if you had an answer to this issue I am having. I dont
understand the error, or why the data is not appending.

Thanks.



On Jan 3, 9:43 am, Steven Wright rhythmicde...@gmail.com wrote:
 Thanks for the reply. This is mostly working but there is something I 
 am still missing.

 I tried two different things.

 1) If I call the 'edit' action I get a jQuery error ( 'div is null' ' 
 elem = jQuery.makeArray( div.childNodes ); ') I am not sure what div 
 its looking for. The second problem with that is that although I can 
 see thetablerowreturned at the start of the response string the rest 
 of the content for the view is also returned and I don't know why.

 2) If I call the 'add_ingredient_row' action I only get the content 
 for the view in the response but no newrow.

 So two questions:
 1) Why is CakePHP returning all the content for the view?
 2) Why is jQuery giving me that error?

 Thanks again. If I can just get over this hurdle I will be off and
running.

 VIEW

 h2Testing AJAX with CakePHP and Prototype and Scriptaculous/h2

 tableid=the_table
         tr id=row1
                 tdRow1/td
         /tr
 /table

 div id=mydiv
 This is a div
 /div

 div id=the_buttonClick/div

 CONTROLLER

 class AjaxtestsController extends AppController {

         var $components = array( 'RequestHandler' );

         function index()
         {
                 $this-pageTitle = 'Index Page';
         }

         function view()
         {
                 $this-pageTitle = 'View Page';
         }

         function edit()
         {
                 $this-pageTitle = 'Edit Page';
                 if($this-RequestHandler-isAjax())
                 {
                         $this-layout = 'ajax';
                         echo 'trtdThis is arow/td/tr';

                 }
         }

         function add_ingredient_row()
         {
                 echo 'trtdThis is arow/td/tr';

         }

 }

 JAVASCRIPT

 $(document).ready(function()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: 'add_ingredient_row/',
                         type: 'GET',
                         data: 'data string',
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                                 alert('There has been an error');
                         },
                         success: function(msg)
                         {
                                 //alert(msg);
                                 $('#the_table').append(msg);
                         }
                 }); // ends ajax
         }); // ends click

 }); // ends document.ready
 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
 Behalf

 Of brian
 Sent: Friday, January 02, 2009 8:26 PM
 To: cake-php@googlegroups.com
 Subject: Re:Addingtablerowwith AJAX

 On Fri, Jan 2, 2009 at 7:45 PM, Steven Wright 
 rhythmicde...@gmail.com
 wrote:

  Hi Adam,
  Thanks for writing back. How would you get the data back for therow 
  from CakePHP?

  Myrowcontains four columns with the following inputs:

  amount [text]
  measurement_type [select]
  description 

HABTM retrieving help

2009-01-03 Thread gearvOsh

Heres my tables and relations:

Team
Team-belongsTo: Country, State
Team-hasAndBelongsToMany: User (the players on a team, table =
teams_players)

Team:
CREATE TABLE IF NOT EXISTS `teams` (
  `id` int(10) NOT NULL auto_increment,
  `status` enum('approved','pending') NOT NULL default 'pending',
  `name` varchar(50) NOT NULL,
  `tag` varchar(10) NOT NULL,
  `urlName` varchar(30) NOT NULL,
  `website` varchar(50) NOT NULL,
  `irc` varchar(20) NOT NULL,
  `about` varchar(255) NOT NULL,
  `servers` varchar(100) NOT NULL,
  `logo` varchar(100) NOT NULL,
  `createDate` int(10) unsigned NOT NULL default '0',
  `state_id` int(10) unsigned NOT NULL default '0',
  `country_id` int(10) unsigned NOT NULL default '0',
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`),
  KEY `state_id` (`state_id`),
  KEY `country_id` (`country_id`)
)

TeamsPlayer
CREATE TABLE IF NOT EXISTS `teams_players` (
  `id` int(11) NOT NULL auto_increment,
  `team_id` int(10) unsigned NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `role` enum('leader','captain','member') NOT NULL default 'member',
  `status` enum('approved','pending') NOT NULL default 'pending',
  `joinDate` int(10) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `team_id` (`team_id`),
  KEY `user_id` (`user_id`)
)


Ok if I do a basic Team-find() all the data is returned correctly.

Now the problem im running into is how do I grab all teams that I am
part of, and paginate it at the same time? Since the user_id values is
in TeamsPlayer, im getting confused on this. Any help would be
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Adding table row with AJAX

2009-01-03 Thread Steven Wright

One way that I found to make this work is to use a dummy.ctp file which is
empty. Then I set the debug level to 0 to suppress all output from CakePHP.
I then get just output I need. The use of a dummy file seems like a hack
workaround to me though but at this point I don’t have a better option.


 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of rhythmicde...@gmail.com
Sent: Saturday, January 03, 2009 9:45 PM
To: CakePHP
Subject: Re: Adding table row with AJAX


Hi Brian,
I was wondering if you had an answer to this issue I am having. I dont
understand the error, or why the data is not appending.

Thanks.



On Jan 3, 9:43 am, Steven Wright rhythmicde...@gmail.com wrote:
 Thanks for the reply. This is mostly working but there is something I 
 am still missing.

 I tried two different things.

 1) If I call the 'edit' action I get a jQuery error ( 'div is null' ' 
 elem = jQuery.makeArray( div.childNodes ); ') I am not sure what div 
 its looking for. The second problem with that is that although I can 
 see thetablerowreturned at the start of the response string the rest 
 of the content for the view is also returned and I don't know why.

 2) If I call the 'add_ingredient_row' action I only get the content 
 for the view in the response but no newrow.

 So two questions:
 1) Why is CakePHP returning all the content for the view?
 2) Why is jQuery giving me that error?

 Thanks again. If I can just get over this hurdle I will be off and
running.

 VIEW

 h2Testing AJAX with CakePHP and Prototype and Scriptaculous/h2

 tableid=the_table
         tr id=row1
                 tdRow1/td
         /tr
 /table

 div id=mydiv
 This is a div
 /div

 div id=the_buttonClick/div

 CONTROLLER

 class AjaxtestsController extends AppController {

         var $components = array( 'RequestHandler' );

         function index()
         {
                 $this-pageTitle = 'Index Page';
         }

         function view()
         {
                 $this-pageTitle = 'View Page';
         }

         function edit()
         {
                 $this-pageTitle = 'Edit Page';
                 if($this-RequestHandler-isAjax())
                 {
                         $this-layout = 'ajax';
                         echo 'trtdThis is arow/td/tr';

                 }
         }

         function add_ingredient_row()
         {
                 echo 'trtdThis is arow/td/tr';

         }

 }

 JAVASCRIPT

 $(document).ready(function()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: 'add_ingredient_row/',
                         type: 'GET',
                         data: 'data string',
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                                 alert('There has been an error');
                         },
                         success: function(msg)
                         {
                                 //alert(msg);
                                 $('#the_table').append(msg);
                         }
                 }); // ends ajax
         }); // ends click

 }); // ends document.ready
 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
 Behalf

 Of brian
 Sent: Friday, January 02, 2009 8:26 PM
 To: cake-php@googlegroups.com
 Subject: Re:Addingtablerowwith AJAX

 On Fri, Jan 2, 2009 at 7:45 PM, Steven Wright 
 rhythmicde...@gmail.com
 wrote:

  Hi Adam,
  Thanks for writing back. How would you get the data back for therow 
  from CakePHP?

  Myrowcontains four columns with the following inputs:

  amount [text]
  measurement_type [select]
  description [text]
  ingredient [select]

  This is normally rendered from an element as atablerow. I would like 
  the output of that element appended to mytable.  So on the button 
  click I call the action add_ingredient_row and it should return the 
  content of the element. How do I get that content appended to mytable.

  I can do this without CakePHP. But for me this exercise is to use 
  the framework.

 Being a jQuery user, I never bother with Cake's ajax() stuff. But 
 jQuery is dead simple (mostly) to use, so I don't mind having to write 
 out a few lines of JS. To do what you describe, I'd do something like
 this:

 $(document).ready()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: the_href,
                         type: 'GET',
                         data: the_data,
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                         },

RE: Adding table row with AJAX

2009-01-03 Thread Steven Wright

Actually this works in place of the dummy file

$this-autoRender = false; 
 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of rhythmicde...@gmail.com
Sent: Saturday, January 03, 2009 9:45 PM
To: CakePHP
Subject: Re: Adding table row with AJAX


Hi Brian,
I was wondering if you had an answer to this issue I am having. I dont
understand the error, or why the data is not appending.

Thanks.



On Jan 3, 9:43 am, Steven Wright rhythmicde...@gmail.com wrote:
 Thanks for the reply. This is mostly working but there is something I 
 am still missing.

 I tried two different things.

 1) If I call the 'edit' action I get a jQuery error ( 'div is null' ' 
 elem = jQuery.makeArray( div.childNodes ); ') I am not sure what div 
 its looking for. The second problem with that is that although I can 
 see thetablerowreturned at the start of the response string the rest 
 of the content for the view is also returned and I don't know why.

 2) If I call the 'add_ingredient_row' action I only get the content 
 for the view in the response but no newrow.

 So two questions:
 1) Why is CakePHP returning all the content for the view?
 2) Why is jQuery giving me that error?

 Thanks again. If I can just get over this hurdle I will be off and
running.

 VIEW

 h2Testing AJAX with CakePHP and Prototype and Scriptaculous/h2

 tableid=the_table
         tr id=row1
                 tdRow1/td
         /tr
 /table

 div id=mydiv
 This is a div
 /div

 div id=the_buttonClick/div

 CONTROLLER

 class AjaxtestsController extends AppController {

         var $components = array( 'RequestHandler' );

         function index()
         {
                 $this-pageTitle = 'Index Page';
         }

         function view()
         {
                 $this-pageTitle = 'View Page';
         }

         function edit()
         {
                 $this-pageTitle = 'Edit Page';
                 if($this-RequestHandler-isAjax())
                 {
                         $this-layout = 'ajax';
                         echo 'trtdThis is arow/td/tr';

                 }
         }

         function add_ingredient_row()
         {
                 echo 'trtdThis is arow/td/tr';

         }

 }

 JAVASCRIPT

 $(document).ready(function()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: 'add_ingredient_row/',
                         type: 'GET',
                         data: 'data string',
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                                 alert('There has been an error');
                         },
                         success: function(msg)
                         {
                                 //alert(msg);
                                 $('#the_table').append(msg);
                         }
                 }); // ends ajax
         }); // ends click

 }); // ends document.ready
 -Original Message-
 From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
 Behalf

 Of brian
 Sent: Friday, January 02, 2009 8:26 PM
 To: cake-php@googlegroups.com
 Subject: Re:Addingtablerowwith AJAX

 On Fri, Jan 2, 2009 at 7:45 PM, Steven Wright 
 rhythmicde...@gmail.com
 wrote:

  Hi Adam,
  Thanks for writing back. How would you get the data back for therow 
  from CakePHP?

  Myrowcontains four columns with the following inputs:

  amount [text]
  measurement_type [select]
  description [text]
  ingredient [select]

  This is normally rendered from an element as atablerow. I would like 
  the output of that element appended to mytable.  So on the button 
  click I call the action add_ingredient_row and it should return the 
  content of the element. How do I get that content appended to mytable.

  I can do this without CakePHP. But for me this exercise is to use 
  the framework.

 Being a jQuery user, I never bother with Cake's ajax() stuff. But 
 jQuery is dead simple (mostly) to use, so I don't mind having to write 
 out a few lines of JS. To do what you describe, I'd do something like
 this:

 $(document).ready()
 {
         $('#the_button').click(function()
         {
                 $.ajax({
                         url: the_href,
                         type: 'GET',
                         data: the_data,
                         dataType: 'html',
                         timeout: 2000,
                         error: function(XMLHttpRequest, textStatus,
 errorThrown)
                         {
                                 // ...
                         },
                         success: function(msg)
                         {
                                 /* assuming your controller is 
 returning 'tr.../tr'
                                  */
                        

Re: in the class of [MailsController] use the [$this-User-create()]

2009-01-03 Thread Rimoe
var $uses = array('Mail','User');

2009/1/4 Rimoe meiyo...@gmail.com

 hi,everyone.
 in the  class of [MailsController]
 we can use the [$this-Mail-create();]
 but I want to use the [$this-User-create();]

 what should I do?
 It's possible?

 rimoe


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



Auth Broken.

2009-01-03 Thread Matt Williamson

Hey Guys,

I am trying to use the Auth component, but I'm pretty sure there's
some bug preventing me from doing so. Here is what my
app_controller.php looks like:

?php
class AppController extends Controller {
var $components = array('Auth');

function beforeFilter(){
$this-Auth-allow('*');
$this-Auth-logoutRedirect = '/';
$this-Auth-loginRedirect = '/';
$this-Auth-authorize = 'controller';
}

function isAuthorized(){
die('isAuthorized Called!');
}
}
?

Whenever I browse to a view, I get redirected to the login page. I'd
expect the behavior to allow access to the view or at least the string
'isAuthorized Called!' to be printed, but it seems the isAuthorized
method is never called. The following works, though:

$this-Auth-allowedActions = array('*');

I am using PHP4 on XAMPP/Windows.

Can someone try to reproduce and/or tell me what I'm doing wrong?



Thanks,

Matt

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



Return compressed XML

2009-01-03 Thread ace2600

Hi,

I want to return unique compressed XML for each user request.
Something like this in the controller:

public function download()
{
$filename = 'some_temporary_file_name.gz';
$this-view = 'Media';
$params = array(
  'id' = $filename,
  'name' = 'some_temporary_file_name',
  'download' = true,
  'extension' = 'gz',
  'path' = ''
);

// open file for writing with maximum compression
$zp = gzopen($filename, w9);
// write string to file
gzwrite($zp, $unique_xml_here);
// close file
gzclose($zp);
}

How can I create a unique file for each request and have the file be
deleted after the user downloaded it? I'm mostly concerned with the
deleting part unless there is a convenient CakePHP for the unique file
part.

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



'php' is not recognized as an internal or external command, operable program or batch file'

2009-01-03 Thread amar goud
 Hi All,

If I run *php -v* command to know php version on command line,
it shows error like
'php' is not recognized as an internal or external command, operable program
or batch file'

what does this error means?
I'm using xampp server on windows-xp(service pack-3);

please help me




 --

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



Re: Auth Broken.

2009-01-03 Thread Matt Williamson
P.S. I'm using release 1.2.0.7962.

On Sun, Jan 4, 2009 at 1:14 AM, Matt Williamson dawsdes...@gmail.comwrote:

 Hey Guys,

 I am trying to use the Auth component, but I'm pretty sure there's
 some bug preventing me from doing so. Here is what my
 app_controller.php looks like:

 ?php
 class AppController extends Controller {
var $components = array('Auth');

function beforeFilter(){
$this-Auth-allow('*');
$this-Auth-logoutRedirect = '/';
$this-Auth-loginRedirect = '/';
$this-Auth-authorize = 'controller';
}

function isAuthorized(){
die('isAuthorized Called!');
}
 }
 ?

 Whenever I browse to a view, I get redirected to the login page. I'd
 expect the behavior to allow access to the view or at least the string
 'isAuthorized Called!' to be printed, but it seems the isAuthorized
 method is never called. The following works, though:

 $this-Auth-allowedActions = array('*');

 I am using PHP4 on XAMPP/Windows.

 Can someone try to reproduce and/or tell me what I'm doing wrong?



 Thanks,

 Matt

--~--~-~--~~~---~--~~
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: saveField with out modifying 'modified'

2009-01-03 Thread brian

On Sun, Jan 4, 2009 at 1:07 AM, Sergei yatse...@gmail.com wrote:

 Yes, this sucks. I had to read OLD modified date, and save it using
 save(data[] array with modified). I did this in cake1.1.

I also just noticed that my last_login field is set on add(). Argghhh!

--~--~-~--~~~---~--~~
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: Adding table row with AJAX

2009-01-03 Thread brian

On Sat, Jan 3, 2009 at 10:05 PM, Steven Wright rhythmicde...@gmail.com wrote:

 In addition, just to prove I am not a complete dope. I get how this works,
 just not with CakePHP.

 AJAX_TEST.PHP

 ?php

 $row_count = ($_POST['row_count'] + 1);

 echo tr id=\row$row_count\tdContent for row $row_count/td/tr;

 ?

With Cake, you'd find the row_count value in $this-params['url']['row_count']

Debugger::dump($this-params);

or

debug($this-params);

or pr() or anything else to get a look at that array.

--~--~-~--~~~---~--~~
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: 'php' is not recognized as an internal or external command, operable program or batch file'

2009-01-03 Thread park

You should set \xampp\php in the path environment variable.

On Jan 4, 2:49 pm, amar goud amardeen...@gmail.com wrote:
  Hi All,

 If I run *php -v* command to know php version on command line,
 it shows error like
 'php' is not recognized as an internal or external command, operable program
 or batch file'

 what does this error means?
 I'm using xampp server on windows-xp(service pack-3);

 please help me

 

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