Re: $number->precission not working in controller

2007-04-19 Thread Dr. Tarique Sani

On 4/20/07, Joshua McFarren <[EMAIL PROTECTED]> wrote:
> Still... does anyone have a suggestion for a way to make sure totaldue
> is rendered in two decimal places?

Huh!

printf("%01.2f", $totaldue) doesn't work?

T

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

--~--~-~--~~~---~--~~
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: $number->precission not working in controller

2007-04-19 Thread Jeremy David Pointer

Look at phps sprintf function?

Joshua McFarren wrote:

>Ok, ok, I looked again at the manual and helpers are mean to provide
>functions that are commonly needed in views etc. So I guess this was
>stupid not easy. Also I misspelled precision in the subject AND my
>corner cases are not fully checked ($,100,000.0) with that regex!
>
>Still... does anyone have a suggestion for a way to make sure totaldue
>is rendered in two decimal places?
>
>
>>  
>


--~--~-~--~~~---~--~~
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: Cake app not running, index.php offered for download

2007-04-19 Thread Daniel Kvasnicka jr.

Hey Poncho,
I'm sure the server can handle PHP somehow. I've replaced /app/webroot/
index.php with another 'index.php' with only phpinfo() in it and I got
the output without problems...so there is something in Cake that's not
behaving :( Unfortunately, I have no chance to see apache2.conf/
httpd.conf, since the server is not their own, it's a regular paid
hosting.
I've already emailed their webmaster so I hope we'll find a way.

Thanx for your thoughts anyway,
Dan

On Apr 19, 11:17 pm, Poncho <[EMAIL PROTECTED]> wrote:
> Hey Daniel,
>
> Are you sure the Apache Server is configured to catch .php files and
> use them in DirectoryIndex?
> It sounds like you need to add something like the following to
> a .htaccess file:
>
> LoadModule php4_modulelibexec/httpd/libphp4.so
> AddModule mod_php4.c
> 
> AddType application/x-httpd-php .php
> AddType application/x-httpd-php-source .phps
>
> 
> DirectoryIndex index.html index.php
> 
> 
>
> Add those lines to a .htaccess file in the www directory of the
> webserver and see if that helps. Reply here if you don't get the
> desired result.
>
> Cheers;
> Poncho
>
> On Apr 19, 7:46 pm, "Daniel Kvasnicka jr."
>
> <[EMAIL PROTECTED]> wrote:
> > I've installed a Cake app to a client's server and I'm getting a blank
> > screen with mod_rewrite and index.php offered for download without
> > mod_rewrite.
>
> > The server is using PHP 4.4.2/Apache (http://www.rosamusic.cz/
> > info.php). On my local Apache and on a test server the app was working
> > like a charm. Could it be that I and the test server have PHP5
> > installed? I'm not aware of using any PHP5-specific features in this
> > app...
>
> > Anybody experienced something similar?


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



Cookies

2007-04-19 Thread strykstaguy

Anyone familiar with RosSoft's Cookie Component ? I am trying to use
it with CakePHP 1.1.14.4797.

The error I am getting is

Notice: Undefined property: CookieComponent::$crypt in E:\Program Files
\xampp\htdocs\dts\app\controllers\components\cookie.php on line 97

Fatal error: Call to a member function decrypt() on a non-object in E:
\Program Files\xampp\htdocs\dts\app\controllers\components\cookie.php
on line 97

and the lines of code (partial) is

function read($name,$unserialize=true)
{
if(isset($_COOKIE[$name]))
{
if ($unserialize)
{
$string=$_COOKIE[$name];
if (get_magic_quotes_gpc())
{
$string = stripslashes($string);
}

if ($this->crypt_key)
{

$string=$this->crypt->decrypt($this->crypt_key,$string);
}
[EMAIL PROTECTED]($string);
return $string;
}
else
{
return $_COOKIE[$name];
}

}
else
{
return null;
}
}

I have no clue what is wrong, can anyone lead me in the right
direction?


--~--~-~--~~~---~--~~
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: $number->precission not working in controller

2007-04-19 Thread Joshua McFarren

Ok, ok, I looked again at the manual and helpers are mean to provide
functions that are commonly needed in views etc. So I guess this was
stupid not easy. Also I misspelled precision in the subject AND my
corner cases are not fully checked ($,100,000.0) with that regex!

Still... does anyone have a suggestion for a way to make sure totaldue
is rendered in two decimal places?


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



$number->precission not working in controller

2007-04-19 Thread Joshua McFarren

This is probably an easy answer but I give up. Why doesn't the number
helper work in my controller when it works fine in my views?

class InvoicesController extends AppController {
var $name = 'Invoices';
var $helpers = array('Html', 'Form', 'Javascript', 'Ajax', 'Number');
...
$totaldue = 0;
foreach ($this->Invoice->findAll('status!=2', NULL, NULL) as $row)
{  // for each invoice thats not paid
$totaldue += preg_replace("/(\\$|,)/", "", $row['Invoice']
['total']); // turn each invoice total into a float and sum them
}
$this->set('totaldue', strrev(preg_replace("/(\d{3})/", "$1,",
strrev($number->precision($totaldue, 2); // add commas to total
and set it
...
}

If I change $number->precision($totaldue, 2) to just $totaldue there
are no errors by the way.


--~--~-~--~~~---~--~~
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: Passing data from controller to view

2007-04-19 Thread Geoff Ford

How are you accessing the data in the view.  It is ussually accessed
like



To ouptut the name field of the customer table.



On Apr 20, 12:22 pm, ben <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a newbie question.
>
> In my controller, when I do a set() like,
>
> $customers = $this->Customer->findAll();
> $this->set('customers', $customers);
>
> I cannot access $customers in my view. I get an error saying undefined
> variable. However when I set it in the data, I can access it fine.
>
> $this->data = $customers;
>
> Same thing with flash and other data that needs to be passed from
> controller to view.
>
> Please help!!!
>
> Thanks,
> Ben


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



submitting Ajax->form with javascript freezes browser

2007-04-19 Thread [EMAIL PROTECTED]

I have an ajax form that i want to submit using javascript. I created
a input button that onclick submits my form. When i use this method
(button test1) firefox freezes/crashes. If i click the normal submit
button, everything works as expected.

Why cant i submit the ajax form via javascript? Is there a work
around.

Below is what my code looks like.

form( '/test/controls',
'POST',
array(  'update' => 'controls',
   'name' => 'controls_form')) ?>







--~--~-~--~~~---~--~~
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: Unbinding Behaviors

2007-04-19 Thread Dr. Tarique Sani

On 4/19/07, Mariano Iglesias <[EMAIL PROTECTED]> wrote:
>
> Am I insane or you are always looking to change method names? ;)
>

You are insane! 

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

--~--~-~--~~~---~--~~
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: Your client and cakePHP

2007-04-19 Thread Chris Lamb
beetlecube wrote:

> Have you received complaints from the client, when they have tried to
> add a page on their own, ? like: "This cakephp stuff is complicated,
> and I just want to add another page that accesses the database, and I
> didn't know you have to create three different files for it.

I haven't had this problem. The MVC architecture is reasonably sane once
you have got your head around it. Curiously, citing the popularity of
Rails and using some of that buzz helps.

Regards,

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Passing data from controller to view

2007-04-19 Thread ben

Hi,

I have a newbie question.

In my controller, when I do a set() like,

$customers = $this->Customer->findAll();
$this->set('customers', $customers);

I cannot access $customers in my view. I get an error saying undefined
variable. However when I set it in the data, I can access it fine.

$this->data = $customers;

Same thing with flash and other data that needs to be passed from
controller to view.

Please help!!!

Thanks,
Ben


--~--~-~--~~~---~--~~
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: Silly HTTPS quesiton...

2007-04-19 Thread Paul Webster

Jolly Good question that, one I have just these last few weeks had to
tackle. I searched around a bit on the subject and came up with a few
articles - none of which really did exactly what I wanted, and I figured
it just had to be easy than this. 

So in my webroot htaccess I added the following two lines to do most of
the magic for me (this is not complete but these are the lines that do
it):

RewriteRule ^secure/(.*)$ https://domain.com/$1 [QSA,L]
RewriteRule ^ns/(.*)$ http://domain.com/$1 [QSA,L]

When I want to go to a secure econnection
I call my link

http://domain.com/secure/controller/action

and I get redirected to the HTTPS connection

https://domain.com/controller/action

and to get back to HTTP I call

https://domain.com/ns/controller/action

and I get redirected to the HTTP connection

http://domain.com/controller/action

then in my controller beforeFilter, actions or in my app_controller I
can enforce this by doing:


if (!env("HTTPS")) {
$this->redirect('secure/controller/action');
}



Like I said, this may not be the "best practice" way to do it, but to me
it did it good enough given the situation I was addressing. Criticism
and feedback most welcome.

Hope its helpful to you.


websta*




-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Friday, 20 April 2007 11:51 a.m.
To: Cake PHP
Subject: Silly HTTPS quesiton...


Upon login, I'd like to send a user to a HTTPS url for a secure
connection. All subsequent links around the site need to maintain
this. How is this accomplished in cake?




__ NOD32 2205 (20070419) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.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: Silly HTTPS quesiton...

2007-04-19 Thread Mariano Iglesias

I did this some months ago:

http://groups.google.com/group/cake-php/browse_thread/thread/f603fbcad492144
f

But in your case if you are redirecting them to HTTPS then Cake will keep
that since its links do not include http:// portion.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de [EMAIL PROTECTED]
Enviado el: Jueves, 19 de Abril de 2007 08:51 p.m.
Para: Cake PHP
Asunto: Silly HTTPS quesiton...

Upon login, I'd like to send a user to a HTTPS url for a secure
connection. All subsequent links around the site need to maintain
this. How is this accomplished 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
-~--~~~~--~~--~--~---



Manipulation of conditions - question for Cake development team

2007-04-19 Thread Langdon Stevenson

I have a situation where I would like to achieve the following query:

SELECT [fields]
FROM [Model]
WHERE CONCAT([Model.field], 'some value') IN ([List of Values])

Given the way that specifying an array of conditions works currently in 
Cake I cannot achieve this output.  Instead I write out the full 
condition as a string in my controller and pass it to the query.  This 
is messy and error prone, but works for now.

My question:

Does the Cake development team see any benefit in adding the ability to 
Cake to manipulate the field name in a conditions array?

If so, then I will have a crack at building it and submit if for 
consideration.  If not, then I will just hack together a solution for my 
problem.

Regards,
Langdon


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



Documentation for HABTM deleteQuery syntax is where, exactly?

2007-04-19 Thread [EMAIL PROTECTED]

http://www1.thedilly.com/pics/this-is-why-this-method-sucks.png

Google wont let me reply to topics, so here's a new one with my own
problem. I can't find documentation on how to use the deleteQuery
under the HABTM relationship defined in the model. Where is the syntax
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
-~--~~~~--~~--~--~---



migration of website

2007-04-19 Thread laptop

hey guys,

i want to port my current website over to cakephp and add some nify
features along the way, however Im not fully inside the cake paradigm
yet and so want to do things the best way, the first wall I have hit
is..

1. I have two different types of users, they are relative the same
however some can access certain features of the site. They also show a
different welcome box in the top right of the screen. I was thinking
of putting the User and UserTrainer model into my app_controller and
passing it to every view?? I would then have a path to the welcome box
template in each model what components are available that I can
use???

2. What is the best way to integrate PHP with the likes of vbulletin
and word press??

thanks,
craig


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



Silly HTTPS quesiton...

2007-04-19 Thread [EMAIL PROTECTED]

Upon login, I'd like to send a user to a HTTPS url for a secure
connection. All subsequent links around the site need to maintain
this. How is this accomplished 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: Manual invalidate in 1.2

2007-04-19 Thread GreyCells

Rather than fighting the framework, why not use two non database
fields in your form - new_passwd and confirm_passwd. Validate these
fields if they are set in validates() - raising validation errors
($this->invalidate('new_passwd', 'error_msg'))  if they don't match/
too short/weak etc. Then (again) if new_passwd and confirm_passwd
fields are not empty, set the database passwd field to your hash in
beforeSave().

~GreyCells

On Apr 19, 9:31 pm, hepper <[EMAIL PROTECTED]> wrote:
> If some could explain hove to invalidate a field manual in the
> controller in 1.2.
> In 1.1 you could invalidate a field and then call save without
> parameters, then set wouldn't be called and the invalidated fields
> didn't get erased as nate explains 
> herehttp://groups.google.com/group/cake-php/browse_thread/thread/354a677b...
> But in 1.2 it changed so set() always will be called.
>
> I'm trying to create a user register action and if password =
> password2 then password will be transformed to a md5 hash.
> If the user name already registered then the password should be reset
> to the unhashed saved in a temp var.
>
> I know that I could invalidate in the beforeValidate() callback but I
> can't change the data back there (I think at least)
>
> Thankful for the 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: Correct component usage?

2007-04-19 Thread Poncho

Agreed,

Jcs is correct, data-related tasks should be taken care of in the
model. In this case, you could re-use the getArea method in your model
like so:

function getArea($id)
{
$this->id = $id;
switch ($this->data['type'])
{
case 'rect':
return ($this->data['width'] * $this-
>data['height']);
break;

case 'circle':
$piR = (pi * ($this->data['width'] /
2));
return ($piR * $piR);
break;

default:
return ($this-data['width'] * $this-
>data['height']);
break;
}
}

On Apr 19, 11:18 pm, jcsiegrist <[EMAIL PROTECTED]> wrote:
> I think the property calculations belong into the model. Maybe an even
> better place would the new 1.2 behaviors. Either way you  calculate
> the properties within the callbacks afterFind, or if you decide to
> store the calculation results in the db after all you can just call
> your calculation routines in beforeSave callback and set the
> appropriate fields. The Calculation routines could either stay in the
> Rectangles Model or if also used elsewhere they could go into the
> AppModel.
>
> Another way could be, e.g. you have a Lumber Model that actsAs a
> Rectangle. Here all the Rectangle specific behaviors go into the
> Rectangle behavior. Then you could have other models make use of the
> rectangle behavior as well. The bakery has some excellent examples of
> behaviors in 1.2.
>
> I hope I'm not talking nonsense, as it is getting late...
>
> :jcs
>
> On 19 Apr., 21:53, bej78729 <[EMAIL PROTECTED]> wrote:
>
> > I am trying to get my head wrapped around using components.
>
> > I've got a table of rectangles. A typical record would be an id,
> > width, and height:
> > id : 2x4
> > b: 1.5
> > h: 3.5
>
> > I've got the typical setup:
> > M: Rectangle
> > C: RectanglesController
> > V: index, add, edit, view
>
> > I would like to calculate other properties of a rectange like
> > perimeter, area, moment of inertia, etc. I do not need to store these
> > in the database, since they are derived from b & h.
>
> > For my view.thtml view I'd like to see something like:
> > id : 2x4
> > b: 1.5 in
> > h: 3.5 in
> > A: 5.25 in^2
> > Sx: 3.063 in^3
> > etc.
>
> > I'd like to create a Rectangle class/object to encapsulate these
> > properties. Is a Component the best place to do this? Can I put it in /
> > components/rectangle.php and call it:
>
> > class Rectangle extends Object ...? Or will there be a name confict
> > since the Model is also called Rectangle?
>
> > For the sake of eliminating confusion I'm calling the component Foo.
> > Here's what I've got which doesn't work:
>
> > In the controller:
>
> > var $components = array('Foo');
>
> > function index()
> > {
> > $recordset = $this->Rectangle->findAll(null, null, 'id 
> > ASC');
>
> >  // Calculate additional rectangle properties and add them
> > to the recordset
> > foreach ($recordset as $record => $values)
> > {
> > $rect = $this->Foo($values['b'], $values['h']);
> > $values['A'] = $rect->A;
> > }
>
> > $this->set('rectangles', $recordset);
> > }
>
> > I'd like to instantiate the Foo object like $rect = new Foo($width,
> > $height) but I don't know how to do this in the controller.
>
> > Any light that could be shed on this would be appreciated.
>
> > Thanks, Brian


--~--~-~--~~~---~--~~
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: Correct component usage?

2007-04-19 Thread jcsiegrist

I think the property calculations belong into the model. Maybe an even
better place would the new 1.2 behaviors. Either way you  calculate
the properties within the callbacks afterFind, or if you decide to
store the calculation results in the db after all you can just call
your calculation routines in beforeSave callback and set the
appropriate fields. The Calculation routines could either stay in the
Rectangles Model or if also used elsewhere they could go into the
AppModel.

Another way could be, e.g. you have a Lumber Model that actsAs a
Rectangle. Here all the Rectangle specific behaviors go into the
Rectangle behavior. Then you could have other models make use of the
rectangle behavior as well. The bakery has some excellent examples of
behaviors in 1.2.

I hope I'm not talking nonsense, as it is getting late...

:jcs

On 19 Apr., 21:53, bej78729 <[EMAIL PROTECTED]> wrote:
> I am trying to get my head wrapped around using components.
>
> I've got a table of rectangles. A typical record would be an id,
> width, and height:
> id : 2x4
> b: 1.5
> h: 3.5
>
> I've got the typical setup:
> M: Rectangle
> C: RectanglesController
> V: index, add, edit, view
>
> I would like to calculate other properties of a rectange like
> perimeter, area, moment of inertia, etc. I do not need to store these
> in the database, since they are derived from b & h.
>
> For my view.thtml view I'd like to see something like:
> id : 2x4
> b: 1.5 in
> h: 3.5 in
> A: 5.25 in^2
> Sx: 3.063 in^3
> etc.
>
> I'd like to create a Rectangle class/object to encapsulate these
> properties. Is a Component the best place to do this? Can I put it in /
> components/rectangle.php and call it:
>
> class Rectangle extends Object ...? Or will there be a name confict
> since the Model is also called Rectangle?
>
> For the sake of eliminating confusion I'm calling the component Foo.
> Here's what I've got which doesn't work:
>
> In the controller:
>
> var $components = array('Foo');
>
> function index()
> {
> $recordset = $this->Rectangle->findAll(null, null, 'id ASC');
>
>  // Calculate additional rectangle properties and add them
> to the recordset
> foreach ($recordset as $record => $values)
> {
> $rect = $this->Foo($values['b'], $values['h']);
> $values['A'] = $rect->A;
> }
>
> $this->set('rectangles', $recordset);
> }
>
> I'd like to instantiate the Foo object like $rect = new Foo($width,
> $height) but I don't know how to do this in the controller.
>
> Any light that could be shed on this would be appreciated.
>
> Thanks, Brian


--~--~-~--~~~---~--~~
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: Correct component usage?

2007-04-19 Thread Poncho

Hey Brian,

At the moment, there is no standard way to send parameters to your
component on instantiation, but Cake 1.2 will very soon introduce the
"initialize" method in the component, so it's a safe bet to use that.
Here is a quick shape component I threw together.

controller =& $controller;
}

function initialize($settings = array())
{
if (is_array($settings) && !empty($settings))
{
foreach($settings as $key => $val)
{
$this->$key = $val;
}
}
}

function getArea()
{
switch ($this->type)
{
case 'rect':
return ($this->width * $this->height);
break;

case 'circle':
$piR = (pi * ($this->width / 2));
return ($piR * $piR);
break;

default:
return ($this->width * $this->height);
break;
}
}
}
?>

Use it like so:

data = $this->Rectangle->findAll()

foreach($this->data as $key => $row)
{
$this->Shape->initialize(array(
'width' => $row['Rectangle']['width'],
'height' => $row['Rectangle']['height'])
);

$extra[$key]['area'] = $this->Shape->getArea();
}
$this->data = array_merge($this->data, $extra);
$this->set('data', $this->data);
}
}
?>

