Re: afterFind() dillemna - eats memory for breakfast

2008-01-17 Thread AD7six



On Jan 18, 3:52 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> cake 1.2.0.6311-beta, PHP 5.2.4
>
> I'm trying to use afterFind() in order to massage some data for a
> model and am seeing PHP max out the memory limit (32MB). I'm only
> using a subset of just 1000 records (about 5%) from the prod. DB
> membership table. I'm using a technique that I saw given to create a
> "full_name" field in the returned array by concating the first & last
> names. In my case, I'm running urlencode()  on the members' names to
> create a new field, among other things.
>
> Part of the problem is that the fields i'm looking for might lie at
> any of a number of levels, depending on whether i'm viewing a single
> record or selecting many. So I have to do stuff lik this:
>
> function afterFind($results)
> {
> if (isset($results['id']))
> {
> ...
> return $results;
> }
>
> foreach ($results as $key => $val)
> {
> if(array_key_exists($this->name, $val) && 
> isset($results[$key][$this->name]['id']))
>
> {
> ...
> }
> else if (isset($results[$key]['id']))
> {
> ...
> }
> }
> return $results;
>
> }
>
> Selecting 1000 records ate through memory pretty quick, so I limited
> the fields to just id, first_name, last_name, organisation, and email
> to start  with.
>
> However, even with just those fields selected, I was still running out
> of memory. It turned out that it was the methods I was passing my
> array values to in order to create new fields. eg:
>
> $results['link_name'] = $this->linkName($result['first_name'],
> $results['last_name']);
>
> where linkName() is just:
>
> return urlencode("${first_name}_${last_name}");
>
> By taking out the method calls and repeating the same logic at each
> level I was finally able to run this. However, now I'm finding that
> afterFind() is called for every little query, including just looking
> up an ID. So now I'm faced with placing even more logic in afterFind()
> -- not a great prospect.
>
> So, as the subject suggests, I was poking around the Set class trying
> to figure out if there was some way to use that for this problem. But
> I can't think of anything that wouldn't likely cause even more memory
> issues.
>
> Basically, I'm not even sure if I'm going about this the right way. Is
> this an appropriate way to use afterind()? Is there a simpler way to
> get at my Member data, no matter if it's just a single record or many?

32MB of memory is a bit stingy.

How about
1) delete your afterFind method
2) include "CONCAT(". $model->escapeField('first_name').','.$model-
>escapeField('last_name').') AS full_name'"
3) look for $result[0]['full_name'] instead of $result['User']
['first_name'] etc.
4) url_encode where you need it (in the view)

Alternatively, to use the set class to do it would be something like:
$keyPath = '{n}.User.id';
$valuePath = array('{0} {1}', '{n}.User.first_name',
'{n}.User.last_name');
$results = Set::combine($results, $keyPath, $valuePath);

hth,

AD

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



Re: alphaNumeric validation in cakephp 1.2.0.6311-beta

2008-01-17 Thread AD7six



On Jan 18, 3:39 am, Rajesh <[EMAIL PROTECTED]> wrote:
> I have a field called comment which is of type text in db. And i have
> the validation rule as alphaNumeric, required=true and message=>'some
> message' in the model. The field is rendered as text area. Now if i
> enter the value of comment as "sometext", this works fine and gets
> stored in db, but when i enter the value as "some text" (note - the
> space between 2 words), it throws the validation message and the data
> is not saved.
> Am i missing something ?

A space isn't alpha numeric afaik.

hth,

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



dAuth v0.3

2008-01-17 Thread volve

Hey all,

I'm trying to get dAuth v0.3 working but am constantly presented with
"Login failed: Credentials mismatch.". I added a slew of debug output
to the component and sure enough my password hash and the one
submitted are completely different.

Some log_debug output from a login attempt:

2008-01-17 22:37:57 Debug: dAuthComponent attemptLogin...
2008-01-17 22:37:57 Debug: clean host...
2008-01-17 22:37:57 Debug: username and password present...
2008-01-17 22:37:57 Debug: username found in database...
2008-01-17 22:37:57 Debug: clear text = false...
2008-01-17 22:37:57 Debug: password hash:
[7025cd2543c0f3a446487c973a124d0b25daa753] submitted hash:
[fcb55b0e784e713ec1116766ffac3e75a833bcda]
2008-01-17 22:37:57 Debug: hashed password compare failed...

Thinking maybe it was some stale user accounts, I went through the
dAuth Users/register action again and that was successful. I also
checked my files for copy-n-paste whitespace that might cause header
issues but couldn't find any.

I realize I may be behind the times on implementing dAuth but I hope
someone else has resolved this. :)

Thanks!
-volve

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



i don't know why

2008-01-17 Thread allenxie

Missing controller

You are seeing this error because controller CakeController could not
be found.

Notice: If you want to customize this error message, create app\views/
errors/missing_controller.thtml.

Fatal: Create the class below in file : app\controllers
\cake_controller.php

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



alphaNumeric validation in cakephp 1.2.0.6311-beta

2008-01-17 Thread Rajesh

I have a field called comment which is of type text in db. And i have
the validation rule as alphaNumeric, required=true and message=>'some
message' in the model. The field is rendered as text area. Now if i
enter the value of comment as "sometext", this works fine and gets
stored in db, but when i enter the value as "some text" (note - the
space between 2 words), it throws the validation message and the data
is not saved.
Am i missing something ?

I am using cakephp version 1.2.0.6311-beta.

Thanks

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



Re: Auth Component encrypting password before validation.

2008-01-17 Thread nate

No.  Disabling password hashing is Evil with a capital "E".  That's
why I don't let you do it.

On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
> Thanks to both of you, I thought of this, but I thought it would be
> easier to disable the AuthComponent::hashPasswords and then do what
> Baz did above.
>
> Anyways thanks again for the help.
>
> -Andrew
>
> On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > Yep,
>
> > Use a different field, eg. new_password or something. (I'm assuming
> > you're validating when creating a password. No need for login)
>
> > Here's assuming you have a model called User:
>
> > // needed for validation for some reason
> > $this->User->set($this->data);
> > if ($this->validates($this->data))
> > {
> >     $this->data['User']['passwd'] =
> > $this->Auth->password($this->data['User']['new_passwd'] )
>
> >     // all we did was hash passwords, no need to revalidate.
> >     if ($this->save($this->data, false))
> >     {
> >         //    do stuff
> >     } else
> >     {
> >         // invalid
> >     }
>
> > }
>
> > Would be nice to stick this is beforeSave in the model, but you can't
> > [easily] access the Auth component from the model.
>
> > Hope this helps.
>
> > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I am using the auth component and before my model can validate the
> > > password the auth component already encrypts the password so making it
> > > impossible to use the between built in valid method.
>
> > > Is there any work around for this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax help

2008-01-17 Thread jenson


Hello guys,

I need help regarding ajax with cake php ..I Can't really get a nice tutorial.. 
tutorial
has expired(http://grahambird.co.uk/cake/tutorials/ajax.php) and the place 
where this
page takes me is bit advanced for me. Can some one refer some other link?

with regards,
jenson rajan.A

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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



Re: afterFind() dillemna - eats memory for breakfast

2008-01-17 Thread b logica

On Jan 17, 2008 9:52 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> cake 1.2.0.6311-beta, PHP 5.2.4
>
> I'm trying to use afterFind() in order to massage some data for a
> model and am seeing PHP max out the memory limit (32MB). I'm only
> using a subset of just 1000 records (about 5%) from the prod. DB
> membership table. I'm using a technique that I saw given to create a
> "full_name" field in the returned array by concating the first & last
> names. In my case, I'm running urlencode()  on the members' names to
> create a new field, among other things.
>
> Part of the problem is that the fields i'm looking for might lie at
> any of a number of levels, depending on whether i'm viewing a single
> record or selecting many. So I have to do stuff lik this:
>
> function afterFind($results)
> {
> if (isset($results['id']))
> {
> ...
> return $results;
> }
>
> foreach ($results as $key => $val)
> {
> if(array_key_exists($this->name, $val) && 
> isset($results[$key][$this-
> >name]['id']))
> {
> ...
> }
> else if (isset($results[$key]['id']))
> {
> ...
> }
> }
> return $results;
> }
>
> Selecting 1000 records ate through memory pretty quick, so I limited
> the fields to just id, first_name, last_name, organisation, and email
> to start  with.
>
> However, even with just those fields selected, I was still running out
> of memory. It turned out that it was the methods I was passing my
> array values to in order to create new fields. eg:
>
> $results['link_name'] = $this->linkName($result['first_name'],
> $results['last_name']);
>
> where linkName() is just:
>
> return urlencode("${first_name}_${last_name}");
>
> By taking out the method calls and repeating the same logic at each
> level I was finally able to run this. However, now I'm finding that
> afterFind() is called for every little query, including just looking
> up an ID. So now I'm faced with placing even more logic in afterFind()
> -- not a great prospect.
>
> So, as the subject suggests, I was poking around the Set class trying
> to figure out if there was some way to use that for this problem. But
> I can't think of anything that wouldn't likely cause even more memory
> issues.
>
> Basically, I'm not even sure if I'm going about this the right way. Is
> this an appropriate way to use afterind()? Is there a simpler way to
> get at my Member data, no matter if it's just a single record or many?
>
> b
>
>

Bah! I was passing by value. OK, so I've changed it to:

function afterFind(&$results)
{
if (isset($results['first_name']))
{
$results['link_name'] = 
Member::makeLinkName($results['first_name'],
$results['last_name']);
...
return $results;
}

foreach ($results as $key => $val)
{
...
}
return $results;
}

This allows me to avoid repeating a chunk of code, at least. But I'm
still not confident that this is the best way to go about using
afterFind(). I just came across this Autofield behavior:

http://cakeexplorer.wordpress.com/category/model/

I'm going to play around with that a bit.

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



Re: Saving model without saving associated models

2008-01-17 Thread Tim Wild

Thanks for the idea Chris. I've looked at this -> data in my debugger 
and there's no associated data, so clearing it wouldn't make any difference.

After just getting my debugger working (which is far harder than it is 
in any other language) I can see the problem's caused by an error I made 
writing my view, with field names, so i've now solved this problem. I'd 
still be interested to hear if anyone has thoughts on the subject though :)

Thanks

Tim

Chris Hartjes wrote:
> On Jan 17, 2008 6:36 PM, Tim W <[EMAIL PROTECTED]> wrote:
>   
>> Hi all,
>>
>> I'm doing a save of a model, it has an association and the key is
>> being used in a join during the update, so that field isn't being
>> saved. I need to disable the join for the save so I can update the
>> field. Can anyone tell me how to do this?
>> 
>
> Have you tried removing the associated data from $this->data?  That
> seems to me to be the easiest way to solve the problem, unless I am
> misunderstanding it.
>
>   


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



afterFind() dillemna - eats memory for breakfast

2008-01-17 Thread [EMAIL PROTECTED]

cake 1.2.0.6311-beta, PHP 5.2.4

I'm trying to use afterFind() in order to massage some data for a
model and am seeing PHP max out the memory limit (32MB). I'm only
using a subset of just 1000 records (about 5%) from the prod. DB
membership table. I'm using a technique that I saw given to create a
"full_name" field in the returned array by concating the first & last
names. In my case, I'm running urlencode()  on the members' names to
create a new field, among other things.

Part of the problem is that the fields i'm looking for might lie at
any of a number of levels, depending on whether i'm viewing a single
record or selecting many. So I have to do stuff lik this:

function afterFind($results)
{
if (isset($results['id']))
{
...
return $results;
}

foreach ($results as $key => $val)
{
if(array_key_exists($this->name, $val) && 
isset($results[$key][$this-
>name]['id']))
{
...
}
else if (isset($results[$key]['id']))
{
...
}
}
return $results;
}

Selecting 1000 records ate through memory pretty quick, so I limited
the fields to just id, first_name, last_name, organisation, and email
to start  with.

However, even with just those fields selected, I was still running out
of memory. It turned out that it was the methods I was passing my
array values to in order to create new fields. eg:

$results['link_name'] = $this->linkName($result['first_name'],
$results['last_name']);

where linkName() is just:

return urlencode("${first_name}_${last_name}");

By taking out the method calls and repeating the same logic at each
level I was finally able to run this. However, now I'm finding that
afterFind() is called for every little query, including just looking
up an ID. So now I'm faced with placing even more logic in afterFind()
-- not a great prospect.

So, as the subject suggests, I was poking around the Set class trying
to figure out if there was some way to use that for this problem. But
I can't think of anything that wouldn't likely cause even more memory
issues.

Basically, I'm not even sure if I'm going about this the right way. Is
this an appropriate way to use afterind()? Is there a simpler way to
get at my Member data, no matter if it's just a single record or many?

b


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



Re: Saving model without saving associated models

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 6:36 PM, Tim W <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm doing a save of a model, it has an association and the key is
> being used in a join during the update, so that field isn't being
> saved. I need to disable the join for the save so I can update the
> field. Can anyone tell me how to do this?

Have you tried removing the associated data from $this->data?  That
seems to me to be the easiest way to solve the problem, unless I am
misunderstanding it.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: No Debugging chapter!

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 6:37 PM, Raistlin Majere <[EMAIL PROTECTED]> wrote:
>
> I wrote the first question wrong. I can not edit it. I will try
> telling what I want again, but differently and completely.
>
> If I write a code to save a form data with CakePHP like "save($this-
> >data)", I will base on the codes written to create CakePHP like the
> ones in "app\config\acl.ini.php".
>
> I know the code I wrote, but I do not know the codes written to create
> CakePHP.
>
> If I commit a mistake, will the error message be talking about the
> code I wrote only and be understanble or the code written to create
> CakePHP only and not be understandable?
>