Unfortunately, I haven't tested this code, but I hope it gives you an
idea or two :)

Cheers;
Poncho

On Apr 19, 8:53 pm, bej78729 <[EMAIL PROTECTED]> wrote:
> I am trying to get my head wrapped around using components.
>
> I've got a table of rectangles. A typical record would be an id,
> width, and height:
> id : 2x4
> b: 1.5
> h: 3.5
>
> I've got the typical setup:
> M: Rectangle
> C: RectanglesController
> V: index, add, edit, view
>
> I would like to calculate other properties of a rectange like
> perimeter, area, moment of inertia, etc. I do not need to store these
> in the database, since they are derived from b & h.
>
> For my view.thtml view I'd like to see something like:
> id : 2x4
> b: 1.5 in
> h: 3.5 in
> A: 5.25 in^2
> Sx: 3.063 in^3
> etc.
>
> I'd like to create a Rectangle class/object to encapsulate these
> properties. Is a Component the best place to do this? Can I put it in /
> components/rectangle.php and call it:
>
> class Rectangle extends Object ...? Or will there be a name confict
> since the Model is also called Rectangle?
>
> For the sake of eliminating confusion I'm calling the component Foo.
> Here's what I've got which doesn't work:
>
> In the controller:
>
> var $components = array('Foo');
>
> function index()
> {
> $recordset = $this->Rectangle->findAll(null, null, 'id ASC');
>
>  // Calculate additional rectangle properties and add them
> to the recordset
> foreach ($recordset as $record => $values)
> {
> $rect = $this->Foo($values['b'], $values['h']);
> $values['A'] = $rect->A;
> }
>
> $this->set('rectangles', $recordset);
> }
>
> I'd like to instantiate the Foo object like $rect = new Foo($width,
> $height) but I don't know how to do this in the controller.
>
> Any light that could be shed on this would be appreciated.
>
> Thanks, Brian


--~--~-~--~~~---~--~~
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: Cake app not running, index.php offered for download

2007-04-19 Thread Poncho

Hey Daniel,

Are you sure the Apache Server is configured to catch .php files and
use them in DirectoryIndex?
It sounds like you need to add something like the following to
a .htaccess file:

LoadModule php4_modulelibexec/httpd/libphp4.so
AddModule mod_php4.c

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


DirectoryIndex index.html index.php



Add those lines to a .htaccess file in the www directory of the
webserver and see if that helps. Reply here if you don't get the
desired result.

Cheers;
Poncho

On Apr 19, 7:46 pm, "Daniel Kvasnicka jr."
<[EMAIL PROTECTED]> wrote:
> I've installed a Cake app to a client's server and I'm getting a blank
> screen with mod_rewrite and index.php offered for download without
> mod_rewrite.
>
> The server is using PHP 4.4.2/Apache (http://www.rosamusic.cz/
> info.php). On my local Apache and on a test server the app was working
> like a charm. Could it be that I and the test server have PHP5
> installed? I'm not aware of using any PHP5-specific features in this
> app...
>
> Anybody experienced something similar?


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



Display multiple levels with adjacency list model

2007-04-19 Thread Poncho

Hey guys,

This may be a stupid question, but I've looked around the internet and
Googled with no results.