You will see two types of errors:

1) Warnings generated by CakePHP that actually tell you what to do.
These can be fixed by following the instructions in the error message
2) Errors and/or warnings generated by PHP itself.  These can be fixed
by having a good understanding of PHP itself.

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: No Debugging chapter!

2008-01-17 Thread Raistlin Majere

I wrote the first question wrong. I can not edit it. I will try
telling what I want again, but differently and completely.

If I write a code to save a form data with CakePHP like "save($this-
>data)", I will base on the codes written to create CakePHP like the
ones in "app\config\acl.ini.php".

I know the code I wrote, but I do not know the codes written to create
CakePHP.

If I commit a mistake, will the error message be talking about the
code I wrote only and be understanble or the code written to create
CakePHP only and not be understandable?

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



Saving model without saving associated models

2008-01-17 Thread Tim W

Hi all,

I'm doing a save of a model, it has an association and the key is
being used in a join during the update, so that field isn't being
saved. I need to disable the join for the save so I can update the
field. Can anyone tell me how to do this?

I think I can do this using the unbindModel() method, and I guess I
could use saveField after the main save to update the join field, but
i'd like to know if there's a cleaner way.

Many thanks

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



Re: how can i use beforeFind to return a field name AS something else?

2008-01-17 Thread [EMAIL PROTECTED]

You could always write a custom sql script to do what you want to do:

$sql="SELECT * FROM something AS somethingelse WHERE conditions";
$results = $this->yourmodel->query($sql);

You could also have your ajax call submit a form with a hidden input
that contains the id of the call, that way you can differentiate in
your controller which ajax call was used. If you need to differentiate
in your view, just pass that data back to your view.

Dave

On Jan 17, 9:26 am, papajoe <[EMAIL PROTECTED]> wrote:
> I'm using Ajax calls from the same table and field twice in the same
> form. To differentiate between the two ajax call, the [modelname]
> [fieldname] needs to be different. Since I can't change the way the
> Ajax method makes the call, I though I'd use beforeFind in the model
> to return "SELECT fieldname AS tempname WHERE...".
>
> Ex.
>
> SQL in:
>
> select [temp_url] from links where id=3;
>
> SQL out;
>
> select [url] as [temp_url] from links where id=3;
>
> So the Ajax call would look for temp_url (non-existant) and the return
> value would be that of url.
>
> Possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread [EMAIL PROTECTED]

> Thanks for the inputs guys... Coupling both of these resolves the issues.
> I am having another AJAX problem.. with the below said string when i click
> some other tab, the images on the foucsed tab fade but the images for the
> new tab start appearing one by one. I want that they dont appear one by one
> rather i want to load them at once using some Scriptaucolous effect(An
> effect similar to the dynamic update on youtube home page). Any ideas on how
> this can be done?


I'm not sure I quite understand what you mean, but if you use ajax to
update a div, the scriptaculous effect should apply to the entire div
and not the individual elements of the div separately. So are the
images you want to load with the scriptaculous effect all within the
same div? if so, is that the div you have updated with your ajax call?
If so, it may be the case that delay is due to the lag time it takes
to download the images from the server (I mean that they don't all
show up at the same time because the ajax update hasn't finished
downloading from the server before the client starts to display them.

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



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread Novice Programmer
you are right chris, i am venturing a little bit towards that... Please
pardon me as i know its a bit off topic, but i can't resist asking the help
from experts on this forum.

Thanks


On 1/18/08, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
>
> On Jan 17, 2008 4:47 PM, Novice Programmer <[EMAIL PROTECTED]>
> wrote:
> > Thanks for the inputs guys... Coupling both of these resolves the
> issues.
> > I am having another AJAX problem.. with the below said string when i
> click
> > some other tab, the images on the foucsed tab fade but the images for
> the
> > new tab start appearing one by one. I want that they dont appear one by
> one
> > rather i want to load them at once using some Scriptaucolous effect(An
> > effect similar to the dynamic update on youtube home page). Any ideas on
> how
> > this can be done?
> >
> > Thanks.
> >
>
> Don't you think you're venturing from "please help me with Cake" to
> "please help me with Ajax effects"?  I'm sure a quick trip to either
> the Scriptaculous web site or, if I may be so bold to suggest, Google
> will surely tell you how to get that stuff done.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 4:47 PM, Novice Programmer <[EMAIL PROTECTED]> wrote:
> Thanks for the inputs guys... Coupling both of these resolves the issues.
> I am having another AJAX problem.. with the below said string when i click
> some other tab, the images on the foucsed tab fade but the images for the
> new tab start appearing one by one. I want that they dont appear one by one
> rather i want to load them at once using some Scriptaucolous effect(An
> effect similar to the dynamic update on youtube home page). Any ideas on how
> this can be done?
>
> Thanks.
>

Don't you think you're venturing from "please help me with Cake" to
"please help me with Ajax effects"?  I'm sure a quick trip to either
the Scriptaculous web site or, if I may be so bold to suggest, Google
will surely tell you how to get that stuff done.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread Novice Programmer
Thanks for the inputs guys... Coupling both of these resolves the issues.
I am having another AJAX problem.. with the below said string when i click
some other tab, the images on the foucsed tab fade but the images for the
new tab start appearing one by one. I want that they dont appear one by one
rather i want to load them at once using some Scriptaucolous effect(An
effect similar to the dynamic update on youtube home page). Any ideas on how
this can be done?

Thanks.


On 1/18/08, francky06l <[EMAIL PROTECTED]> wrote:
>
>
> Use new with Effect :
> 'loading' => 'new Effect.Fade(\'ajaxtabloader\')',
>
> hth
>
>
>
> On Jan 17, 10:02 pm, "Novice Programmer" <[EMAIL PROTECTED]>
> wrote:
> > Hello Guys,
> >
> > I am upto developing a tabbed application. It loads tabs with images. on
> > clicking another tab, I have written ajax link that fetches the thumbs
> > specific to those tabs and loads them. Here is the ajax link that i have
> > written in my template.
> >
> > link('Random', '/main_tabs/index/random',
> array('update'
> > => array('ajaxtabloader'),
> >
> > 'loading' => 'Effect.Fade(\'ajaxtabloader\')', 'complete' =>
> > 'Effect.Appear(\'ajaxtabloader\')')));
> > ?>
> >
> > Have i fallen into some know issue of scriptaucolous with cake. Please
> note
> > that i am calling appear on the same div which i am making invisible.
> >
> > --
> > Thanks & Regards,
> > Novice (http://ishuonweb.wordpress.com/).
> >
>


-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread francky06l

Use new with Effect :
'loading' => 'new Effect.Fade(\'ajaxtabloader\')',

hth



On Jan 17, 10:02 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello Guys,
>
> I am upto developing a tabbed application. It loads tabs with images. on
> clicking another tab, I have written ajax link that fetches the thumbs
> specific to those tabs and loads them. Here is the ajax link that i have
> written in my template.
>
> link('Random', '/main_tabs/index/random', array('update'
> => array('ajaxtabloader'),
>
> 'loading' => 'Effect.Fade(\'ajaxtabloader\')', 'complete' =>
> 'Effect.Appear(\'ajaxtabloader\')')));
> ?>
>
> Have i fallen into some know issue of scriptaucolous with cake. Please note
> that i am calling appear on the same div which i am making invisible.
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Scriptaucolous effect.fade wont work

2008-01-17 Thread [EMAIL PROTECTED]

It should work, I think your problem is with
'update'=>array('ajaxbloader'). I seem to remember coming across this.
I don't think that Cake likes it when you pass a single value as an
array to update in the ajax link, try changing it to 'update'
=>'ajaxbloader' instead.

Dave