I want to show a complete hierarchy of the Pages model. I want it to
be displayed using s with 'root', 'parent', 'child' &
'grandchild' css classes set. I have tried using Cake's built-in
findByAllThreaded but I have only managed to get down to the 'child'
level when I want to go down as far as the 'grandchild' level.

Any pointers would be appreciated.

So far the code I have for it is:
function admin_index()
{
$this->Page->unbindAll();
$this->data = $this->Page->findAllThreaded(null, array('Page.id',
'Page.parent_id', 'Page.title', 'Page.slug','Page.created'),
'Page.created ASC');
$this->set('data',$this->data);
}

The table structure looks like this:
Field Type   NullKey
Default Extra
id   int(11) unsigned PRI
NULLauto_increment
parent_id int(11) unsigned  YES   NULL
titlevarchar(255)YES
NULL
slug   varchar(255)YES   NULL
content text
created datetime
-00-00 00:00:00
modified  datetime
-00-00 00:00:00

Cheers;
Poncho


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



Manual invalidate in 1.2

2007-04-19 Thread hepper

If some could explain hove to invalidate a field manual in the
controller in 1.2.
In 1.1 you could invalidate a field and then call save without
parameters, then set wouldn't be called and the invalidated fields
didn't get erased as nate explains here
http://groups.google.com/group/cake-php/browse_thread/thread/354a677b21779c0/74026959422e1e0e?lnk=gst&q=invalidate&rnum=1
But in 1.2 it changed so set() always will be called.

I'm trying to create a user register action and if password =
password2 then password will be transformed to a md5 hash.
If the user name already registered then the password should be reset
to the unhashed saved in a temp var.

I know that I could invalidate in the beforeValidate() callback but I
can't change the data back there (I think at least)

Thankful for the 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
-~--~~~~--~~--~--~---



Correct component usage?

2007-04-19 Thread bej78729

I am trying to get my head wrapped around using components.

I've got a table of rectangles. A typical record would be an id,
width, and height:
id : 2x4
b: 1.5
h: 3.5

I've got the typical setup:
M: Rectangle
C: RectanglesController
V: index, add, edit, view

I would like to calculate other properties of a rectange like
perimeter, area, moment of inertia, etc. I do not need to store these
in the database, since they are derived from b & h.

For my view.thtml view I'd like to see something like:
id : 2x4
b: 1.5 in
h: 3.5 in
A: 5.25 in^2
Sx: 3.063 in^3
etc.

I'd like to create a Rectangle class/object to encapsulate these
properties. Is a Component the best place to do this? Can I put it in /
components/rectangle.php and call it:

class Rectangle extends Object ...? Or will there be a name confict
since the Model is also called Rectangle?

For the sake of eliminating confusion I'm calling the component Foo.
Here's what I've got which doesn't work:

In the controller:

var $components = array('Foo');

function index()
{
$recordset = $this->Rectangle->findAll(null, null, 'id ASC');

 // Calculate additional rectangle properties and add them
to the recordset
foreach ($recordset as $record => $values)
{
$rect = $this->Foo($values['b'], $values['h']);
$values['A'] = $rect->A;
}

$this->set('rectangles', $recordset);
}

I'd like to instantiate the Foo object like $rect = new Foo($width,
$height) but I don't know how to do this in the controller.

Any light that could be shed on this would be appreciated.

Thanks, Brian


--~--~-~--~~~---~--~~
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: scaffold in admin

2007-04-19 Thread hydra12

I'm not sure if I understand exactly what you want, but here goes: if
you want to scaffold your admin_ views but not any of your other
views, I don't think you can (officially).  When you scaffold a
controller, it scaffolds everything (I think).  What you can do is use
bake to create your basic controllers and views.  This builds the
scaffolding for you, and you can then modify the code.

I hope that helps.
hydra12


On Apr 19, 12:07 pm, LLoBu <[EMAIL PROTECTED]> wrote:
> I´m using CAKE_ADMIN to protect admin scaffold.
>
> I don´t know how to use in, for example:
>
> class Travels_Controller extends AppController {
>   function index(){
> // show all travels
>   }
>
>   function show_one($id){
> // controller to show one travel
>   }
>
>   function admin_travels(){
> // here i´d like scaffolding
>   }
>
> }
>
> I´m wasting a lot of time trying to scaffold inside an admin method, I
> hope someone would help me to do this and other sections like fly
> tickets and another.
>
> That´s my opinion, but I´m openmind to other solutions, because it´s
> simple, I just need to show  three sections and administrator to
> scaffold them.
>
> Thanks to everyone.


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



Cake app not running, index.php offered for download

2007-04-19 Thread Daniel Kvasnicka jr.

I've installed a Cake app to a client's server and I'm getting a blank
screen with mod_rewrite and index.php offered for download without
mod_rewrite.

The server is using PHP 4.4.2/Apache (http://www.rosamusic.cz/
info.php). On my local Apache and on a test server the app was working
like a charm. Could it be that I and the test server have PHP5
installed? I'm not aware of using any PHP5-specific features in this
app...

Anybody experienced something similar?


--~--~-~--~~~---~--~~
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: setAction - reading the parameters

2007-04-19 Thread Mariano Iglesias

Of course:

  function delete($id = null)
  {
$this->setAction('manage_employees', $deleted_employee);  
  }

  function manage_employees($deleted_employee)
  {
  }

You don't need to use func_get_args

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de [EMAIL PROTECTED]
Enviado el: Jueves, 19 de Abril de 2007 03:20 p.m.
Para: Cake PHP
Asunto: setAction - reading the parameters


Hi all,

When using setAction to redirect to another controller action, the
parameters are passed such that they can be retrieved via
func_get_args().

Looks like this:


  // the delete action should be redirected to the manage action
  function delete($id = null)
  {
$this->setAction('manage_employees', $deleted_employee);
//$this->redirect('employees/manage_employees');
  }

  // the parameter is read via func_get_args()
  function manage_employees()
  {
$args = func_get_args();
$delete_employee = $args[0];
   }


Is there a better way to access the passed parameter in the action
manage_employees above - other than $args[0]?

Thanks,
Quang



__ Información de NOD32, revisión 2205 (20070419) __

Este mensaje ha sido analizado con  NOD32 antivirus system
http://www.nod32.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
-~--~~~~--~~--~--~---



setAction - reading the parameters

2007-04-19 Thread [EMAIL PROTECTED]

Hi all,

When using setAction to redirect to another controller action, the
parameters are passed such that they can be retrieved via
func_get_args().

Looks like this:


  // the delete action should be redirected to the manage action
  function delete($id = null)
  {
$this->setAction('manage_employees', $deleted_employee);
//$this->redirect('employees/manage_employees');
  }

  // the parameter is read via func_get_args()
  function manage_employees()
  {
$args = func_get_args();
$delete_employee = $args[0];
   }


Is there a better way to access the passed parameter in the action
manage_employees above - other than $args[0]?

Thanks,
Quang


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



scaffold in admin

2007-04-19 Thread LLoBu

I´m using CAKE_ADMIN to protect admin scaffold.

I don´t know how to use in, for example:

class Travels_Controller extends AppController {
  function index(){
// show all travels
  }

  function show_one($id){
// controller to show one travel
  }

  function admin_travels(){
// here i´d like scaffolding
  }
}

I´m wasting a lot of time trying to scaffold inside an admin method, I
hope someone would help me to do this and other sections like fly
tickets and another.

That´s my opinion, but I´m openmind to other solutions, because it´s
simple, I just need to show  three sections and administrator to
scaffold them.

Thanks to everyone.


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



Bad link without mod rewrite

2007-04-19 Thread sickrandir

I'm running a site with the latest stable version of cake 1.1 .
I disabled mod rewrite by uncommenting: define ('BASE_URL',
env('SCRIPT_NAME')); in core.php and deleting all the .htaccess file.
Everything seems to work except for the link inserted in the posts of
the home page.
The first time you load the home page the links don't have the
"index.php/" part, so they are broken.
But if you browse another page of the site from the menu and you
return on the home page then the links are correct.
Links are insertedi in the posts like this: Missuldisc07
Someone has any suggestion to avoid this strange behaviour?
My site is: http://www.frasbadallac.it

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: How to user model in components

2007-04-19 Thread Genius_kld

Thank U!
I found solution!
url is useful;