On Jan 17, 2:02 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello Guys,
>
> I am upto developing a tabbed application. It loads tabs with images. on
> clicking another tab, I have written ajax link that fetches the thumbs
> specific to those tabs and loads them. Here is the ajax link that i have
> written in my template.
>
> link('Random', '/main_tabs/index/random', array('update'
> => array('ajaxtabloader'),
>
> 'loading' => 'Effect.Fade(\'ajaxtabloader\')', 'complete' =>
> 'Effect.Appear(\'ajaxtabloader\')')));
> ?>
>
> Have i fallen into some know issue of scriptaucolous with cake. Please note
> that i am calling appear on the same div which i am making invisible.
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Scriptaucolous effect.fade wont work

2008-01-17 Thread Novice Programmer
Hello Guys,

I am upto developing a tabbed application. It loads tabs with images. on
clicking another tab, I have written ajax link that fetches the thumbs
specific to those tabs and loads them. Here is the ajax link that i have
written in my template.


link('Random', '/main_tabs/index/random', array('update'
=> array('ajaxtabloader'),

'loading' => 'Effect.Fade(\'ajaxtabloader\')', 'complete' =>
'Effect.Appear(\'ajaxtabloader\')')));
?>

Have i fallen into some know issue of scriptaucolous with cake. Please note
that i am calling appear on the same div which i am making invisible.

-- 
Thanks & Regards,
Novice (http://ishuonweb.wordpress.com/).

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



Re: Bug in cake beta 1.2 model

2008-01-17 Thread Chris Hartjes

On Jan 16, 2008 10:56 AM, Nina <[EMAIL PROTECTED]> wrote:
>
> Hi All
>
> I found (and fixed) a bug in the model.php file, and I can't report it
> in the trac system, so I thought I'd report it here in case someone
> sees it and can fix it.

Nina,

Is that "can't" or "won't" report the bug?  It takes no more than 5
minutes to sign up for an account on trac in order to report a bug.  I
tell you this because I can say with great certainty that patches
posted on the mailing list are extremely unlikely to be noticed.

It's great that you might have found a bug, but PLEASE take the time
to report it properly through trac.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Bug in cake beta 1.2 model

2008-01-17 Thread [EMAIL PROTECTED]

Wow, I'm really glad you found this. I read this yesterday and thought
"well, I guess I'll leave it the way it is until I see problems" Then
today I was testing my code and found major problems with saving HABTM
data. I thought it was because I was storing extra data in the join
tables but then I remembered this post. Thanks for your work, I would
have spent way to much time figuring this out (In fact I was just
about to change me code to use $this->model->query() to save the data
when I remembered this).

Thanks,
Dave

On Jan 16, 8:56 am, Nina <[EMAIL PROTECTED]> wrote:
> Hi All
>
> I found (and fixed) a bug in the model.php file, and I can't report it
> in the trac system, so I thought I'd report it here in case someone
> sees it and can fix it.
>
> The problem is in /cake/libs/model/model.php line 364 and on. In the
> code it says:
>
> if (isset($v[$n])) {
>                 $v = $v[$n];
>         }
>                 $joined[$n] = $v;
>
> But it should say:
>
> if (isset($v[$n])) {
>                 $v = $v[$n];
>                 $joined[$n] = $v;
>         }
>
> This error is in the save function and it causes a save to save habtm
> associated fields wrong, putting empty values into the database. I
> found the bug by comparing to the pre_beta code.
>
> Sincerely
>
> Nina Jansen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Image Switch

2008-01-17 Thread J_Zar

Really thank you Martin! Your answer is really useful to me. I'm
actually new to ajax and I thought images would be loaded by client-
server without any cache. Ok, I'm stupid.
I'm thinking to use the javascript method you show me in the example.

Thank you!


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



Re: FPDF and FPDI with CakePHP

2008-01-17 Thread Gianluca Gentile

How-to integrate FPDF and FPDI in my component? With "vendors" var?

Thanks,
Gianluca

On 15 Gen, 19:35, Takuo SHIONO <[EMAIL PROTECTED]> wrote:
> Hello Gianluca,
>
> I am also using FPDF with cakePHP.
>
> I think the problem is that the program output the white spaces in the
> layout template before FPDF outputs HTTP headers for pdf file.
>
> Please try:
> $this->layout = null;
>
> If this does not work, there is another solution.
> You do not need to use view.
> You create a component for generating pdf.
> (PdfComponent)
>
> // app/controllers/components/pdf.php
> class PdfComponent extends Object {
>function generate() {
>  $pdf = new PdfGenerator();
>
>  /// code for generating pdf
>
>  $pdf->Output(); // This function output HTTP protocol headers.
>}
>
> }
>
> The controller use this component and do not use view.
>
> TestController extends AppConteroller {
>var $components = array('Pdf');
>function generate() {
>  $this->Pdf->generate();
>  exit; // Do not show the content of view.
>}
>
> }
>
> This works fine for me.
>
> Best Wishes,
>
> Takuo Shiono

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



Re: Array Structure using alias Fieldnames in findAll() Method

2008-01-17 Thread Fraed

Thank you both for your reply.

Sense was to reduce the iterations above the fetched data. First Cake
iterates to present the data. After that i iterate over it to
preprocess the data. Finally the json_encode-Method iterates over it.
Maybe i will test to overwrite the fetchResult-Method, but i need it
for mysql too in the future.

Thanks for the clearing up the situation. I hoped there is an easy way
preparing data like that for all supported databases in one way. It
was important to me to know how it works. Thanks for that.

Fraed

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



Re: No Debugging chapter!

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 2:05 PM, Raistlin Majere <[EMAIL PROTECTED]> wrote:
>
> If I write some lines of code with a bug, will the error message about
> the bug ever contain the many lines of code used to create CakePHP?
> Why is there no Debugging chapter with error messages and their
> meanings???

That would be because the error messages are usually ones generated by
PHP itself, not CakePHP.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Components Session cakephp 1.2

2008-01-17 Thread Rogério Oliveira

hello friends.
are with difficulty to record and to rescue session in that version
1.2 somebody could help myself.
thank you.

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



No Debugging chapter!

2008-01-17 Thread Raistlin Majere

If I write some lines of code with a bug, will the error message about
the bug ever contain the many lines of code used to create CakePHP?
Why is there no Debugging chapter with error messages and their
meanings???

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



view blob image(succeeded)

2008-01-17 Thread DonGato

allright!... I succeeded in displaying blob images to a cake-php page,
thanks to francky06l for explaining his method and to [EMAIL PROTECTED] and Dr.
Tarique Sani for their conversation, here's what I did:

the layout:


the view:


the model:


the controller:
View->findById($id);
$this->set('data', $item['View']['photo']);
$this->set('type', $item['View']['photo_type']);
$this->render();
}
}
?>

the use:
type in whatever page something in this format:


and that's it!, cake-flavored blob image viewing =)

christianandradet no te awites k.. a la gente ke te resonda asi ni te
detengas a mirarla, bake on!

Mariano Iglesias, thanx for the support ;)

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



Re: another custom query 1.2 pagination question...

2008-01-17 Thread chad

Ok.. worked on this a bit more and figured out a solution that works
for now. Just need to make it more dynamic and i'll be good to go.
Maybe someone else can find this useful.

in my model:

function paginate($conditions = null, $fields = null, $order = null,
$limit = null, $page = 1, $recursive = null) {

/* setup order by variables */
$orderValues = array_values($order);
$orderKey = key($order);
$tmpOrder = explode('.', $orderKey);

/* setup fields to display on summary */
$common_fields = 'mlsid, class, class_type, area_id, status,
subdivision, asking_price, agent_name, office_name, address, city,
state, zip, status_id';

/* for page limiting */
$pglimit = $page * $limit - ($limit);

$listings = $this->query("  SELECT $common_fields FROM
ccar_stage.listings_commercial WHERE $conditions UNION ALL
SELECT 
$common_fields FROM ccar_stage.listings_land WHERE
$conditions UNION ALL
SELECT 
$common_fields FROM ccar_stage.listings_residential
WHERE $conditions UNION ALL
SELECT 
$common_fields FROM ccar_stage.listings_multifamily
WHERE $conditions UNION ALL
SELECT 
$common_fields FROM ccar_stage.listings_condotownhouse
WHERE $conditions
ORDER 
BY $tmpOrder[1] $orderValues[0], asking_price desc
LIMIT 
$pglimit, $limit
");
return $listings;

}

function paginateCount($conditions = null) {

$cnt = $this->query("   SELECT COUNT(*) as count FROM
ccar_stage.listings_commercial  WHERE $conditions UNION ALL
SELECT COUNT(*) 
as count FROM ccar_stage.listings_land WHERE
$conditions UNION ALL
SELECT COUNT(*) 
as count FROM ccar_stage.listings_residential
WHERE $conditions UNION ALL
SELECT COUNT(*) 
as count FROM ccar_stage.listings_multifamily
WHERE $conditions UNION ALL
SELECT COUNT(*) 
as count FROM
ccar_stage.listings_condotownhouse WHERE $conditions
");
$totalCnt = 0;
foreach($cnt as $key => $value) {
$clscnt[$key] = $value[0]['count'];
$totalCnt = $totalCnt + $clscnt[$key];
}
return $totalCnt;
}

in controller:

$this->paginate['Listing'] = array(

'conditions' => 'status_id = 0',

'order' => 'asking_price desc',

'limit' => 10,

'page' => 1

  );

//$this->Listing->unbindAll(); // unbind all 
associations

$this->Listing->paginateCount($this->paginate['Listing']
['conditions']);
$listings = $this->paginate();

//debug($this->params['paging']);
$this->set('listings', $listings);


Now I need to work on assocations... Anyone have any input on how this
looks? Any advice?

Thanks

On Jan 16, 1:26 pm, chad <[EMAIL PROTECTED]> wrote:
> Just wondering if there is an easy way to paginate this query ->
>
> $common_fields = 'mlsid, class, class_type, area_id, status,
> subdivision, asking_price, agent_name, office_name, address, city,
> state, zip';
> $query = mysql_query(" SELECT $common_fields FROM listings_commercial
> UNION ALL
> SELECT $common_fields FROM 
> listings_land UNION ALL
> SELECT $common_fields FROM 
> listings_residential UNION ALL
> SELECT $common_fields FROM 
> listings_multifamily UNION ALL
> SELECT $common_fields FROM 
> listings_condotownhouse
> ORDER BY aski

Orleans Public Defenders seeks experienced PHP developer (telecommuting is ok)

2008-01-17 Thread Gráinne O'Neill
Orleans Public Defenders is seeking a talented and motivated programmer to
help us build our case management system. The case management system is
currently being developed using Cakephp. The position is contract – the
hourly rate is dependent upon experience. The Orleans Public Defenders
prefers that a candidate be located in New Orleans, but a willingness to
travel and telecommute is acceptable.

Required Skills:

- Strong knowledge of web and internet technologies
- 4+ years programming experience, with 2+ years PHP
- Experience with MVC architecture and a development framework,
- Thorough understanding of object oriented programming
- Thorough knowledge of database concepts and principles and MySQL
- AJAX / Async procedure calls
- Excellent organization and time-management abilities
- BA/BS in Computer Science or related field preferred.

location: New Orleans, LA
payscale: DOE
job type: contract 
apply to: [EMAIL PROTECTED] or me at
[EMAIL PROTECTED]

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



Re: sessions being dropped on redirect or whenever i call a new page

2008-01-17 Thread BravoFoxtrot

I found the problem with my code using 1.2 beta.  There was a
destroy('Menu'); method that was called. The intent was to only delete
part of the session that referred to the menu.  I replaced this with
delete('Menu'); and it works.

I have no idea how this working in 1.2 pre beta but it did...

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



Re: HABTM Save - Something with cake or me?

2008-01-17 Thread rtconner

Oh and this is on the latest svn beta.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP 1.2 - session

2008-01-17 Thread pamp_php

Estou com um probleminha aqui, vê se pode me ajudar 

No meu controller (LoginController):
  Após fazer o registro da variável de sessão, se eu fizer um
render() ou render('index');
  O Cake recarrega a pagina de login, mas não registra a sessão.
   Agora se eu fizer um render('/login'), o cake registra a sessão,
mas me dá uma mensagem de ERRO informando que não encontrou o VIEW: /
view/login.cpt.

Obs.: O comando de registro da session está acima do render.
 Estou utilizando o CakePHP 1.2 e ajax para envio dos
dados do formulario.


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



Re: What is {n}?

2008-01-17 Thread Gonzalo Servat
On Jan 17, 2008 2:26 PM, Raistlin Majere <[EMAIL PROTECTED]> wrote:

>
> I meant {n}, not (n).
>

This was discussed very recently on the list. I've searched the archives for
you:

http://groups.google.com/group/cake-php/browse_thread/thread/1b0b0fa943a96e66/4e29a489b61da82d?lnk=gst&q=%7Bn%7D#4e29a489b61da82d

Next time you can do it yourself at:

http://groups.google.com/group/cake-php

- Gonzalo

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



Re: What is {n}?

2008-01-17 Thread Raistlin Majere

I meant {n}, not (n).

On 17 jan, 13:10, Raistlin Majere <[EMAIL PROTECTED]> wrote:
> CakePHP 1.1.19.6305
> MySQL 4.1.9
> PHP 4.3.10
>
> At the chapter models of the CakePHP Manual, there is an example of a
> function "to generate a list of roles based on your Role model, keyed
> by their integer ids" The function is generateList and (n) is used
> twice in its parameters. What is {n}?
>
> $this->Role->generateList(null, 'role_name ASC', null, '{n}.Role.id',
> '{n}.Role.role_name')
>
> -http://manual.cakephp.org/chapter/models

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



Re: What is {n}?

2008-01-17 Thread grigri

{n} represents the numeric index. For example, if you do a findAll(),
your result array could be like this:

array(
  [0] => array('Person' => array('name' => 'Caramon', 'class' =>
'Fighter', 'note' => 'Fat drunk')),
  [1] => array('Person' => array('name' => 'Sturm', 'class' =>
'Paladin', 'note' => 'Pompous git')),
  [2] => array('Person' => array('name' => 'Raistlin', 'class' =>
'Mage', 'note' => 'Defeated the Queen of Darkness and took her
place'))
)

In cakephp-set format, this would be "0.Person.name",
"0.Person.class", ...

So `{n}.Person.name` would evaluate to array('Caramon', 'Sturm',
'Raistlin') and `{n}.Person.class` would be array('Fighter',
'Paladin', 'Mage')

Finally, $this->Person->generateList(null, null, null,
'{n}.Person.class', '{n}.Person.name') would generate the following
array:

array(
  'Fighter' => 'Caramon',
  'Paladin' => 'Sturm',
  'Mage' => 'Raistlin'
)

Hope this makes sense.

On Jan 17, 4:10 pm, Raistlin Majere <[EMAIL PROTECTED]> wrote:
> CakePHP 1.1.19.6305
> MySQL 4.1.9
> PHP 4.3.10
>
> At the chapter models of the CakePHP Manual, there is an example of a
> function "to generate a list of roles based on your Role model, keyed
> by their integer ids" The function is generateList and (n) is used
> twice in its parameters. What is {n}?
>
> $this->Role->generateList(null, 'role_name ASC', null, '{n}.Role.id',
> '{n}.Role.role_name')
>
> -http://manual.cakephp.org/chapter/models
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Session.cookie value? What can/should it be?

2008-01-17 Thread aranworld

Should I alter the Session.cookie value, which is set at CAKEPHP by
default?

If I have a bunch of different cake apps running in my browser at the
same time how does cake differentiate between each app's session?

Is it with the Session.cookie string?  or does it use the
Security.salt as a way of distinguishing?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



how can i use beforeFind to return a field name AS something else?

2008-01-17 Thread papajoe

I'm using Ajax calls from the same table and field twice in the same
form. To differentiate between the two ajax call, the [modelname]
[fieldname] needs to be different. Since I can't change the way the
Ajax method makes the call, I though I'd use beforeFind in the model
to return "SELECT fieldname AS tempname WHERE...".

Ex.

SQL in:

select [temp_url] from links where id=3;

SQL out;

select [url] as [temp_url] from links where id=3;

So the Ajax call would look for temp_url (non-existant) and the return
value would be that of url.

Possible?

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



Re: Auth Component encrypting password before validation.

2008-01-17 Thread aranworld

Here is another somewhat way to do it.

Your real password field is called: passwd
In your form, place a field called: new_password

Now call these lines in your controller:

$this->data['User']['new_password_hash'] = $this->Auth-
>password( $this->data['User']['new_password']);
$this->User->save( $this->data );

Now in your User model put this in your beforeSave()

$this->data['User']['passwd'] = $this->data['User']
['new_password_hash'];

Make your validation rules applicable to the field 'new_password'
field, a value that will never be hashed.  If those validation rules
pass, then pass on that hashed version of new_password which is stored
in new_password_hash.


On Jan 17, 8:03 am, dizz <[EMAIL PROTECTED]> wrote:
> Thanks to both of you, I thought of this, but I thought it would be
> easier to disable the AuthComponent::hashPasswords and then do what
> Baz did above.
>
> Anyways thanks again for the help.
>
> -Andrew
>
> On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > Yep,
>
> > Use a different field, eg. new_password or something. (I'm assuming
> > you're validating when creating a password. No need for login)
>
> > Here's assuming you have a model called User:
>
> > // needed for validation for some reason
> > $this->User->set($this->data);
> > if ($this->validates($this->data))
> > {
> > $this->data['User']['passwd'] =
> > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > // all we did was hash passwords, no need to revalidate.
> > if ($this->save($this->data, false))
> > {
> > //do stuff
> > } else
> > {
> > // invalid
> > }
>
> > }
>
> > Would be nice to stick this is beforeSave in the model, but you can't
> > [easily] access the Auth component from the model.
>
> > Hope this helps.
>
> > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I am using the auth component and before my model can validate the
> > > password the auth component already encrypts the password so making it
> > > impossible to use the between built in valid method.
>
> >
> Is there any work around for this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Plugins > Controller Missing?

2008-01-17 Thread MrTufty

The problem here is the mismatch between the name of the plugin and
the default controller name.

For this to work, you need to rename contents_controller.php to
content_controller.php (and obviously amend the class name within
that). Additionally the views/contents/ folder needs to be renamed.

That should fix the problem.

Steve


On Jan 17, 11:42 am, NilsR <[EMAIL PROTECTED]> wrote:
> I can't access the default controller of my plugin. Cake tells me,
> that the controller is missing.
> My Structure looks like the following:
>
> app/
> plugins/
> content/
> content_app_controller.php
> content_app_model.php
> controllers/
> contents_controller.php
> models/
> content.php
> views/
> contents/
> admin_edit.ctp
> admin_new.ctp
>
> When i now try to access example.com/contents/index it tells me the
> controller is missing.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



What is {n}?

2008-01-17 Thread Raistlin Majere

CakePHP 1.1.19.6305
MySQL 4.1.9
PHP 4.3.10

At the chapter models of the CakePHP Manual, there is an example of a
function "to generate a list of roles based on your Role model, keyed
by their integer ids" The function is generateList and (n) is used
twice in its parameters. What is {n}?

$this->Role->generateList(null, 'role_name ASC', null, '{n}.Role.id',
'{n}.Role.role_name')

- http://manual.cakephp.org/chapter/models

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



Differing Array structures with HABTM find requests? Multiple Views?

2008-01-17 Thread designvoid

Hi all,

I have a page that displays a list of projects, projects can habtm
teams and vice versa, when the page first loads the $projects array is
populated via:

$this->set('projects', $this->Project->findAll());

Which returns ALL projects. Now on the page there is a select box that
posts back to the controller an id of a team in order to show projects
JUST for that team. This time the projects array is filled via:

$this->set('projects', $this->Project->Team->find(array('Team.id' =>
$_POST['team_id'])));

My problem is that these two requests return different array
structures, so my index.thtml is fine for the initial view all, but
falls over for the other request.

I have currently got around the problem by creating a second view file
and call 'render('secondview')' which is altered to accept the
different array (ie the looping etc)

What I want to know is if this is the correct way of doing this or
have I missed something fundamental?

TIA,

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



Re: Array Structure using alias Fieldnames in findAll() Method

2008-01-17 Thread grigri

D'oh! Read 'mssql' as 'mysql'. My bad.

The cake MS SQL datasource does a similar thing to postgres (with the
double underscore), but it looks like you won't be able to use the
same workaround because the field mappings are pre-calculated.

You can still use a behavior though, or extend the DboMssql class and
override fetchResults(), looks like it might be a bit trickier than
for mysql though.

On Jan 17, 3:16 pm, grigri <[EMAIL PROTECTED]> wrote:
> mysql resultsets identify the originating table and field name (table
> can be aliased), and cake uses this information to build the array.
>
> So if you have SELECT `Thing`.`eggs` FROM things AS `Thing` ...
>
> Then cake knows that field is from the `Thing` model and puts it in
> the appropriate array. This is necessary because hasOne and belongsTo
> associations use joins, so fields from several tables (models) can be
> returned in the same resultset.
>
> If you specify an alias for the field : SELECT `Thing`.`eggs` AS
> `bacon` FROM things AS `Thing`
>
> Then in the resultset, the `bacon` field has no associated table, and
> therefore no model. This is why cake puts it in a [0] index, because
> it doesn't (and can't) know the table/model it came from.
>
> On the other hand, PostgreSQL resultsets do not identify the
> originating table, so cake fakes it buy creating an alias consisting
> of the table name, double underscore, then the field name, which is
> then parsed back from the resultset into model/field. So if you were
> using postgres, you could take advantage of this to create custom
> aliases:
>
> $this->Thing->find('all', array('fields' => 'Thing.eggs AS
> Thing__bacon'));
>
> would generate $data[Thing][bacon]
>
> Since you're using mysql, you can use a behavior to post-transform the
> fields (http://openpaste.org/en/3929/allows you to specify field
> aliases as `Table.field`, there are similar things around
> (TrueFieldBehavior, I seem to remember).
>
> You could also extend the dbo_mysql class with your own, and override
> the resultSet() method to handle aliases in a similar way to postgres,
> or any convention you'd like. This would probably be less resource-
> intensive.
>
> On Jan 17, 2:42 pm, hydra12 <[EMAIL PROTECTED]> wrote:
>
> > I can't help you with mssql or aliases, but I might be able to help
> > with the json stuff.  If I understand you correctly, you are wanting
> > to get your data into a good json format (ie - not have the data
> > nested in so many arrays).  You might Set::extract().  You can find a
> > short tutorial 
> > here:http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-...
>
> > I have an example that uses this to create a json string 
> > here:http://www.ntatd.org/mark/?p=29.
>
> > I hope that helps some.  I know it's not what you actually asked for,
> > but maybe it will help in the mean time.
>
> > hydra12
>
> > On Jan 16, 7:14 am, Fraed <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > i am using Cakephp 1.2.0.6311 beta with mssql.
>
> > > Im trying to use Alias-Names in the findAll()-Method. (eg in SQL:
> > > SELECT name AS text from table). Everytime setting up the field
> > > parameter like array('name AS text') the returned Array-Structure is
> > > unusable. A value would be accessable as:
>
> > > $data[0][Model][0][Model][0]['text'] instead of $data[0][Model][text]
>
> > > Fields without an Alias have their right place.
>
> > > Is there any way to work with aliases and set up the Array structure
> > > correctly? This would be very helpful to encode some json_data and
> > > maybe also for other things. Maybe the defnition in the field array is
> > > wrong. But theres no hint where aliases can be defined on other
> > > points. Is it working with mysql? Cant test it here in Company.
>
> > > Thanks for your help
>
> > > Fraed
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component encrypting password before validation.

2008-01-17 Thread dizz

Thanks to both of you, I thought of this, but I thought it would be
easier to disable the AuthComponent::hashPasswords and then do what
Baz did above.

Anyways thanks again for the help.

-Andrew

On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
> Yep,
>
> Use a different field, eg. new_password or something. (I'm assuming
> you're validating when creating a password. No need for login)
>
> Here's assuming you have a model called User:
>
> // needed for validation for some reason
> $this->User->set($this->data);
> if ($this->validates($this->data))
> {
>     $this->data['User']['passwd'] =
> $this->Auth->password($this->data['User']['new_passwd'] )
>
>     // all we did was hash passwords, no need to revalidate.
>     if ($this->save($this->data, false))
>     {
>         //    do stuff
>     } else
>     {
>         // invalid
>     }
>
> }
>
> Would be nice to stick this is beforeSave in the model, but you can't
> [easily] access the Auth component from the model.
>
> Hope this helps.
>
> On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I am using the auth component and before my model can validate the
> > password the auth component already encrypts the password so making it
> > impossible to use the between built in valid method.
>
> > Is there any work around for this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: swfupload cakephp 302 error

2008-01-17 Thread booboobenny

Yeah the upload is working except that i get a 302 error. So the file
is uploaded ok, copied to the right folder and the correct info I need
is stored in my db.



On Jan 14, 6:43 pm, rloaderro <[EMAIL PROTECTED]> wrote:
> On Jan 14, 3:00 pm, booboobenny <[EMAIL PROTECTED]> wrote:
>
> >swfuploaddoes not need ajax,  its pure flash. The flash movie does a
> > post submission there is no page reload.
>
> Sorry - I was interpretting your usage of AJAX to mean being able to
> submit the form without using Javascript.SWFUpload/SWiff are not
> technically AJAX because there is no XML - but good luck using them
> without Asynchronous Javascript ;)
>
> > The flash movie is getting back a 302 from apache, in the log i see:
>
> > "POST /foo/upload/ HTTP/1.1" 302 673 "-" "Adobe Flash Player 9"
>
> > Note the actual URL of the page is /foo/edit/56/56
>
> > Its very strange that I can set the header manually on local machine
> > but not on mediatemple. They do have a funky way of running php5.
>
> So if I understand you correctly the form is working - the file is
> being uploaded correctly and appears on the server, etc.. the only
> problem is the server is returning a 302 instead of a 200?
>
> Or.. it's not actually working?
>
> BTW - did you see this entry:http://swfupload.org/forum/generaldiscussion/157
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Environment settings

2008-01-17 Thread booboobenny

I also use Ant. I have a set of properties file for each environment
and all settings are placed in here as constants. This file is then
loaded by bootstrap so the constants are available.

This is great for the developers working on the project as there is
one place, and one place only to put in environment specific settings.
I wrote something brief about it a ways back. I have recently become a
big fan of ANT.

http://blog.sternthal.org/2007/11/28/property-files-cakephp-and-agile-development/

On Jan 17, 10:25 am, Alfredo <[EMAIL PROTECTED]> wrote:
> If anyone bumps into this thread here is a great solution
>
> http://groups.google.com/group/cake-php/browse_thread/thread/fd5fd9d3...
>
> On Jan 8, 1:51 pm, Langdon Stevenson <[EMAIL PROTECTED]> wrote:
>
> > Personally I use an Ant build task (through Eclipse) to deploy my
> > applications to dev, test, and production.  It keeps the deployment
> > specific info out of the code and all in one place.  It also means that
> > I can easily add a new target or change a target with little effort.
>
> > Ant is pretty powerful and I only need a fraction of what it is capable
> > of for deployment of my Cake applications.  The integration with Eclipse
> > is also very handy as it is trivial to trigger specific builds.
>
> > Regards,
> > Langdon
>
> > rtconner wrote:
> > > Yeah if anyone find's a great way to do this .. lemme know. For me, I
> > > just toss some if statements into my config that recongnize the url
> > > and pick a db config based on it. Not the best idea.. I know.
>
> > > I think *best* case scenario is to not commit the database config
> > > file. And have deploy scripts to given servers generate the database
> > > config file somehow. but that is a bit of work.
>
> > > On Jan 8, 12:04 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> > >> On Jan 8, 2008 1:39 PM, Alfredo <[EMAIL PROTECTED]> wrote:
>
> > >>> Hi, I need to handle multiple environments (dev, qa, production...)
> > >>> and for each I need a set of values, diffrent api keys,  base urls
> > >>> resource locations etc.  Is there a way to define an array for each
> > >>> environment and have an global environment_config array that can be
> > >>> accessed from controllers/models/views? Is there a default technique
> > >>> for this?
> > >> While this is not a Cake-specific thing, I have done similar stuff by
> > >> defining an Apache environment variable for each environment, then in
> > >> my "load values depending on environment" section I would check the
> > >> value of that variable.
>
> > >> In Cake-1.2-specific terms, I imagine you'd need some code that would
> > >> look at that environment variable and then load things into the
> > >> Configure object:
>
> > >>http://tempdocs.cakephp.org/#TOC33079
>
> > >> Where that code should go, I don't know.  Perhaps in the
> > >> beforeFilter() for AppController?
>
> > >> Hope that helps.
>
> > >> --
> > >> Chris Hartjes
> > >> Internet Loudmouth
> > >> Motto for 2008: "Moving from herding elephants to handling snakes..."
> > >> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component encrypting password before validation.

2008-01-17 Thread Baz

Yep,

Use a different field, eg. new_password or something. (I'm assuming
you're validating when creating a password. No need for login)

Here's assuming you have a model called User:

// needed for validation for some reason
$this->User->set($this->data);
if ($this->validates($this->data))
{
$this->data['User']['passwd'] =
$this->Auth->password($this->data['User']['new_passwd'] )

// all we did was hash passwords, no need to revalidate.
if ($this->save($this->data, false))
{
//do stuff
} else
{
// invalid
}
}

Would be nice to stick this is beforeSave in the model, but you can't
[easily] access the Auth component from the model.

Hope this helps.


On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am using the auth component and before my model can validate the
> password the auth component already encrypts the password so making it
> impossible to use the between built in valid method.
>
> Is there any work around for this?
> >
>

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



Re: Sessions, Webserivce and Ajax

2008-01-17 Thread nate

Dude, you're confusing some very unrelated things.

On Jan 17, 9:38 am, lordG <[EMAIL PROTECTED]> wrote:
> Hey Chris,
>
> Thanks for the input. I did review that, but could not find valid
> cause that it was that. The cake Route class if it finds that the url
> is Ajax, sets the $params['bare'] value to 1. As a result, the session
> component when checking if it should start the session checks if
> $params['bare'] = 0, if so it then starts. therefor any ajax session
> wont have session scope even if useragent is false.
>
> The only way for me to resolve this was to return the Route class to
> write $params['ajax'] = 1 if a ajax call is found, and then write
> adjust my own session class to check if the call was ajax too in order
> to keep the session scope.
>
> The other disadvantage here is that because the standard cake session
> class relies on $params['bare'] = 0, then all other webservices will
> also have no session scope.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Component encrypting password before validation.

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 10:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am using the auth component and before my model can validate the
> password the auth component already encrypts the password so making it
> impossible to use the between built in valid method.
>
> Is there any work around for this?

Well, you can always create another field called 'password_confirm' or
something, and then validate against that.  Then you can compare the
encrypted password to the encrypted version of the password_confirm
field to make sure that they are equal.  I've even posted an example
of how to do it on my blog (link is below) before.

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Auth Component encrypting password before validation.

2008-01-17 Thread dizz

Hello,

I am using the auth component and before my model can validate the
password the auth component already encrypts the password so making it
impossible to use the between built in valid method.

Is there any work around for this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Where's my environment.rb??

2008-01-17 Thread Alfredo


If anyone gets to this thread here's the perfect solution

http://groups.google.com/group/cake-php/browse_thread/thread/fd5fd9d30fb1c343/2316245e32c91097?lnk=gst


On Dec 26 2007, 3:03 pm, nate <[EMAIL PROTECTED]> wrote:
> See app/config/core.php or app/config/bootstrap.php
>
> On Dec 26, 1:36 pm, Alfredo <[EMAIL PROTECTED]> wrote:
>
> > Ok, so I know it's not a 100% a Rails port but whats the equivalent
> > for the environment.rb file or for the config/initializers folder?
>
> > I need a place for application config such as API keys and static urls
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Environment settings

2008-01-17 Thread Alfredo

If anyone bumps into this thread here is a great solution

http://groups.google.com/group/cake-php/browse_thread/thread/fd5fd9d30fb1c343/2316245e32c91097?lnk=gst


On Jan 8, 1:51 pm, Langdon Stevenson <[EMAIL PROTECTED]> wrote:
> Personally I use an Ant build task (through Eclipse) to deploy my
> applications to dev, test, and production.  It keeps the deployment
> specific info out of the code and all in one place.  It also means that
> I can easily add a new target or change a target with little effort.
>
> Ant is pretty powerful and I only need a fraction of what it is capable
> of for deployment of my Cake applications.  The integration with Eclipse
> is also very handy as it is trivial to trigger specific builds.
>
> Regards,
> Langdon
>
> rtconner wrote:
> > Yeah if anyone find's a great way to do this .. lemme know. For me, I
> > just toss some if statements into my config that recongnize the url
> > and pick a db config based on it. Not the best idea.. I know.
>
> > I think *best* case scenario is to not commit the database config
> > file. And have deploy scripts to given servers generate the database
> > config file somehow. but that is a bit of work.
>
> > On Jan 8, 12:04 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> >> On Jan 8, 2008 1:39 PM, Alfredo <[EMAIL PROTECTED]> wrote:
>
> >>> Hi, I need to handle multiple environments (dev, qa, production...)
> >>> and for each I need a set of values, diffrent api keys,  base urls
> >>> resource locations etc.  Is there a way to define an array for each
> >>> environment and have an global environment_config array that can be
> >>> accessed from controllers/models/views? Is there a default technique
> >>> for this?
> >> While this is not a Cake-specific thing, I have done similar stuff by
> >> defining an Apache environment variable for each environment, then in
> >> my "load values depending on environment" section I would check the
> >> value of that variable.
>
> >> In Cake-1.2-specific terms, I imagine you'd need some code that would
> >> look at that environment variable and then load things into the
> >> Configure object:
>
> >>http://tempdocs.cakephp.org/#TOC33079
>
> >> Where that code should go, I don't know.  Perhaps in the
> >> beforeFilter() for AppController?
>
> >> Hope that helps.
>
> >> --
> >> Chris Hartjes
> >> Internet Loudmouth
> >> Motto for 2008: "Moving from herding elephants to handling snakes..."
> >> @TheKeyBoard:http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using configuration file

2008-01-17 Thread Alfredo

I went and tried it out but instead of loading the settings on the
AppController's beforeFilter I did it in the config/bootstrap.php, and
the Configure object is accesible pretty much everywhere.

thanks a bunch for the tip

On Jan 17, 7:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Yes, but depends. First, all of your controllers (should) inherit from
> AppController, second almost anything you will be interested in to get
> access to Configure methods, gets executed after the beforeFilter in
> AppController. Always remember when you overwrite beforeFilter() in
> your controllers to call parent::beforeFilter().
>
> On Jan 14, 2008 12:46 PM, Alfredo <[EMAIL PROTECTED]> wrote:
>
>
>
> > Dardo, I've been looking for an option like this for a while, are
> > these settings accesible everywhere or just the controllers that
> > inherit from that AppController?
>
> > On Jan 11, 5:09 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > > I usually create app/config/settings.php , then in AppController
> > > beforeFilter I do Configure::load('settings');
>
> > > app/config/settings.php :
>
> > > $config['Settings']['an_option'] = 'its value';
>
> > > Then in my code I can so  $value = Configure::read('Settings.an_option');
>
> > > On Jan 10, 2008 6:53 PM, Novice Programmer <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks Samuel. Thank you very much.
>
> > > > On 1/11/08, Samuel DeVore <[EMAIL PROTECTED]> wrote:
>
> > > > > and tutorial to go with it
>
> > > >http://bakery.cakephp.org/articles/view/confcomponent-db-based-config...
>
> > > > > On Jan 10, 2008 2:43 PM, Samuel DeVore <[EMAIL PROTECTED]> wrote:
>
> > > >http://bakery.cakephp.org/articles/view/confcomponent-db-based-config...
>
> > > > > > is one
>
> > > > > > On Jan 10, 2008 2:00 PM, Novice Programmer <[EMAIL PROTECTED] >
> > > > wrote:
> > > > > > > Hello Steve,
>
> > > > > > > Thanks for the reply. I have a lot of configuration files, so i 
> > > > > > > think
> > > > > > > appending at the end of one file wont be advisable for me. Can you
> > > > point me
> > > > > > > to any such example of the second approach you suggested? I will 
> > > > > > > be
> > > > > > > thankful.
>
> > > > > > > thanks.
>
> > > > > > > On 1/11/08, MrTufty < [EMAIL PROTECTED]> wrote:
>
> > > > > > > > It depends how many configuration settings you need to store.
>
> > > > > > > > Personally, I'm just adding to the bottom of 
> > > > > > > > app/config/core.php -
> > > > > > > > seems to work fairly effectively.
>
> > > > > > > > Others have used a model and component in order to store
> > > > configuration
> > > > > > > > settings in the database. I haven't tried this yet.
>
> > > > > > > > Steve
>
> > > > > > > > On Jan 10, 8:09 pm, "Novice Programmer" < [EMAIL PROTECTED]>
> > > > > > > > wrote:
> > > > > > > > > Hello Guys,
>
> > > > > > > > > I have a legacy appliaiton that i am porting to cake to avoid 
> > > > > > > > > the
> > > > > > > clutter of
> > > > > > > > > code in my php pages. That application is using configuration
> > > > > > > > > file(traditional config.php). I was wonderting that what is 
> > > > > > > > > the
> > > > best
> > > > > > > place
> > > > > > > > > where it would go when thinking of cake paradigm. Please Help.
>
> > > > > > > > > --
> > > > > > > > > Thanks & Regards,
> > > > > > > > > Novice (http://ishuonweb.wordpress.com/).
>
> > > > > > > --
> > > > > > > Thanks & Regards,
> > > > > > > Novice (http://ishuonweb.wordpress.com/).
>
> > > > > > --
> > > > > > (the old fart) the advice is free, the lack of crankiness will cost 
> > > > > > you
>
> > > > > > - its a fine line between a real question and an idiot
>
> > > > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
>
> > > > > --
> > > > > (the old fart) the advice is free, the lack of crankiness will cost 
> > > > > you
>
> > > > > - its a fine line between a real question and an idiot
>
> > > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
>
> > > > >http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Array Structure using alias Fieldnames in findAll() Method

2008-01-17 Thread grigri

mysql resultsets identify the originating table and field name (table
can be aliased), and cake uses this information to build the array.

So if you have SELECT `Thing`.`eggs` FROM things AS `Thing` ...

Then cake knows that field is from the `Thing` model and puts it in
the appropriate array. This is necessary because hasOne and belongsTo
associations use joins, so fields from several tables (models) can be
returned in the same resultset.

If you specify an alias for the field : SELECT `Thing`.`eggs` AS
`bacon` FROM things AS `Thing`

Then in the resultset, the `bacon` field has no associated table, and
therefore no model. This is why cake puts it in a [0] index, because
it doesn't (and can't) know the table/model it came from.

On the other hand, PostgreSQL resultsets do not identify the
originating table, so cake fakes it buy creating an alias consisting
of the table name, double underscore, then the field name, which is
then parsed back from the resultset into model/field. So if you were
using postgres, you could take advantage of this to create custom
aliases:

$this->Thing->find('all', array('fields' => 'Thing.eggs AS
Thing__bacon'));

would generate $data[Thing][bacon]

Since you're using mysql, you can use a behavior to post-transform the
fields (http://openpaste.org/en/3929/ allows you to specify field
aliases as `Table.field`, there are similar things around
(TrueFieldBehavior, I seem to remember).

You could also extend the dbo_mysql class with your own, and override
the resultSet() method to handle aliases in a similar way to postgres,
or any convention you'd like. This would probably be less resource-
intensive.

On Jan 17, 2:42 pm, hydra12 <[EMAIL PROTECTED]> wrote:
> I can't help you with mssql or aliases, but I might be able to help
> with the json stuff.  If I understand you correctly, you are wanting
> to get your data into a good json format (ie - not have the data
> nested in so many arrays).  You might Set::extract().  You can find a
> short tutorial 
> here:http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-...
>
> I have an example that uses this to create a json string 
> here:http://www.ntatd.org/mark/?p=29.
>
> I hope that helps some.  I know it's not what you actually asked for,
> but maybe it will help in the mean time.
>
> hydra12
>
> On Jan 16, 7:14 am, Fraed <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > i am using Cakephp 1.2.0.6311 beta with mssql.
>
> > Im trying to use Alias-Names in the findAll()-Method. (eg in SQL:
> > SELECT name AS text from table). Everytime setting up the field
> > parameter like array('name AS text') the returned Array-Structure is
> > unusable. A value would be accessable as:
>
> > $data[0][Model][0][Model][0]['text'] instead of $data[0][Model][text]
>
> > Fields without an Alias have their right place.
>
> > Is there any way to work with aliases and set up the Array structure
> > correctly? This would be very helpful to encode some json_data and
> > maybe also for other things. Maybe the defnition in the field array is
> > wrong. But theres no hint where aliases can be defined on other
> > points. Is it working with mysql? Cant test it here in Company.
>
> > Thanks for your help
>
> > Fraed
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Inserting multiple records into the same model from one form

2008-01-17 Thread hydra12

I wrote a tutorial on this awhile back.  You can find it here:
http://www.ntatd.org/mark/?p=28.  It's a little bit strange because of
the date stuff I was also having to deal with (it's just working code
from a project I had), but maybe it will help a little.  Let me know
if I can help.

hydra12

On Jan 15, 4:00 pm, Brian <[EMAIL PROTECTED]> wrote:
> I want to insert multiple records into a single model using a single
> form. So let's say you want a form that collects 30  names and then
> inserts 30 records into a "people" model/table. In standard code I
> would uniquely name all form elements and then use a loop to dump them
> in to  the table. How can I do this in Cake?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Installation/htaccess problems

2008-01-17 Thread hydra12

Why did you change the .htaccess file?  I'm assuming that cakeblog is
actually your cake folder, with cake and app inside?  If so, then you
should be able to go to http://localhost/~reuben/cakeblog/ and
everything should work without changing the .htaccess file at all.  If
you have a different directory structure, there are ways to make it
work, but I don't thing you need to change the .htaccess file.

hydra12

On Jan 15, 3:37 pm, Reuben Avery <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Having some difficulty getting off the ground here with the cake blog
> tutorial, wondering if maybe someone might have an idea.
>
> I have installed cakephp athttp://localhost/~reuben/cakeblog/
>
> I modified the root .htaccess file and added 'RewriteBase /~reuben/
> cakeblog/' and was then able to load the default root page just
> fine.
>
> But going to any directory underneath the cakeblog root (for 
> example,http://mission/~reuben/cakeblog/postsas per the blog tutorial), I am
> getting a 404.  Looking at the httpd log, each of these requests is
> being rewritten to '/Library/WebServer/Documents/Users' .. (using a
> Mac here, and the default document root is set to /Library/WebServer/
> Documents)
>
> Not having problems with anything else in ~reuben/ so I am presuming
> this is an issue with that htaccess file
>
> Thanks for any advice!
> Reuben
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Image Switch

2008-01-17 Thread [EMAIL PROTECTED]

I know how much fun it is to get a question in return but here I go:

Why exactly do you want to use an ajax-call for an image replacement?
What you will be doing iscreating two server-calls from the browser.
1. replacing one image-tag with another
2. which causes the browser to start loading the new image.

If your javascript can figure out the name of the new image without a
server-call you can get away with a simple image-swapping without any-
ajax. If you really have to use ajax, remember that you only load the
filename or image-tag with ajax. Not the actual image.

Usually you can convert one name into the other 'name.jpg'->name-
thumb.jpg or 'thumbs/name.jpg'->'/fullsize/name.jpg'

If not you can cache a n array of some other js-datastructure in your
page ans access that when needed. Like in this extremely simple
example:
http://www.devx.com/tips/Tip/13653


On Jan 16, 10:54 am, J_Zar <[EMAIL PROTECTED]> wrote:
> I need to switch with a click an image.  Clicking on the thunmbnails
> should change the image in
> the div 'model_page_image'. This does not work and I get an error in
> the div from browser:
>
> "Not Acceptable
> Client browser does not accept the MIME type of the requested page."
>
> Where is the trick?
>
> My controller:
> -
> function view($id = null, $image_id = null)
>     {
>         if ($id != null)
>         {
>                 $this->Model->id = $id;
>                 $this->set('model',$this->Model->read());
>                 $this->set('image_id',$image_id);
>         }
>         else
>         {
>                 echo "Errore! Id maldefinito...";
>         }
>
>         $this->render('view', 'ajax');
>     }
>
> Part of My view :
> 
> // Get the first image
>         $img_list = explode(";", $model['Model']['image_list']);
>
>         //print_r($img_list);
>
>         $is_maschio = false;
>         if ($model['Model']['sesso'] == 'Maschio')
>                 $is_maschio = true;
>
>         if ($image_id == null || empty($image_id))
>         {
>                 if (!empty($img_list[1]))
>                 {
>                         $model_image = $html->link( 
> $html->image('../img_models/
> thumbnails/'.$img_list[1], array('border' => '0', 'style' => 'border:
> 1px solid #00; margin: 5px 5px 5px 0px;', 'align' => 'right')), '/
> models/viewone/'.$model['Model']['id'], $htmlAttributes=null,
> $confirmMessage=false, $escapeTitle=false);
>                 }
>                 else
>                 {
>                         $model_image = $html->image('no_image.jpg', 
> array('border' => '0',
> 'style' => 'border:1px solid #00;margin: 5px 5px 5px 0px;',
> 'align' => 'right'));
>                 }
>         }
>         else
>         {
>                 if (!empty($img_list[$image_id]))
>                 {
>                         $model_image = $html->link( 
> $html->image('../img_models/
> thumbnails/'.$img_list[$image_id], array('border' => '0', 'style' =>
> 'border:1px solid #00; margin: 5px 5px 5px 0px;', 'align' =>
> 'right')), '/models/viewone/'.$model['Model']['id'],
> $htmlAttributes=null, $confirmMessage=false, $escapeTitle=false);
>                 }
>                 else
>                 {
>                         $model_image = $html->image('no_image.jpg', 
> array('border' => '0',
> 'style' => 'border:1px solid #00;margin: 5px 5px 5px 0px;',
> 'align' => 'left'));
>                 }
>         }
> /*
>         $model_image = $html->image( $model_image_url, array('border' => '0',
> 'style' => 'border:1px solid #00; margin: 5px 5px 5px 0px;',
> 'align' => 'right'));*/
>
>         echo " cellspacing=\"0\">";
>         echo "\n";
>         echo "".$model['Model']['nome']." font>";
>
>         if ($is_admin)
>                 echo "".$this->renderElement('adminloc', array('model'
> => $model))."";
>
>         echo " \"0\">";
>         echo "Altezza:".
> $model['Model']['altezza']."";
>         echo "Taglia :".
> $model['Model']['taglia']."";
>         echo "Spalle :".
> $model['Model']['spalle']."";
>         if ($is_maschio)
>                 echo "Torace 
> :".
> $model['Model']['petto']."";
>         else
>                 echo "Seno 
> :".
> $model['Model']['petto']."";
>         echo "Girovita :".
> $model['Model']['girovita']."";
>         echo "Fianchi :".
> $model['Model']['fianchi']."";
>         if ($is_maschio)
>         {
>                 echo "Girocollo : td>".$model['Model']['girocollo']."";
>                 echo "Gamba 
> :".
> $model['Model']['gamba']."";
>         }
>         echo "Scarpe :".
> $model['Model']['scarpe']."";
>         echo "Occhi :".
> $model['Model']['occhi']."";
>         echo "Capelli :".
> $model['Model']['capelli']."";
>         echo "Note :".
> $model['Model']['note']."";
>
>         echo "";
>
>         echo "";
>         echo "\n";
>         echo $ajax->div('model_page_image');
>         echo $model_image;
>     

Re: Array Structure using alias Fieldnames in findAll() Method

2008-01-17 Thread hydra12

I can't help you with mssql or aliases, but I might be able to help
with the json stuff.  If I understand you correctly, you are wanting
to get your data into a good json format (ie - not have the data
nested in so many arrays).  You might Set::extract().  You can find a
short tutorial here: 
http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/

I have an example that uses this to create a json string here:
http://www.ntatd.org/mark/?p=29.

I hope that helps some.  I know it's not what you actually asked for,
but maybe it will help in the mean time.

hydra12

On Jan 16, 7:14 am, Fraed <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i am using Cakephp 1.2.0.6311 beta with mssql.
>
> Im trying to use Alias-Names in the findAll()-Method. (eg in SQL:
> SELECT name AS text from table). Everytime setting up the field
> parameter like array('name AS text') the returned Array-Structure is
> unusable. A value would be accessable as:
>
> $data[0][Model][0][Model][0]['text'] instead of $data[0][Model][text]
>
> Fields without an Alias have their right place.
>
> Is there any way to work with aliases and set up the Array structure
> correctly? This would be very helpful to encode some json_data and
> maybe also for other things. Maybe the defnition in the field array is
> wrong. But theres no hint where aliases can be defined on other
> points. Is it working with mysql? Cant test it here in Company.
>
> Thanks for your help
>
> Fraed
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, Webserivce and Ajax

2008-01-17 Thread lordG

Hey Chris,

Thanks for the input. I did review that, but could not find valid
cause that it was that. The cake Route class if it finds that the url
is Ajax, sets the $params['bare'] value to 1. As a result, the session
component when checking if it should start the session checks if
$params['bare'] = 0, if so it then starts. therefor any ajax session
wont have session scope even if useragent is false.

The only way for me to resolve this was to return the Route class to
write $params['ajax'] = 1 if a ajax call is found, and then write
adjust my own session class to check if the call was ajax too in order
to keep the session scope.

The other disadvantage here is that because the standard cake session
class relies on $params['bare'] = 0, then all other webservices will
also have no session scope.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Redirect to a wrong url when i login successfully

2008-01-17 Thread hydra12

It would help if you could post your code.  What address did you tell
your page to redirect to?  If you just want to redirect to
http://www.test.com/app/, you could try redirecting to '/'.

I hope that helps.
hydra12

On Jan 16, 8:03 am, KnightE <[EMAIL PROTECTED]> wrote:
> Hi, I'm new to cakephp 1.2, and touch the Auth Component few hours.
> After read some articles about Auth, I made a simple case.
> Everything is fine, but when I login successfully, the page redirect
> to a wrong url.
>
> First, I goto my project default page (e.g.http://www.test.com/app/).
> Then I click "Login" link from this page, and 
> gotohttp://www.test.com/app/users/login
> After complete the form, and click the "Login" button, I got a error
> msg said Missing Controller, because the browser redirect a url like
> this:http://www.test.com/app/http:/www.test.com/app
>
> It seems that the Router::normalize made the strange url...
> What's wrong with my code? Did I miss something importent??
>
> Thx for help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakephp directory structure

2008-01-17 Thread hydra12

There are several different ways to approach this, but I've never
heard the one you just heard.  The way you are doing it is a standard
way if you only want to have 1 app - you put your controller in /app/
controllers, your model in /app/models, and your views in /app/views/
controllername/.

If you want to have several different apps, you can create a folder
inside cakephp for each app (essentially, just copy the app folder and
rename it).  If you put things in /app/addressbook/, I don't think it
would work.

hydra12

On Jan 17, 3:27 am, aamir <[EMAIL PROTECTED]> wrote:
> Hello,
>   I have created a small address book in cakephp and I have used the
> default directory structure of cakephp. E.g.
>
> I have stored my addresses_controller.php in
> cakephp\app\controllers\addresses_controller.php
>
> and address.php ( model ) in
> cakephp\app\models\address.php
>
> and views files in views folder e.g.
> cakephp\app\views\addresses\add.thtml
>
> is this approach ok?
>
> i have just heard that i need to create a folder in app for my every
> new site. E.g.
> cakephp\app\addressbook
>
> and then i need to create controller, model and views directories in
> this directory.
>
> Please assist me what should I do?
>
> Thanks,
> Aamir.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Postgresql 8.2 on Windows XP

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 2:13 AM, williamn <[EMAIL PROTECTED]> wrote:
>
> Yes I did the extension=php_pgsql.dll in my php.ini. My other web app
> (not using cakephp) can connect to postgresql with no problem.
>
> I use cakephp 1.1.19.6305
>
> Thank you.
> --William

The problem isn't Cake, the problem is that you need to make sure that
the CLI version of PHP you have installed also has support for
Postgres.  Check to see if you have two different php.ini files, one
for web and one for CLI.  Some PHP installs do that.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Sessions, Webserivce and Ajax

2008-01-17 Thread Chris Hartjes

On Jan 17, 2008 6:37 AM, lordG <[EMAIL PROTECTED]> wrote:
>
> Hi Guys,
>
> Does anyone know why the webservices or ajax calls have not been
> maintained across sessions? Will they be, or am I missing something?

I believe this is related to previous discussions about the user agent
being different for the Ajax calls.  Try changing the following in in
your config/core.php

Configure::write('Session.checkAgent', true);

to

Configure::write('Session.checkAgent', false);

and see if that helps your webservice and Ajax calls.

Hope that helps, and I'm sure others will correct me if I'm wrong.


-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: testing the new beta

2008-01-17 Thread Dardo Sordi Bogado

I will give you a clue, look at the error message: "Permission
denied", "app/tmp"...

On Jan 16, 2008 11:00 PM, Helton Uchoa <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I´m testing the new version CakePHP 1.2.0.6311 beta and I´m having a problem
> that didn´t happen in version CakePHP 1.2.0.5875 pre-beta
>
> It´s not a error, but many warning messages. Is it "ok" or I have to make
> soma additional configuration?
>
> Unable to create file
> /web2/html/app/tmp/cache/persistent/cake_core_core_paths because Permission
> denied in /web2/html/cake/libs/file.php on line 121
>
> []s Uchoa
>
> --
> Helton UCHOA :: [EMAIL PROTECTED];geolivre.org.br;open3dgis.org}
> Consultant in FOSS GIS :: 55 21 2518-6233 :: 55 85 8859-1982
> OpenGEO :: On-demand training and solutions :: www.opengeo.com.br
> GEO Livre community:: Because Geoinformation should be free ::
> www.geolivre.org.br
> Be free by using Free Software, such as MapServer, PostgreSQL/PostGIS,
> gvSIG...
>  >
>

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



Re: A little help with redirection

2008-01-17 Thread [EMAIL PROTECTED]

Hi,
You don't need to do much.
create an appropriate controller/method... say a LogController with a
link method

You would point your external links to something like:

http://test.site/log/link?go=http://www.google.com/search?q=cakephp

I prefer putting the redirection-url in a normal query (using ?) since
cake will not try to parse it and make it into parameter-values.


Mega-simple example controller:
class LogController extends AppController
{
   function link()
   {
  $link = $this->params['url']['go'];
  // do logging
  ...
  $this->redirect($link);
   }
}



On Jan 17, 2:10 am, 4hire007 <[EMAIL PROTECTED]> wrote:
> Hello everyone,
> I am starting off with cakephp, And so far I am just amazed what I
> have done. Just wanna get some ideas regarding redirection.
> Here is how i wanna do it.
> [user clicks a link] -> [the click is recorded in a db] -> [user is
> redirected to the page, ex: google.com]
> so can any one help me with this.
> Like may be give me a link to an article or a function/component that
> i could use perhaps.
>
> So eagerly waiting..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using configuration file

2008-01-17 Thread Dardo Sordi Bogado

Yes, but depends. First, all of your controllers (should) inherit from
AppController, second almost anything you will be interested in to get
access to Configure methods, gets executed after the beforeFilter in
AppController. Always remember when you overwrite beforeFilter() in
your controllers to call parent::beforeFilter().

On Jan 14, 2008 12:46 PM, Alfredo <[EMAIL PROTECTED]> wrote:
>
> Dardo, I've been looking for an option like this for a while, are
> these settings accesible everywhere or just the controllers that
> inherit from that AppController?
>
> On Jan 11, 5:09 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > I usually create app/config/settings.php , then in AppController
> > beforeFilter I do Configure::load('settings');
> >
> > app/config/settings.php :
> >
> > $config['Settings']['an_option'] = 'its value';
> >
> > Then in my code I can so  $value = Configure::read('Settings.an_option');
> >
> > On Jan 10, 2008 6:53 PM, Novice Programmer <[EMAIL PROTECTED]> wrote:
> >
> > > Thanks Samuel. Thank you very much.
> >
> > > On 1/11/08, Samuel DeVore <[EMAIL PROTECTED]> wrote:
> >
> > > > and tutorial to go with it
> >
> > >http://bakery.cakephp.org/articles/view/confcomponent-db-based-config...
> >
> > > > On Jan 10, 2008 2:43 PM, Samuel DeVore <[EMAIL PROTECTED]> wrote:
> >
> > >http://bakery.cakephp.org/articles/view/confcomponent-db-based-config...
> >
> > > > > is one
> >
> > > > > On Jan 10, 2008 2:00 PM, Novice Programmer <[EMAIL PROTECTED] >
> > > wrote:
> > > > > > Hello Steve,
> >
> > > > > > Thanks for the reply. I have a lot of configuration files, so i 
> > > > > > think
> > > > > > appending at the end of one file wont be advisable for me. Can you
> > > point me
> > > > > > to any such example of the second approach you suggested? I will be
> > > > > > thankful.
> >
> > > > > > thanks.
> >
>
> > > > > > On 1/11/08, MrTufty < [EMAIL PROTECTED]> wrote:
> >
> > > > > > > It depends how many configuration settings you need to store.
> >
> > > > > > > Personally, I'm just adding to the bottom of app/config/core.php -
> > > > > > > seems to work fairly effectively.
> >
> > > > > > > Others have used a model and component in order to store
> > > configuration
> > > > > > > settings in the database. I haven't tried this yet.
> >
> > > > > > > Steve
> >
> > > > > > > On Jan 10, 8:09 pm, "Novice Programmer" < [EMAIL PROTECTED]>
> > > > > > > wrote:
> > > > > > > > Hello Guys,
> >
> > > > > > > > I have a legacy appliaiton that i am porting to cake to avoid 
> > > > > > > > the
> > > > > > clutter of
> > > > > > > > code in my php pages. That application is using configuration
> > > > > > > > file(traditional config.php). I was wonderting that what is the
> > > best
> > > > > > place
> > > > > > > > where it would go when thinking of cake paradigm. Please Help.
> >
> > > > > > > > --
> > > > > > > > Thanks & Regards,
> > > > > > > > Novice (http://ishuonweb.wordpress.com/).
> >
> > > > > > --
> > > > > > Thanks & Regards,
> > > > > > Novice (http://ishuonweb.wordpress.com/).
> >
> > > > > --
> > > > > (the old fart) the advice is free, the lack of crankiness will cost 
> > > > > you
> >
> > > > > - its a fine line between a real question and an idiot
> >
> > > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
> >
> > > > --
> > > > (the old fart) the advice is free, the lack of crankiness will cost you
> >
> > > > - its a fine line between a real question and an idiot
> >
> > > >http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
> >
> > > >http://ishuonweb.wordpress.com/).
> >
>

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



Re: Problems with Plugins

2008-01-17 Thread Dr. Tarique Sani

On Jan 17, 2008 3:27 PM, NilsR <[EMAIL PROTECTED]> wrote:
> When i now try to access example.com/contents/index it tells me the
> controller is missing. What's Wrong?

Try example.com/contents/contents/index - or upgrade to the latest cake

HTH
Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Problem with Plugins > Controller Missing?

2008-01-17 Thread NilsR

I can't access the default controller of my plugin. Cake tells me,
that the controller is missing.
My Structure looks like the following:


app/
plugins/
content/
content_app_controller.php
content_app_model.php
controllers/
contents_controller.php
models/
content.php
views/
contents/
admin_edit.ctp
admin_new.ctp



When i now try to access example.com/contents/index it tells me the
controller is missing.



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



Problems with Plugins

2008-01-17 Thread NilsR

I can't access the default controller of my plugin. Cake tells me,
that the controller is missing.
My Structure looks like the following:

/plugins
/plugins/content

/plugins/content/content_app_controller.php
/plugins/content/content_app_model.php

/plugins/content/model
/plugins/content/model/content.php

/plugins/content/controller
/plugins/content/controller/contents_controller.php

/plugins/content/view
/plugins/content/view/[...]


When i now try to access example.com/contents/index it tells me the
controller is missing. What's Wrong?

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



cakephp directory structure

2008-01-17 Thread aamir

Hello,
  I have created a small address book in cakephp and I have used the
default directory structure of cakephp. E.g.

I have stored my addresses_controller.php in
cakephp\app\controllers\addresses_controller.php

and address.php ( model ) in
cakephp\app\models\address.php

and views files in views folder e.g.
cakephp\app\views\addresses\add.thtml

is this approach ok?

i have just heard that i need to create a folder in app for my every
new site. E.g.
cakephp\app\addressbook

and then i need to create controller, model and views directories in
this directory.

Please assist me what should I do?

Thanks,
Aamir.

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



Re: Sessions, Webserivce and Ajax

2008-01-17 Thread lordG

Hi Guys,

Does anyone know why the webservices or ajax calls have not been
maintained across sessions? Will they be, or am I missing something?

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



Re: ACL question regarding inherited permissions

2008-01-17 Thread alex.tomes

Thanks a milion, it works now!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sharing Session across Different Applications

2008-01-17 Thread Adam Royle

Yes, here is one method of making it more secure.

So have you two sites, siteA.com and siteB.com.

User is browsing siteA.com and you want them transferred to siteB.com

They click a link: eg. siteA.com/blah/redirectem/

In your redirectem method you get the current session id and save it
into your database (eg. site_transfers) with a uuid (ie. String::uuid)

then you do a redirect to siteB.com/blah/catchem/$uuid

and search your database table for the uuid token and then instantiate
the session with the session id from the db.

Then delete the uuid and session id from your site_transfers table.

All done!


On Jan 17, 2:57 pm, Kyo <[EMAIL PROTECTED]> wrote:
> Following your instruction, now i figured out how to share sessions
> between applications.
> In my view I appended the session ID to the link like this:
>
> $html->link( 'Go to the other application',"http://www.example.com/
> other_cake/tests/index/sess_id:{$session->id('Test')}");
>
> On the other application, in the beforeFilter method in my controller:
>
> function beforeFilter() {
> $this->Session->id($this->params['named']['sess_id']);
>
> }
>
> I appreciate your instruction!
> Are there any way to make this more secure?
>
> On 1月16日, 午後10:48, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > Yes! When you transfer between applications (I'm guessing you have a
> > link of some description) append thesessionid onto your querystring
> > and use $this->Session->id($this->params['url']['sess_id']) on the
> > other end. There are more secure approaches to this, but you still
> > need to pass some kind of token so you know your user is really your
> > user.
>
> > Adam
>
> > On Jan 16, 6:58 pm, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > Yes, I use the same db for both applications.
> > > When I jump from one cake application to another, they store two
> > >sessiondata with different IDs.
> > > Cookie got anything to do with it?
>
> > > On 1月16日, 午後5:44, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > On Jan 16, 6:15 am, Kyo <[EMAIL PROTECTED]> wrote:
>
> > > > > I currently use two Cake applications (beta 1.2) for my project but
> > > > > I'm wondering if there is any way to sharesessiondata between those
> > > > > two applications. Both applications have database sessions.
>
> > > > Use the same db for both? It's pretty much what db sessions are for.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: no script tag but javascript is working

2008-01-17 Thread Julien

Oh my... I totally forgot this built-in javascript function because I
never use it! :-S

thanks a lot!

julien

On 16 jan, 00:05, "b logica" <[EMAIL PROTECTED]> wrote:
> On Jan 15, 2008 9:56 PM, Julien <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi, I'm very new to cake.
>
> > I'm currently doing the blog tutorial (http://manual.cakephp.org/
> > appendix/blog_tutorial). And I've noticed that in the index view there
> > is no 

Re: Problem with Postgresql 8.2 on Windows XP

2008-01-17 Thread williamn

Yes I did the extension=php_pgsql.dll in my php.ini. My other web app
(not using cakephp) can connect to postgresql with no problem.

I use cakephp 1.1.19.6305

Thank you.
--William

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