On 19 апр, 19:49, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> I am in no way endorsing this as a good way to go (I say this so Nate
> will not bite my head off)  but look at this
>
> 
>
> On 4/19/07, Genius_kld <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On 19 апр, 19:15, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> > > Did you search the google group for some help?  See if there is any help 
> > > here
>
> > > 
>
> > nothing useful found;
>
> > this realisation works:
>
> >   function startup(&$controller)
> > {
> > $this->User = $controller->User;
> > }
>
> > but I don't want to include 'User' model for each controller.
>
> --
> (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/


--~--~-~--~~~---~--~~
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 to user model in components

2007-04-19 Thread Samuel DeVore
I am in no way endorsing this as a good way to go (I say this so Nate
will not bite my head off)  but look at this



On 4/19/07, Genius_kld <[EMAIL PROTECTED]> wrote:
>
> On 19 апр, 19:15, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> > Did you search the google group for some help?  See if there is any help 
> > here
> >
> > 
> >
>
>
> nothing useful found;
>
> this realisation works:
>
>   function startup(&$controller)
> {
> $this->User = $controller->User;
> }
>
> but I don't want to include 'User' model for each controller.
>
>
> >
>


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

--~--~-~--~~~---~--~~
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 to user model in components

2007-04-19 Thread Genius_kld

On 19 апр, 19:15, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> Did you search the google group for some help?  See if there is any help here
>
> 
>


nothing useful found;

this realisation works:

  function startup(&$controller)
{
$this->User = $controller->User;
}

but I don't want to include 'User' model for each controller.


--~--~-~--~~~---~--~~
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 to user model in components

2007-04-19 Thread Samuel DeVore

Did you search the google group for some help?  See if there is any help here



On 4/19/07, Genius_kld <[EMAIL PROTECTED]> wrote:
>
> how to USE
>
> sorry
>
>
> >
>


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

--~--~-~--~~~---~--~~
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 to user model in components

2007-04-19 Thread Genius_kld

how to USE

sorry


--~--~-~--~~~---~--~~
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: Unbinding Behaviors

2007-04-19 Thread Mariano Iglesias

Touché.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Samuel DeVore
Enviado el: Jueves, 19 de Abril de 2007 12:41 p.m.
Para: cake-php@googlegroups.com
Asunto: Re: Unbinding Behaviors

>
> Am I insane or you are always looking to change method names? ;)
>

Do we  only get to pick one?


--~--~-~--~~~---~--~~
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 to user model in components

2007-04-19 Thread Genius_kld

hi!

How can I use model 'User' in my Authorize component?

var $uses = array('User');
doesn't work

so, $this->User->find(...) in component makes error: Call to a member
function findCount() on a non-object in...

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



Re: Unbinding Behaviors

2007-04-19 Thread Samuel DeVore

On 4/19/07, Mariano Iglesias <[EMAIL PROTECTED]> wrote:
>
> Am I insane or you are always looking to change method names? ;)
>

Do we  only get to pick one?

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

--~--~-~--~~~---~--~~
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: Unbinding Behaviors

2007-04-19 Thread Mariano Iglesias

Am I insane or you are always looking to change method names? ;)

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de Dr. Tarique Sani
Enviado el: Jueves, 19 de Abril de 2007 11:30 a.m.
Para: cake-php@googlegroups.com
Asunto: Re: Unbinding Behaviors

Whats with this obscure naming? how about actAs() and dontActAs() ;)


--~--~-~--~~~---~--~~
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: validate with SwfUpload

2007-04-19 Thread eKiTeL

thanks Tarique!


--~--~-~--~~~---~--~~
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: findAll for hasOne - belongsTo

2007-04-19 Thread [EMAIL PROTECTED]

$this->Rubric->hasMany['Post']['limit'] = 1;
then
$this->Rubric->findAll('id=1','','',1); (with limit = 1 and for Rubric
& for associated posts ;-)

Sorry for all, and thanls Madman for comments (in icq)

On 19 апр, 17:13, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have to table:
>
> Ribrics & Post
>
> Post belongsTo Rubric
>
> and, of couse Rubric = hasMany Post.
>
> So. When I ask:
>
> $data = $this->Rubric->findAll('id = 1','','',1);
>
> I get 2 query:
>
> First with LIMIT = 1
>
> SELECT `Rubric`.`id`, `Rubric`.`title` FROM `rubrics` AS `Rubric`
> WHERE id = 1 LIMIT 1
>
> And second - without Limit ;-(
>
> SELECT `Post`.`id` ... FROM `posts` AS `Post` WHERE `Post`.`rubric_id`
> = '1'
>
> But I need only one post... How to make this query for LIMIT work in
> both queries?
>
> Or where I'm 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
-~--~~~~--~~--~--~---



Re: Unbinding Behaviors

2007-04-19 Thread Dr. Tarique Sani

On 4/19/07, Mariano Iglesias <[EMAIL PROTECTED]> wrote:
> It doesn't sound bad to implement an unbindBehavior(), bindBehavior(), what
> do you think gwoo?

Whats with this obscure naming? how about actAs() and dontActAs() ;)

T

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

--~--~-~--~~~---~--~~
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: Error while uploading files

2007-04-19 Thread Samuel DeVore

http://us2.php.net/manual/en/features.file-upload.errors.php

don't forget that the php in CakePHP is for PHP and many answers can
also be found at http://php.net

wink wink

On 4/19/07, Davide <[EMAIL PROTECTED]> wrote:
>
> I've developed a simple file upload. Everything in development and
> test environment goes fine but not in production environment.
>
> The procedure is the simple move_uploaded_file() plus some operations
> on database. It failed to upload and In logs I got the following
>
> 2007-04-19 16:12:35 [UploadsController->add()] Error: Array
> (
> [Upload] => Array
> (
> [id] =>
> [file] => Array
> (
> [name] => Volantino03062006.pdf
> [type] =>
> [tmp_name] =>
> [error] => 6
> [size] => 0
> )
>
> )
>
> )
>
> Where can I get a translations of error field? I've done a search but
> without success.
>
> Thanks a lot
> Davide
>
>
>
>
>
> >
>


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

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



Error while uploading files

2007-04-19 Thread Davide

I've developed a simple file upload. Everything in development and
test environment goes fine but not in production environment.

The procedure is the simple move_uploaded_file() plus some operations
on database. It failed to upload and In logs I got the following

2007-04-19 16:12:35 [UploadsController->add()] Error: Array
(
[Upload] => Array
(
[id] =>
[file] => Array
(
[name] => Volantino03062006.pdf
[type] =>
[tmp_name] =>
[error] => 6
[size] => 0
)

)

)

Where can I get a translations of error field? I've done a search but
without success.

Thanks a lot
Davide





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



findAll for hasOne - belongsTo

2007-04-19 Thread [EMAIL PROTECTED]

I have to table:

Ribrics & Post

Post belongsTo Rubric

and, of couse Rubric = hasMany Post.

So. When I ask:

$data = $this->Rubric->findAll('id = 1','','',1);

I get 2 query:

First with LIMIT = 1

SELECT `Rubric`.`id`, `Rubric`.`title` FROM `rubrics` AS `Rubric`
WHERE id = 1 LIMIT 1

And second - without Limit ;-(

SELECT `Post`.`id` ... FROM `posts` AS `Post` WHERE `Post`.`rubric_id`
= '1'

But I need only one post... How to make this query for LIMIT work in
both queries?

Or where I'm 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
-~--~~~~--~~--~--~---



RE: Unbinding Behaviors

2007-04-19 Thread Mariano Iglesias

Yeah, but he'll also have to touch Model::behaviors as you can see here:

foreach ($this->actsAs as $behavior => $config) {
$className = $behavior . 'Behavior';
//...
$this->behaviors[$behavior] =& new $className;
}

Since model core code will always deal with this array and only use actsAs
when constructing to build that array.

So he'll have to deal with behaviors instead. Just now that you can do the
rebinding using the instance of the behavior located in the registry:

$this->behaviors[$behavior] =& ClassRegistry::getObject($className);

It doesn't sound bad to implement an unbindBehavior(), bindBehavior(), what
do you think gwoo?

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de gwoo
Enviado el: Jueves, 19 de Abril de 2007 02:08 a.m.
Para: Cake PHP
Asunto: Re: Unbinding Behaviors

how about changing $this->Model->actsAs?


--~--~-~--~~~---~--~~
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: Want to learn Cake PHP

2007-04-19 Thread Dr. Tarique Sani

On 4/19/07, Rumana <[EMAIL PROTECTED]> wrote:
>
> There is lots of tutorial for cake php, but for beginners there is no
> easy manual. can anyone help to learn cake php? plz help me.
>

Lets begin with some questions

How much of a beginner you are to PHP?
Which tutorials did you try and where did you get stuck?

T

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

--~--~-~--~~~---~--~~
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: Want to learn Cake PHP

2007-04-19 Thread Daniel Hofstetter

Try the blog tutorial from the manual: 
http://manual.cakephp.org/appendix/blog_tutorial
. It is for beginners.

Good luck :)

--
Daniel Hofstetter
http://cakebaker.42dh.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
-~--~~~~--~~--~--~---



Want to learn Cake PHP

2007-04-19 Thread Rumana

There is lots of tutorial for cake php, but for beginners there is no
easy manual. can anyone help to learn cake php? plz help me.


--~--~-~--~~~---~--~~
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: Global css navigation menu from DB

2007-04-19 Thread double07

Hi Andrew,

I tried what you suggested, unfortunately I still get the error
mentioned above.

Cheers.

On Apr 18, 10:22 pm, Andrew McCafferty <[EMAIL PROTECTED]>
wrote:
> Firstly, the $name of AppController isn't "Nodes" so remove that
> line...
>
> Try replacing it with:
>
> var $uses = array('Node');
>
> This should tell AppController to use your Node model, making the
> findAllThreaded function available.
>
> On 18 Apr, 06:17, double07 <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I'm trying to setup aglobalcssnavigation menu. Basically All my
> > pages for the site are in a table called 'nodes'. Each page has a
> > parent_id so I can use findAllThreaded() to generate an unordered list
> > using a 'tree' helper (http://bakery.cakephp.org/articles/view/64) I
> > found in the bakery.
>
> > Now when I set this up in a specific function within the Nodes
> > controller it works fine. example:
>
> > In the function 'edit' within the nodes controller I have this bit of
> > code:
> > $this->set('category_tree', $this->Node->generateList());
>
> > In my default layout page I have:
> > echo $tree->show('Node/title', $menu);
>
> > Obviously this only works when I'm in - /nodes/edit/x
>
> > What I want is to have that navigation available on every single page
> > so I don't have to set the menu variable in each function in each
> > controller. From my research around the place it seems that using
> > beforeFilter() in AppController is what I'm looking for, but I'm not
> > sure my syntax is correct as I get this error:
> > Notice: Undefined property: PagesController::$Node in C:\wamp\www\cake
> > \cake\app_controller.php on line 64
> > Fatal error: Call to a member function findAllThreaded() on a non-
> > object in C:\wamp\www\cake\cake\app_controller.php on line 64
>
> > In my app_controller.php file I have:
>
> > class AppController extends Controller {
>
> > var $name = 'Nodes';
> > var $components  = array('othAuth');
> > var $helpers = array('Html', 'OthAuth');
> > var $othAuthRestrictions = array( 'add','edit','delete');
>
> > function beforeFilter()
> > {
>
> > $this->set('menu', $this->Node->findAllThreaded()); //This is
> > the line in question
>
> > $auth_conf = array(
> > 'mode'  => 'oth',
> > 'login_page'  => '/users/login',
> > 'logout_page' => '/users/logout',
> > 'access_page' => '/',
> > 'hashkey' => 'MySEcEeTHaSHKeYz',
> > 'noaccess_page' => '/users/noaccess',
> > 'strict_gid_check' => false);
>
> > $this->othAuth->controller = &$this;
> > $this->othAuth->init($auth_conf);
> > $this->othAuth->check();
>
> > }
>
> > }
>
> > Could somebody please give me some pointers or tell me if I'm on the
> > right track. If not are there any suggestions to achieve what I'm
> > trying to do?
>
> > Thanks in advance.


--~--~-~--~~~---~--~~
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: Cake has lost its Way!

2007-04-19 Thread jazz_snob

I am having a similar problem, maybe you have some insight?

Installed cake in http://192.168.0.3/~tom/cake/cake by adding
RewriteBase /~tom/cake/cake to .htaccess in /home/tom/public_html/cake/
cake.

When i access http://192.168.0.3/~tom/cake/cake/users/register i get
404 error.

This noob appreciates any help you can offer.

Regards,
-Tom


--~--~-~--~~~---~--~~
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: Unbinding Behaviors

2007-04-19 Thread AD7six



On 19 abr, 01:14, cperler <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Might anyone know of a way to unbind a behavior from a model?
>
> Thank you,
>
> Craig

Hi Craig,

Could you explain why you would want to?

AFAIK there is no inbuilt mechanism to remove a behavior that has
already been added to a model. You could add a if (!$this->active)
return; type test to each method though.

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: allowEmpty in validate

2007-04-19 Thread GreyCells

This makes it nice an easy to filter (i.e. remove) empty fields Nate,
but it would be great to see Cake help developers maintain proper
database state. i.e.:

- change #2092 from allowBlank to allowNull

- in save() set any empty (as in they are set to an empty string)
fields to null, so the database column is set to NULL

I know this can all be done manually with regexp and beforeSave() -
but it really should be default behaviour.

Sorry if that sounds a bit rantish - but empty strings vs null (and
the lack of understanding thereof) cause me sooo many problems on
clients' legacy databases...

~GreyCells (aka TheDatabasePedant)

On Apr 18, 11:59 pm, nate <[EMAIL PROTECTED]> wrote:
> As of 1.2 current SVN:
>
> function beforeValidate() {
>$this->data[$this->name] = Set::filter($this->data[$this->name],
> true);
>return true;
>
> }
>
> Works for me.
>
> On Apr 18, 5:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Wow did you pick an ambiguous name for that then. Holy misleading
> > batman.
>
> > So how the heck do I do what I want to do? I can't help but think
> > enhancement/bug # 2092 is a "must have". I can't even think of a
> > workaround at the moment.
>
> > On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > > It technically means "allowNotPresent" as in "not present in the array
> > > of data to be saved", but I felt that was too cumbersome.
>
> > > rtconner wrote:
> > > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > > alowEmpty should be in the validate array in a model?
>
> > > > You would think it would set the behavior to allow you to submit an
> > > > empty string that passes validation. For example, you may either pass
> > > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > > not count as a phone number, but the phone number is not a required
> > > > field also.
>
> > > > ..but this is not the behavior I am seeing. As far as I can tell
> > > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > > the code in model and yes the code does not implement this behavior
> > > > either. I'm trying to determine if this is a bug or not.
>
> > > > So... how should allowEmpty cause things to behave?


--~--~-~--~~~---~--~~
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: sanitizing data with beforeValidate

2007-04-19 Thread ianh

http://pastebin.co.uk/13204

Usage:

Place method in your app_model and call with the beforeValidate
callback also placed in your app_model
function beforeValidate()
{
$this->__sanitize($this->data);
return true;
}

In every model of your app include the var $allowedChars = array(); In
this array name any fields for which special characters must be
allowed adn what those special characters are. The method includes
some "shortcuts" and you can combine multiple shortcuts etc to get the
desired outcome.

Differences from usage guidelines in my previous post are:

1) You can flag a field to be ignored (will be returned without being
passed through Sanitize::paranoid - essential for file uploads!
2) A "serialized" shortcut has been introduced that automatically
inserts all the characters you need for a serialized field into the
paranoid function.

Simple usage example:
var $allowedChars = array('emailfield' => array('.', '@', '-', '_'));

Complex usage example:
var $allowedChars = array('emailfield' => array('default'),
'descriptionfield' => array('default', 'textarea', 'markdown', '|'));

Shortcuts are:
default = basic chars used in most text fields including spaces,
punctuation etc;
datetime = basic chars used in datetime fields (' ', '-', ':')
textarea = allows line breaks to be passed through
markdown = for use when using markdown markup in your fields (nothing
avaialble for textile Im afraid)
serialized = for use when trying to save a set of serialized data.

Special shortcut
Ignore = doesnt send the field through paranoid and returns it "as
is". So far I have used that only for file upload fields.

Warnings:
Because of the way this method is called it will onyl work when saving
data and when the data validation callback is called. It will not work
when using inputs to search the database and it will not work if
beforeValidate is not called (e.g. saveField method by default does
not call beforeValidate). All use is entirely at your own risk I'm
afraid...

Let me know what you think or any improvements you can come up with.
Ian

On Apr 18, 7:20 pm, Poncho <[EMAIL PROTECTED]> wrote:
> Hey Ian,
>
> That code looks pretty nice, could you post the newer version you
> mentioned?
>
> Cheers;
> Poncho


--~--~-~--~~~---~--~~
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: allowEmpty in validate

2007-04-19 Thread GreyCells

You should care about empty strings. An empty string is not null, so
SELECT ... WHERE col IS NULL; will return a different record set to
SELECT ... WHERE col = ''; It will also effectively invalidates any
NOT NULL constraints on your database - an empty string is not null.

~GreyCells

On Apr 18, 11:13 pm, rtconner <[EMAIL PROTECTED]> wrote:
> Good call GreyCells. Thanks.
>
> I dont care if DB has NULL or an empty string. So that will work in
> this situation.
> Still would like to see bug 2092 implemented though.
>
> On Apr 18, 3:43 pm, GreyCells <[EMAIL PROTECTED]> wrote:
>
> > A possible workaround is to unset any empty fields in
> > beforeValidates() - validate will then ignore them if allowBlank is
> > set.
>
> > However, there is a conflict if you're also using beforeValidates() to
> > set blank fields to null (so they are null rather than an empty string
> > in the database) - depends if you're a pedantic db developer or not :)
>
> > ~GreyCells.
>
> > On Apr 18, 10:18 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > Wow did you pick an ambiguous name for that then. Holy misleading
> > > batman.
>
> > > So how the heck do I do what I want to do? I can't help but think
> > > enhancement/bug # 2092 is a "must have". I can't even think of a
> > > workaround at the moment.
>
> > > On Apr 18, 3:05 pm, nate <[EMAIL PROTECTED]> wrote:
>
> > > > It technically means "allowNotPresent" as in "not present in the array
> > > > of data to be saved", but I felt that was too cumbersome.
>
> > > > rtconner wrote:
> > > > > Hello, (in 1.2) does anyone know what the intended behavior of
> > > > > alowEmpty should be in the validate array in a model?
>
> > > > > You would think it would set the behavior to allow you to submit an
> > > > > empty string that passes validation. For example, you may either pass
> > > > > a valid phone number, or not send one at all. This was 'asdasda' does
> > > > > not count as a phone number, but the phone number is not a required
> > > > > field also.
>
> > > > > ..but this is not the behavior I am seeing. As far as I can tell
> > > > > allowEmpty does nothing to change the behavior. Actually I looked at
> > > > > the code in model and yes the code does not implement this behavior
> > > > > either. I'm trying to determine if this is a bug or not.
>
> > > > > So... how should allowEmpty cause things to behave?


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