Retrieving Posts with comments

2010-11-30 Thread Ernesto
Hello

i have a simple app that's very similar to the cookbook "Blog"
tutorial

i want to retrieve all Posts having at least one comment.

right now i'm doing this way:

$posts = $this->Post->find("all", array("contain" =>
array("Comment"));
foreach ($posts as $index => $post) {
 if (empty($post["Comment"])) unset $posts[$index];
}

is there any way to achieve this by using a single ->find() call?

notes: i'm using Containable.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Custom validation rules and saveAll

2010-09-30 Thread Ernesto
hello.

i have 2 models
Article hasMany Component

in my Component model i wrote a custom validation rule that relies on
data from Article model.
how can i get this data?
$this->Article->find doesn't work because that function loads data
from the database.. and i need the going-to-be-saved data array

note: i'm using "validate" => "first" in all my saveAlls

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cake flashing 2 different flash messages.

2010-09-05 Thread Ernesto
Hello.

i have a problem that can't resolve.

my app_controller::beforeFilter has a simple authorization script (ACL
is a total overkill in my case) that returns errors via a flash()
message.

my CRUD actions are defined in app_controller but one controller
doens't allow to delete items at all, so the Users::delete() flashes a
message like "Unable to delete a user".

if i try to load the Users::delete page, as user that doesn't have
even permissions to access that view, my app returns both flash
messages:

- Unable to access this page.
- Unable to delete user.

i just need the first one.
how to avoid this?

sry for my bad english.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


How to determine if the current page is a Flash() or not

2010-09-03 Thread Ernesto
Hello.

is there any way to determine if the current page is loaded by a
controller::flash() call?

i'm working in the controller::beforeRender().

Thx

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Stuck with a validation rule in secondary model

2010-07-12 Thread Ernesto
i solved using Classregistry::getObject("Item");

if there's any clever/lighter method let me know :P

On 12 Lug, 17:04, Ernesto  wrote:
> Hello.
>
> i have 2 models
>
> - Item hasMany Part
>
> my Item::add() view is something like this
>
> echo $form->input("code");
> echo $form->input("description");
> echo $form->input("require_length"); //this is a boolean input
> echo $form->input("require_width"); //this is a boolean input
> echo $form->input("Part.0.id");
> echo $form->input("Part.0.length");
> echo $form->input("Part.0.width");
> echo $form->input("Part.1.id");
> echo $form->input("Part.1.length");
> echo $form->input("Part.1.width");
> [...]
>
> and so on
>
> Part length should only be set if required by the item.
> so i need a Part validation rule that check if in the current data
> array Item::require_width is set or not.
> how can i get the Item's data from Part model?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Stuck with a validation rule in secondary model

2010-07-12 Thread Ernesto
Hello.

i have 2 models

- Item hasMany Part

my Item::add() view is something like this

echo $form->input("code");
echo $form->input("description");
echo $form->input("require_length"); //this is a boolean input
echo $form->input("require_width"); //this is a boolean input
echo $form->input("Part.0.id");
echo $form->input("Part.0.length");
echo $form->input("Part.0.width");
echo $form->input("Part.1.id");
echo $form->input("Part.1.length");
echo $form->input("Part.1.width");
[...]

and so on

Part length should only be set if required by the item.
so i need a Part validation rule that check if in the current data
array Item::require_width is set or not.
how can i get the Item's data from Part model?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


SaveAll weird behavior

2010-07-12 Thread Ernesto
Hello.

i have and app with 3 models, associated in this way

class Item extends AppModel {
var $name = "Item";
var $belongsTo = array("Category");
var $hasMany = array(
"Fathers" => array(
"className" => "Relationship",
"foreignKey" => "child_id"
),
"Childrens" => array(
"className" => "Relationship",
"foreignKey" => "father_id"
)
);
var $hasAndBelongsToMany = array("Colour");
}

Note that "Fathers" and "Childrens" are pointing to the same model
("Relationship").

now...

if i try to edit one of my items, with a Father relationship set. the
data won't update.
if i remove any father relationship my edit action will work properly.

i PRed the data in Item::beforeSave and everything looks ok.

any advice?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cannot get this find() to work :(

2010-07-08 Thread Ernesto
Hello.

i have this situation:

Order hasMany Insertions hasOne Article

i'm working in OrdersController
i want lo load all Articles with at least one Insertion in a specific
Order.
results should also be sorted by Article.code

how can i do?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


two way encryption in CakePHP

2010-07-05 Thread Ernesto
Hello.

is there any built-in function for crypt/decrypt strings?

i've only found a component

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Need CSV import: best practices?

2010-06-30 Thread Ernesto
Hello.
i need to import data from a CSV file in two of my app's model.

what's the best place to code the import routine?
- a behavior
- a vendor class
- appModel

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: need a little help with my OrderingComponent

2010-06-18 Thread Ernesto
i did it using a redirect

$controller->redirect(array(
"controller" => 
$controller->name,
"action" => "index",
"page:". 
$this->Session->read($sessionVar .".page"),
"sort:". 
$this->Session->read($sessionVar .".sort"),
"direction:". 
$this->Session->read($sessionVar .".direction")
));

On 17 Giu, 13:07, John Andersen  wrote:
> I would think that maybe initialize is too early!
> Have you tried to move it to the startup, which is invoked after
> beforeFilter()?
> I do all my component processing in the startup, only saving settings
> in the initialize method.
> Enjoy,
>    John
>
> On Jun 17, 1:07 pm, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i just wrote a simple component that keeps track of latest user's
> > sorts in every index view of every controller in my app
> > for example if an user sorts Orders by date_created (default is code)
> > the component will write in session
> > - the page the user was viewing
> > - the sort field
> > - the sort order
>
> > if the user goes back to to orders/index he should find the same page
> > as the last visit.
>
> > problem: i cannot find a working way to re-load the saved parameters
>
> > $controller->params["named"] = $this->Session->read("blahblahblah")
> > < doesn't work
> > $controller->paginate = $this->Session->read("foo") <-- doesn't work
> > either
>
> > i'm working in Component's initialize.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


need a little help with my OrderingComponent

2010-06-17 Thread Ernesto
Hello.

i just wrote a simple component that keeps track of latest user's
sorts in every index view of every controller in my app
for example if an user sorts Orders by date_created (default is code)
the component will write in session
- the page the user was viewing
- the sort field
- the sort order

if the user goes back to to orders/index he should find the same page
as the last visit.

problem: i cannot find a working way to re-load the saved parameters

$controller->params["named"] = $this->Session->read("blahblahblah")
< doesn't work
$controller->paginate = $this->Session->read("foo") <-- doesn't work
either

i'm working in Component's initialize.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Auth with dynamic homepage

2010-06-14 Thread Ernesto
Hello.

i have a simple app using AuthComponent.
this app has a lot of ->flash and ->redirect, most of them pointing to
"/"

is there any way i can modify the dispatcher homepage?
this will avoid 2134343 conditions in every flash or redirect.

i'm using cake 1.3.2

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Paginator, belongsTo and a model using data from an external DB

2010-05-31 Thread Ernesto
hello.

my app has 3 models:

- Order belongsTo Shipment
- Order belongsTo Customer

Customer data is retrieved from an external DB (customers are shared
across other non-php apps)

i'm trying to paginate results from Order::index();

when i order by Customer.name cake throws some SQL errors.

i bet the external db is the culprit, because paginator isn't loading
all data with one single query.

what can i do to avoid this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


model::updateAll not triggering model::beforeSave

2010-05-28 Thread Ernesto
Hello.

i noticed that model::updateAll isn't triggering model::beforeSave

is this a bug or an intended behavior?

alternatives? (right now i switched to model::save)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 404 error since updating to 1.3

2010-05-26 Thread Ernesto
are you guys using SecurityComponent?

On 26 Mag, 16:05, Ernesto  wrote:
> same problem here.
>
> rolled back to RC4 :)
>
> On 26 Mag, 12:24, Ed Propsner  wrote:
>
>
>
> > I just updated to 1.3 stable from RC4 yesterday and I've been having the
> > same exact problem (amongst a few others) ever since.
>
> > I have to toy with it some more but it seems to only happen when passing
> > data into the controller action. As soon as the action sees $this->data
> > it dies. Even debug($this->data) causes it to fail.
>
> > I'm still toying with it and I'll re-post if I come up with anything worth
> > while. In the meantime it would be great to know if anyone had the same
> > problem and how they resolved it 8-)
>
> > - Ed
>
> > On Wed, May 26, 2010 at 5:21 AM, Taff  wrote:
> > > Hi,
> > > since updating my app to 1.3, one of my controllers is throwing a 404.
> > > All the other controllers/methods are working properly. I took a look
> > > at the controller and it's all the initial add edit delete view
> > > methods created during baking. Where should I start looking for the
> > > error, as I'm at a loss.
>
> > > Debugging is turned on but I'm still getting the 404 with no debugging
> > > information. The error is "The requested URL /app/webroot/webcasts/
> > > index/language:deu was not found on this server." Any help would be
> > > greatly appreciated.
>
> > > Cheers,
> > > Taff
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: 404 error since updating to 1.3

2010-05-26 Thread Ernesto
same problem here.

rolled back to RC4 :)

On 26 Mag, 12:24, Ed Propsner  wrote:
> I just updated to 1.3 stable from RC4 yesterday and I've been having the
> same exact problem (amongst a few others) ever since.
>
> I have to toy with it some more but it seems to only happen when passing
> data into the controller action. As soon as the action sees $this->data
> it dies. Even debug($this->data) causes it to fail.
>
> I'm still toying with it and I'll re-post if I come up with anything worth
> while. In the meantime it would be great to know if anyone had the same
> problem and how they resolved it 8-)
>
> - Ed
>
>
>
> On Wed, May 26, 2010 at 5:21 AM, Taff  wrote:
> > Hi,
> > since updating my app to 1.3, one of my controllers is throwing a 404.
> > All the other controllers/methods are working properly. I took a look
> > at the controller and it's all the initial add edit delete view
> > methods created during baking. Where should I start looking for the
> > error, as I'm at a loss.
>
> > Debugging is turned on but I'm still getting the 404 with no debugging
> > information. The error is "The requested URL /app/webroot/webcasts/
> > index/language:deu was not found on this server." Any help would be
> > greatly appreciated.
>
> > Cheers,
> > Taff
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: render a different element for different user groups

2010-05-19 Thread Ernesto
that's the same way i'm doing right now.

unfortunately my layout is shared across 3 apps and, the other 2,
doesn't have authentication.
this selection must be done in any controller callback, but not in the
layout :\

can the controller read an html file and assign his content to a wiev
variable?

some sort of $this->set("leftbar_for_layout", $this->readThisFile("/
element/". $this->getGroupName($this->Auth-
>user("group_id")) ."_menu"));

On 18 Mag, 15:20, Brenda  wrote:
> You can read the info you set during Auth in the view. In my case, I
> have a variable Auth.User.is_admin, which I then read like this at the
> top of the default layout, default.ctp
>
> $isAdmin = $session->read('Auth.User.is_admin');
>
> Then later in the view, I determine whether or not to show the admin
> elements or just the user elements:
>
> if ($isAdmin) {
>     echo $this->element(... admin version ...);} else {
>
>     echo $this->element(... user version ...);
>
> }
>
> ...Brenda
>
> On May 18, 8:10 am, Ernesto  wrote:
>
>
>
>
>
> > Hello.
>
> > i have 3 elements "standard_leftbar", "admin_leftbar" and
> > "customer_leftbar".
>
> > is there any smart way to render one of those elements in my view,
> > based on User's group_id, provided by the Auth component?
>
> > sry for my bad english
>
> > bye
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


render a different element for different user groups

2010-05-18 Thread Ernesto
Hello.

i have 3 elements "standard_leftbar", "admin_leftbar" and
"customer_leftbar".

is there any smart way to render one of those elements in my view,
based on User's group_id, provided by the Auth component?

sry for my bad english

bye

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
found it!
lol :D

On 14 Mag, 15:26, AD7six  wrote:
> On May 14, 3:18 pm, Ernesto  wrote:
>
> > i mean "display information about 'me' when I am logged in" :)
>
> > sry for my engRish lol
>
> > btw i pr'ed $this->Auth from one of my controllers but there's no
> > "User" var listed...
>
> not surprising given it's a method. Try pr-ing over to the api ;)
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
i mean "display information about 'me' when I am logged in" :)

sry for my engRish lol

btw i pr'ed $this->Auth from one of my controllers but there's no
"User" var listed...

On 14 Mag, 14:54, Jeremy Burns  wrote:
> Do you mean 'get all currently logged in users' (i.e. from a central server 
> based admin point of view) or display information about 'me' when I am logged 
> in? The latter is achieved by looking inside $this->Auth->user();
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 14 May 2010, at 13:51, Ernesto wrote:
>
> > Hello.
>
> > is there any way to retrieve the currently logged user in CakePHP 1.3?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Currently logged user in Cake 1.3 Final

2010-05-14 Thread Ernesto
Hello.

is there any way to retrieve the currently logged user in CakePHP 1.3?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


"At least one related record" condition

2010-05-04 Thread Ernesto
Hello.

is there any simple way to implement the "At least one related record"
conditions to Cake model's associations?

for example:

i have an Order model hasMany Items.

an order cannot be empty. it must contain at least one item (i.e.
related record)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: saveAll rolling back my transactions

2010-03-29 Thread Ernesto
myISAM.

i'll check OrderControllers validation errors

On 26 Mar, 16:18, Lucca Mordente  wrote:
> Maybe your database table engine does not support transactions.
> What engine are you using?
>
> Lucca Mordente
>
> On 26 mar, 09:28, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i have 2 models (Item and Order) joined together by a HABTM
> > relationship.
> > since i need some additional fields (quantity) in the join table i
> > splitted the HABTM in 2x hasMany.
> > after that i coded a Order add form wich gives me this data array
>
> > Array
> > (
> >     [Order] => Array
> >         (
> >             [code] => SCORR
> >             [customer_id] => 5
> >             [estimated_delivery] => 2010-03-30
> >         )
>
> >     [ItemsOrders] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [item_id] => 10
> >                     [quantity] => 3.00
> >                 )
>
> >             [1] => Array
> >                 (
> >                     [item_id] => 5
> >                     [quantity] => 5.00
> >                 )
>
> >         )
>
> > )
>
> > here's the related SQL log
>
> > (default) 11 queries took 6 ms     Nr    Query           Error           
> > Affected
> > Num. rows        Took (ms)
> > 1       DESCRIBE `orders`               3       3       1
> > 2       DESCRIBE `items_orders`                 4       4       1
> > 3       DESCRIBE `items`                3       3       1
> > 4       SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1
> > = 1 ORDER BY `code` ASC                 9       9       0
> > 5       START TRANSACTION               0               0
> > 6       INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
> > VALUES ('XYZ', 5, '2010-03-30')                 1               0
> > 7       SELECT LAST_INSERT_ID() AS insertID             1       1       0
> > 8       ROLLBACK
>
> > the strange thing is that, even if the transaction fails, the order is
> > added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


saveAll rolling back my transactions

2010-03-26 Thread Ernesto
Hello.

i have 2 models (Item and Order) joined together by a HABTM
relationship.
since i need some additional fields (quantity) in the join table i
splitted the HABTM in 2x hasMany.
after that i coded a Order add form wich gives me this data array

Array
(
[Order] => Array
(
[code] => SCORR
[customer_id] => 5
[estimated_delivery] => 2010-03-30
)

[ItemsOrders] => Array
(
[0] => Array
(
[item_id] => 10
[quantity] => 3.00
)

[1] => Array
(
[item_id] => 5
[quantity] => 5.00
)

)

)

here's the related SQL log

(default) 11 queries took 6 ms NrQuery   Error   
Affected
Num. rowsTook (ms)
1   DESCRIBE `orders`   3   3   1
2   DESCRIBE `items_orders` 4   4   1
3   DESCRIBE `items`3   3   1
4   SELECT `Items`.`id`, `Items`.`code` FROM `items` AS `items` WHERE 1
= 1 ORDER BY `code` ASC 9   9   0
5   START TRANSACTION   0   0
6   INSERT INTO `orders` (`code`, `customer_id`, `estimated_delivery`)
VALUES ('XYZ', 5, '2010-03-30') 1   0
7   SELECT LAST_INSERT_ID() AS insertID 1   1   0
8   ROLLBACK


the strange thing is that, even if the transaction fails, the order is
added.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


updateAll problem in 1.3RC1

2010-03-10 Thread Ernesto
Hello

$this->Order->updateAll(array("date_purchase" => date("Y-m-d H:i:s")),
array("id" => $order_id));

throws this error

Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near '16:31:34  WHERE `id` = 214'

Query: UPDATE `commesse` AS `Commessa` SET `Commessa`.`data_scarico` =
2010-03-10 16:31:34 WHERE `id` = 214

cake isn't adding quotes to SQL.

is that intended?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


possible bug with virtualFields

2010-03-10 Thread Ernesto
Hello.

i have a simple app running 2 models

Order hasMany Item
Item belongsTo Order

the "code" field in in both models but in ItemModel this is a virtual
field

var $virtualFields = array("code" => "CONCAT(Order.code, '-',
Item.n)");

here's the problem:

$myItem = $this->Item->find("all", array(
   "conditions" => array(
  "n" => $n,
  "Order.code" => $orderCode
   ),
   "fields" => "id"
));

returns this SQL

SELECT `Item`.`id` FROM `items` AS `Item` LEFT JOIN `orders` AS
`Order` ON (`Item`.`order_id` = `Order`.`id`) LEFT JOIN `orders` AS
`Order` ON (`Item`.`order_id` = `Order`.`id`) WHERE `n` = '002' AND
CONCAT(Order.code, '-', Item.n) = 'ORDERCODE'

the Item code overwrites Order code


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


check if a view file exists

2010-02-19 Thread Ernesto
Hello.

is there a way to check if a view file ([view].ctp) exists?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


get model id by a set of conditions

2010-02-08 Thread Ernesto
Hello.

i'm looking for a function that gets the id from a given set of
conditions.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Various errors with virtualFields (1.3Beta)

2010-02-08 Thread Ernesto
Hello.

i have 2 models.

Items belongsTo Order

Item has a virtualField defined as "CONCAT(Order.code, '-',
REPEAT('0', 3 - LENGTH(Item.id)), Item.id)"

this setup is giving me a lot of errors during finds from Item model.
Some examples:

$this->Item->hasAny("color" => "red")   gives me "unknown column
'Order.code' "
$this->Item->find("all", array("contain" => false));  gives me the
same error as above

it looks like cake is using virtual fields everywhere.

shouldn't cake ignore, in some cases, those virtual fields?

PS: sry for bad eng

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


virtual fields are giving me errors (1.3Beta)

2010-02-02 Thread Ernesto
Hello.

i have 2 models: Order hasMany Item.
- the hasMany has the option "dependent" set to TRUE.
- Item model has a virtual field defined like this: var $virtualFields
= array("barcode" => "CONCAT(Order.code, REPEAT('0', 10 - LENGTH
(Item.code)), Item.code)");

when i delete an order cake will attempt to delete all the related
items, returning an error that sounds like "i can't find Order.code in
your table"

is this a bug?

cake should ignore virtual fields in delete queries

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: need some help with a select

2010-02-01 Thread Ernesto
yes thanks.

On 1 Feb, 10:46, Jeremy Burns  wrote:
> try:
>
> $form->input('**fieldname**', array('empty' => true));
>
> ...where **fieldname** is the field you want to display. This will give you a 
> populated drop down but the first entry will be an empty row. Is this what 
> you wanted?
>
> Jeremy Burns
> jeremybu...@me.com
> (Skype) +44 208 123 3822 (jeremy_burns)
> (m) +44 7973 481949
> (h) +44 208 530 7573
>
> On 1 Feb 2010, at 09:42, Ernesto wrote:
>
>
>
> > Hello.
>
> > i need a select box, wrapped in his "" div
> > and with blank first entry
>
> > $form->input() ---> the select didn't have the empty field
> > $form->select() ---> the select wasn't wrapped in his DIV
>
> > any suggestion?
>
> > ps: i'm using Cake 1.3Beta
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


need some help with a select

2010-02-01 Thread Ernesto
Hello.

i need a select box, wrapped in his "" div
and with blank first entry

$form->input() ---> the select didn't have the empty field
$form->select() ---> the select wasn't wrapped in his DIV

any suggestion?

ps: i'm using Cake 1.3Beta

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problem with Paginator

2010-01-20 Thread Ernesto
Hello.
i have 2 models linked together with a simple hasMany relationship.

Customer hasMany Order // Order belongTo Customer

Customers are stored in an external DB so the Customer model uses a
different DB connection

now... i coded 2 views:
customers/index and orders/index

- customers/index. This view is displaying ONLY customer data --> i
can order by customer.name without problems

- orders/index. This view displays the order data (including
customer's name) --> when i try to order by Customer.name i get an
error like this:

Warning (512): SQL Error: 1054: Unknown column 'Customer.name' in
'order clause' [CORE\cake\libs\model\datasources\dbo_source.php, line
635]

and the table won't order.

i guess the DB Connection is the culprit.

is there any solution/workaround?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: fetch data from 2 tables through cake pattern

2010-01-20 Thread Ernesto
from wich controller are you fetching data?

users or details?

PS: i suggest you to follow cake's db conventions

On 19 Gen, 06:33, John  wrote:
> Hello
> I have two tables that is users and details. i want to fetch data from
> these 2 . i am getting details.id through which i have the whole row.
> and in this row i have details.user_id and through this user_id i want
> the row from users table.
>
> SELECT d.*,u.email, u.fname, u.lname
> FROM details as d
> LEFT JOIN users as u
> ON d.user_id = u.id
> WHERE d.user_id = u.id
>
> this is the simple query i want to make it through cake pattern but
> find anything yet
>
> Thanks in advance
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Non-database fields in view

2010-01-20 Thread Ernesto
try this

in view

$form->input("something_1");
$form->input("something_2");

in controller action

if (!empty($this->data)) {
 $something_1 = $this->data[$this->modelClass]["something_1"]; //
first field
 $something_2 = $this->data[$this->modelClass]["something_2"]; //
second field
}

On 20 Gen, 00:49, laceja  wrote:
> I need to add a few input fields to a view. I'm thinking to create the
> variables in the controller and then pass them to the view, but I
> don't really understand how to do it. If someone could offer me a
> short/simple example, I would appreciate it very much.
>
> Thank you.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3-beta has landed

2010-01-18 Thread Ernesto
already did it. no way.

i'll give it another try.

On 18 Gen, 22:46, euromark  wrote:
> inside the plugin in /webroot/...
>
> @see:http://cakephp.lighthouseapp.com/projects/42648/13-new-features-plugi...
>
> On 18 Jan., 22:07, majna  wrote:
>
>
>
> > In shared plugin (in new plugin webroot folder)?
>
> > On Jan 18, 3:12 pm, Ernesto  wrote:
>
> > > Where should i put my shared Css' and images? (i have a single-core,
> > > multi-app environment). before 1.3Beta i was using an additiona
> > > vendors path but now it isn't working :(
>
> > > PS: link [7] is broken
>
> > > On 18 Gen, 15:04, Celso  wrote:
>
> > > > Is there a approximate date for the final cakephp 1.3 Version?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3-beta has landed

2010-01-18 Thread Ernesto
Where should i put my shared Css' and images? (i have a single-core,
multi-app environment). before 1.3Beta i was using an additiona
vendors path but now it isn't working :(

PS: link [7] is broken

On 18 Gen, 15:04, Celso  wrote:
> Is there a approximate date for the final cakephp 1.3 Version?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


shared CSS and Imgs in CakePHP 1.3 Beta

2010-01-18 Thread Ernesto
Hello.

every app on my server is using some shared css or images.
those files are stored in
localhost/shared_items/vendors/css
or
localhost/shared_items/vendors/images
every app has the additional vendors path defined in bootstrap.php

this morging i migrated from 1.3 Alpha to 1.3 Beta

now... where should i put those files?

i'm not using themes.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


adding/updating additional fields in HABTM's join table

2010-01-18 Thread Ernesto
Hello.

as the title says is there any way to add/update additional fields
in HABTM's join table?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3-beta has landed

2010-01-18 Thread Ernesto
Virtual Fields = /love @ Cake's dev team :P

On 17 Gen, 05:25, mark_story  wrote:
> The CakePHP development team is happy to announce the release the
> CakePHP 1.3-beta. We've been hard at work implementing new features
> and fixing issues in existing features in the 1.3 branch.  Since 1.3-
> alpha there have been more than 600 commits and more than 43 tickets
> have been closed.  A number of new features have been implemented most
> notably, Model virtualFields[1], changes to the plugin and theme assets
> [2], improvements to TimeHelpers ability to output i18n friendly
> formats, and a refactored test suite harness[3].  When upgrading to
> 1.3-beta it is recommended that you replace app/webroot/test.php with
> the one in the repository and check out the Migration Guide[4] as well
> as the new features guides [5] for changed and new features in 1.3.
>
> In other project news, all the previous stable release points for 1.2
> have been retagged and are available in github.  We've brought on two
> new team members in the past few months as well, both ADmad, and
> jose_zap have joined the CakePHP team and are helping with all aspects
> of the project.  Moving forward with 1.3 we are not planning on adding
> changes that break backwards compatibility.  Any methods currently
> generating errors will be removed in the first Release Candidate. It
> is important that you listen to the warnings, as they will become
> fatal errors in the future.
>
> If you would like to help with the ongoing development of 1.3, you can
> do so in a number of ways. Firstly, filing clear and concise tickets
> for any issues helps get the issues resolved quickly. Secondly, you
> can also contribute by forking the CakePHP project on github and
> implementing fixes, tests cases and features on your forks.  You can
> use pull requests or tickets to notify core team members about your
> changes.
>
> Finally, we'd like to thank you the community for the their greatly
> increased and ongoing support and contributions. Since our move to
> github and lighthouse the volume of community contributions has had a
> dramatic increase, and we'd like to thank the many contributors for
> their help in improving CakePHP.
>
> Download a packaged release [6]
>
> View the changelog [7]
>
> [1]http://cakephp.lighthouseapp.com/projects/42648/13-new-features-virtu...
> [2]http://cakephp.lighthouseapp.com/projects/42648/13-new-features-plugi...
> [3]http://cakephp.lighthouseapp.com/projects/42648/1-3-new-features-test...
> [4]http://cakephp.lighthouseapp.com/projects/42648/13-migration-guide
> [5]http://cakephp.lighthouseapp.com/projects/42648/13-new-features
> [6]http://github.com/cakephp/cakephp1x/downloads
> [7]http://cakephp.lighthouse.com/projects/42648/changelog-1-3-0-beta
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Forms: HABTM with additional fields in join table

2010-01-13 Thread Ernesto
Hello.

Person HABTM Training

i'm coding the Person::add and Person::edit views

there's plenty of examples/tutorials wich explains how to code an
HABTM form... but unfortunately none of them explains how to add
additional information in the join table (in my case
"who_added_this_relationship", "expiration_date" and "notes").

almost forgot... training_id should be a select box.

can someone help me plz?



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: weird problem with paginator (Cake 1.3)

2009-12-23 Thread Ernesto
hi mark thx for the reply.

you said
"Well since you can't join across connections, that kind of makes
sense
doesn't it?"

so why the page is loading ok the first time, when there's no
paginator options in url? this problem occurs only when i try to sort
by Customer.name
obviously there isn''t any db-level link between customers and orders
tables because they're in different DBs but cake should map there
tabs anyway...

the thing that doesn't makes sense to me is:
- the data (even Customer.name) is loaded and showed correctly so this
field is present in data array but...
- paginator can't find (and sort) it...

"In any case I highly doubt your issue is specific to 1.3,
or even 1.2 and has much more to do with attempting to set order
clauses on tables that are not part of your pagination query.  Check
your query to make sure all the required tables are in one query."

yes that's the problem. Paginator doesn't load my table even if the
relationship is correctly defined in "contain" subarray and
containable is loaded.

sry for my very bad eng.

-Ernesto

On 22 Dic, 15:11, mark_story  wrote:
> Well since you can't join across connections, that kind of makes sense
> doesn't it? In any case I highly doubt your issue is specific to 1.3,
> or even 1.2 and has much more to do with attempting to set order
> clauses on tables that are not part of your pagination query.  Check
> your query to make sure all the required tables are in one query.
>
> -Mark
>
> On Dec 22, 5:37 am, Ernesto  wrote:
>
>
>
> > it looks like Paginator in 1.3 has a bug -> he's ignoring the models
> > using different DB connection
>
> > can anyone confirm this?
>
> > On 21 Dic, 17:08, Ernesto  wrote:
>
> > > hello.
>
> > > my webapp has 3 models:
>
> > > Order, Item and Customer
>
> > > Order belongsTo Item
> > > Order belongsTo Customer
>
> > > both OrderModel and ItemModel are in app's models dir.
> > > CustomerModel is located in an external dir, defined in
> > > bootstrap.php's app build
>
> > > here's a piece of my OrdersController
>
> > > class OrdersController extends AppController {
> > >    [...]
> > >    var $paginate = array(
> > >       "limit" => 20,
> > >       "contain" => array(
> > >          "Item",
> > >          "Customer"
> > >       ),
> > >       "order" => "Order.Code"
> > >    )
>
> > >    function index() {
> > >       $this->set("orders", $this->paginate("Order"));
> > >    }
>
> > > }
>
> > > and here's a piece of my Orders index
>
> > > [...]
> > > sort("Order code", "Order.code") ?>
> > > sort("Customer", "Customer.name") ?>
> > > [...]
>
> > > if i click on "Order code" the page will work correctly and data will
> > > be displayed sorted by Order.Code
> > > if i click on "Customer" the page will return an error like "SQL
> > > Error: 1054: Unknown column 'Customer.name' in 'order clause'"
>
> > > i can't figure out the reason of this error...
>
> > > CustomerModel and CustomersController are working ok. i can insert/
> > > update/delete without errors.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: weird problem with paginator (Cake 1.3)

2009-12-22 Thread Ernesto
it looks like Paginator in 1.3 has a bug -> he's ignoring the models
using different DB connection

can anyone confirm this?

On 21 Dic, 17:08, Ernesto  wrote:
> hello.
>
> my webapp has 3 models:
>
> Order, Item and Customer
>
> Order belongsTo Item
> Order belongsTo Customer
>
> both OrderModel and ItemModel are in app's models dir.
> CustomerModel is located in an external dir, defined in
> bootstrap.php's app build
>
> here's a piece of my OrdersController
>
> class OrdersController extends AppController {
>    [...]
>    var $paginate = array(
>       "limit" => 20,
>       "contain" => array(
>          "Item",
>          "Customer"
>       ),
>       "order" => "Order.Code"
>    )
>
>    function index() {
>       $this->set("orders", $this->paginate("Order"));
>    }
>
> }
>
> and here's a piece of my Orders index
>
> [...]
> sort("Order code", "Order.code") ?>
> sort("Customer", "Customer.name") ?>
> [...]
>
> if i click on "Order code" the page will work correctly and data will
> be displayed sorted by Order.Code
> if i click on "Customer" the page will return an error like "SQL
> Error: 1054: Unknown column 'Customer.name' in 'order clause'"
>
> i can't figure out the reason of this error...
>
> CustomerModel and CustomersController are working ok. i can insert/
> update/delete without errors.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


weird problem with paginator (Cake 1.3)

2009-12-21 Thread Ernesto
hello.

my webapp has 3 models:

Order, Item and Customer

Order belongsTo Item
Order belongsTo Customer

both OrderModel and ItemModel are in app's models dir.
CustomerModel is located in an external dir, defined in
bootstrap.php's app build

here's a piece of my OrdersController

class OrdersController extends AppController {
   [...]
   var $paginate = array(
  "limit" => 20,
  "contain" => array(
 "Item",
 "Customer"
  ),
  "order" => "Order.Code"
   )

   function index() {
  $this->set("orders", $this->paginate("Order"));
   }
}

and here's a piece of my Orders index

[...]
sort("Order code", "Order.code") ?>
sort("Customer", "Customer.name") ?>
[...]

if i click on "Order code" the page will work correctly and data will
be displayed sorted by Order.Code
if i click on "Customer" the page will return an error like "SQL
Error: 1054: Unknown column 'Customer.name' in 'order clause'"

i can't figure out the reason of this error...

CustomerModel and CustomersController are working ok. i can insert/
update/delete without errors.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: global varijable

2009-12-14 Thread Ernesto
uhm...

i place my bet: add the variable in bootstrap.php

avoid any mod @ cake's core like pest.

On 14 Dic, 08:58, mike karthauser  wrote:
> You can either set a variable in app_controller or add a define to  
> core which will apply globally
>
> Mike Karthauser
> Brightstorm limited
> Tel: 07939252144
>
> On 14 Dec 2009, at 07:44, Tom  wrote:
>
>
>
>
>
> > How to set (where?), read and change global variable in controllers?
>
> > Pleas help!
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help  
> > others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google  
> > Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this  
> > group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: global functions

2009-12-10 Thread Ernesto
i created a php file with all the functions needed and then i loaded
it in my bootstrap.php using php's include()

it's working ok now

On 10 Dic, 15:38, Fran Iglesias  wrote:
> Hi,
>
> El 10/12/2009, a las 14:32, Ernesto escribió:
>
> > it's very uncomfortable to copy them in a helper and in a component @
> > every little mod.
> > is there any clever way to manage these funcs?
>
> You could load them in the APP/config/bootstrap.php
>
> Another solution is to create a class with several methods, load it  
> during bootstrap and use as singleton, something similar to the  
> inflector class.
> ---
> Fran Iglesias http://cakephpilia.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


global functions

2009-12-10 Thread Ernesto
Hello.

i have some simple functions such as

array_depth
array_width
array_integrate

and so on

that are used in both Controllers and Views.

it's very uncomfortable to copy them in a helper and in a component @
every little mod.

is there any clever way to manage these funcs?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Html entities

2009-12-02 Thread Ernesto
i solved the problem.

the culprit was the Sanitize class

On 2 Dic, 11:49, euromark  wrote:
> if you used utf8 correctly, it would not do that...
>
> On 2 Dez., 08:55, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i have a controller, a model and the usual add/remove/edit views
>
> > in the add view i have a simple form. here's the code
>
> > echo $form->input("Items.0.code");
> > echo $form->input("Items.0.description");
> > echo $form->input("Items.1.code");
> > echo $form->input("Items.1.description");
> > echo $form->input("Items.2.code");
> > echo $form->input("Items.2.description");
>
> > the description fields has good probability to contain a math symbol
> > or a comparison operator.
>
> > when i save my form Cake converts those symbols in html entities.
>
> > is there a way to avoid this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Html entities

2009-12-01 Thread Ernesto
Hello.

i have a controller, a model and the usual add/remove/edit views

in the add view i have a simple form. here's the code

echo $form->input("Items.0.code");
echo $form->input("Items.0.description");
echo $form->input("Items.1.code");
echo $form->input("Items.1.description");
echo $form->input("Items.2.code");
echo $form->input("Items.2.description");

the description fields has good probability to contain a math symbol
or a comparison operator.

when i save my form Cake converts those symbols in html entities.

is there a way to avoid this?





Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Apps_Controller and Apps_Model

2009-11-30 Thread Ernesto
hello.

i have a multi-app environment wich is working ok.

some apps are very similar each other.

is it possible to create a class like Apps_Controller (or Apps_Model)
and share it across many apps?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: managing the "missing argument" errors

2009-11-30 Thread Ernesto
similar to my approach.

too many ifs in my controllers.

On 30 Nov, 09:20, Fran Iglesias  wrote:
> Hi,
>
> El 30/11/2009, a las 9:16, Ernesto escribió:
>
> > but that's unconfortable...
>
> My approach:
>
> in controller...
>
> function edit($id = null) {
>         if (!$id) {
>                 $this->Session->setFlash('INvalid URL');
>                 $this->redirect (array('action' => 'index');
>         }
>
>         // Code, code, code
>
>
>
> }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


managing the "missing argument" errors

2009-11-30 Thread Ernesto
hello.

is there any clever (simple?) way to manage the "missing argument"
error?

for example:

if i call directly from the browser's address bar an url like this

"http://localhost/cake/myapp/myctrl/edit/"; (please note the missing
id)

PHP will prompt me an error like this

Warning (2): Missing argument 1 for MyController::edit(), called in
[...]\cake\libs\object.php on line 116 and defined [app
\My_Controller.php, line 40]

right now i'm using a lot of

if (!isset($param)) $this->redirect("gg no re", "/". strtolower($this-
>name)));

but that's unconfortable...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: need a little help with model::saveAll function

2009-11-25 Thread Ernesto
i'ts working! thank you very much

On 24 Nov, 18:19, Johannes  wrote:
> i had exactly the same problem and solved it by removing empty lines
> in the beforeFilter() of the controller responsible for saving items.
> In my case its very specific you could apppend your logic to make it
> more universal.
>
> p.s. im not sure about the following line in your example, because im
> not sure if !null is defined in php
> if (array_search(!null, $record)) $validRecords[] = $record;
> maybe im wrong but i dont think this filters your data correctly.
>
> --- in my app i use:
> class InvoicesController extends AppController {
>         function beforeFilter() {
>                 if (!empty($this->data)) {
>
>                         // remove empty forms from data
>                         if (isset($this->data['InvoicesItem'])) {
>                                 $data = array();
>                                 foreach ($this->data['InvoicesItem'] as $row) 
> {
>                                         if (!empty($row['quantity']) || 
> !empty($row['price'])) {
>                                                 $data[] = $row;
>                                         }
>                                 }
>                                 if (empty($data)) {
>                                         unset($this->data['InvoicesItem']);
>                                 }
>                                 else {
>                                         $this->data['InvoicesItem'] = $data;
>                                 }
>                         }
>                 }
>
>         }
> ...
>
> }
>
> On Nov 24, 4:28 pm, Ernesto  wrote:
>
>
>
> > A - i already have a routine that *should* to that... but it isn't
> > working properly. here's the code
>
> > function beforeValidate() {
> >      $validRecords = array();
> >      foreach ($this->data as $model => $records) {
> >           foreach ($records as $key => $record) {
> >                if (is_numeric($key)) {
> >                     if (array_search(!null, $record)) $validRecords[]
> > = $record;
> >                } else break;
> >                $this->data[$model] = $validRecords;
> >           }
> >      }
> >      return true;
>
> > }
>
> > B - my saveAll is already overwritten in AppModel and atm it's working
> > ok. i was just asking if it's possible to do that in a Behavior :)
>
> > On 23 Nov, 20:52, Marcelo Andrade  wrote:
>
> > > On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > > > (..)
> > > > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > > > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > > > rows = validation errors. is there any way to avoid this?
>
> > > You'll have to loop $this->data and unset the entries when
> > > you get blank fields.
>
> > > > B - is it pobbile to create a behavior that forces "validate" =>
> > > > "first" to every saveAll call?
>
> > > You can override the saveAll method in your AppModel,
> > > changing the validate entry in the options to 'first' always.
>
> > > Best regards.
>
> > > --
> > > MARCELO DE F. ANDRADE
> > > Belem, PA, Amazonia, Brazil
> > > Linux User #221105

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: need a little help with model::saveAll function

2009-11-24 Thread Ernesto
A - i already have a routine that *should* to that... but it isn't
working properly. here's the code

function beforeValidate() {
 $validRecords = array();
 foreach ($this->data as $model => $records) {
  foreach ($records as $key => $record) {
   if (is_numeric($key)) {
if (array_search(!null, $record)) $validRecords[]
= $record;
   } else break;
   $this->data[$model] = $validRecords;
  }
 }
 return true;
}

B - my saveAll is already overwritten in AppModel and atm it's working
ok. i was just asking if it's possible to do that in a Behavior :)



On 23 Nov, 20:52, Marcelo Andrade  wrote:
> On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > (..)
> > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > rows = validation errors. is there any way to avoid this?
>
> You'll have to loop $this->data and unset the entries when
> you get blank fields.
>
> > B - is it pobbile to create a behavior that forces "validate" =>
> > "first" to every saveAll call?
>
> You can override the saveAll method in your AppModel,
> changing the validate entry in the options to 'first' always.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: need a little help with model::saveAll function

2009-11-23 Thread Ernesto
is there any example?

i can't figure out where and when loop through $this->data

On 23 Nov, 20:52, Marcelo Andrade  wrote:
> On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > (..)
> > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > rows = validation errors. is there any way to avoid this?
>
> You'll have to loop $this->data and unset the entries when
> you get blank fields.
>
> > B - is it pobbile to create a behavior that forces "validate" =>
> > "first" to every saveAll call?
>
> You can override the saveAll method in your AppModel,
> changing the validate entry in the options to 'first' always.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105

--

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




how do you show validation errors in multi-model form?

2009-11-23 Thread Ernesto
Hello.

i have a form like this one:

echo $form->create("Order");
echo $form->input("code")
for($i=0,$i<10,$i++) {
 echo $form->input("Item.$i.code");
 echo $form->input("Item.$i.quantity");
}

how do you show errors if more than 1 row fails validation?

div @ the end of the form?

--

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




need a little help with model::saveAll function

2009-11-23 Thread Ernesto
hello

i have a form like this:

echo $form->create("Order");
echo $form->input("code")
for($i=0,$i<10,$i++) {
 echo $form->input("Item.$i.code");
 echo $form->input("Item.$i.quantity");
}
echo $form->end();

i'm saving this form using saveAll with "validate" option set to
"first"

problems:
A - user can insert just 2 or 3 rows, it's not necesasry to fill all
the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
rows = validation errors. is there any way to avoid this?
B - is it pobbile to create a behavior that forces "validate" =>
"first" to every saveAll call?

any help will be greatly appreciated

--

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




containable + model::order

2009-11-12 Thread Ernesto
Hello.

i have 3 models

- Item
- Batch
- Person

Item belongsTo Batch
Item belongsTo Person

both Item and Batch models have
var $order = "code"

i'm retrieving data from ItemsController using containable
$this->Item->find("all", array("contain" => array("Batch",
"Person")));

i'm getting a "SQL Error 1052: Column 'code' in order clause is
ambiguous"

is that because containable doesn't put aliases after "ORDER BY"
clause?

--

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




Re: Strange FormHelper behavior

2009-09-29 Thread Ernesto

after some test i found a working solution.

echo $form->create(null, array("url" => str_replace($this->base, "",
$this->here)));

it isn't beautiful but... it works.

On 29 Set, 14:49, Ernesto  wrote:
> Hello.
>
> here's some code from my view
>
> 
> echo $this->here;
>
> echo $form->create(null, array("url" => $this->here));
>
> ?>
>
> the first echo outputs this:
>
> /cakephp/development/apps/myapp/package/add
>
> and here's the output from form::create
>
> 
>
> look @ "action" html property!
>
> what's going on here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Strange FormHelper behavior

2009-09-29 Thread Ernesto

Hello.

here's some code from my view

here;

echo $form->create(null, array("url" => $this->here));

?>

the first echo outputs this:

/cakephp/development/apps/myapp/package/add

and here's the output from form::create



look @ "action" html property!

what's going on here?

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



Need little help with cake image paths

2009-09-28 Thread Ernesto

Hello.

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

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

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


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



Looking for inspiration (multi-step data add)

2009-09-18 Thread Ernesto

Hello.

Supplier hasMany Product

1st step:
- user chooses the Supplier

2nd step:
- only products supplied by Supplier selected in step 1 are loaded in
a select
- use chooses wich product has arrived. Also Quantity and Weight
fields are needed.

3rd step:
- in this step a PDF file is embedded in the page. this PDF shows the
data entered in the first two steps.
this PDF will be printed and attached to the product packaging.

when should i save the data to DB?
wich is the best way to do that??
- WizardComponent
- AJAX
- Other

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



Re: $model->find("list") and concatenated fields

2009-09-17 Thread Ernesto

BTW this feature should be built-in in Cake

On 17 Set, 13:46, Ernesto  wrote:
> u mean this?
>
> http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combin...
>
> very good article.
>
> thx
>
> On 17 Set, 13:10, Thiago Nuic Vidigal  wrote:
>
>
>
> > teknoid has a post on his blog about a "superlist" that does what you want.
>
> > On Wed, Sep 16, 2009 at 11:14 AM, santino83  wrote:
>
> > > Hi,
>
> > > First of all you should use find('first') to get a list from your
> > > model. As you can read inhttp://book.cakephp.org/view/810/find-list,
> > > you could set $displayField in Model and tell to cake which field it
> > > should use as "description". In your case, it seems cake couldn't
> > > concatenate fields as description, so a solution could be
>
> > > 1) ovveride find in Model class
> > > 2) using a custom function
>
> > > In both cases, your function will retry all model records, and then
> > > create a list using some utilities. I use this:
>
> > > $results = $this->find('all', array( 'conditions' => ..., .. .. ) );
>
> > > /*
> > > * Extract list, result: model_id => code+description
> > >  */
> > > return $results ? array_combine(Set::extract('/MODELNAME/id',
> > > $results), array_map(array($this,'getDescription'),$results) ) :
> > > null;
>
> > > and getDescription:
>
> > > private function getDescription($data){
> > >  return $data['MODELNAME']['code'].' '.$data['MODELNAME']
> > > ['description'];
> > > }
>
> > > note: change MODELNAME rightly
>
> > > On Sep 16, 3:51 pm, Ernesto  wrote:
> > > > Hello.
>
> > > > i have a model that's using a simple 3-columns table
>
> > > > item_id
> > > > code
> > > > description
>
> > > > i want to obtain a select box that shows the fields "code" and
> > > > "description" concatenated.
>
> > > > right now i'm using a foreach loop
>
> > > > foreach ($items as $key => $item) $selectArray[$key] = $item["code"] .
> > > > " - " . $item["description"];
>
> > > > is there any way to do this directly in the "find" call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: $model->find("list") and concatenated fields

2009-09-17 Thread Ernesto

u mean this?

http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combined-fields/

very good article.

thx

On 17 Set, 13:10, Thiago Nuic Vidigal  wrote:
> teknoid has a post on his blog about a "superlist" that does what you want.
>
>
>
> On Wed, Sep 16, 2009 at 11:14 AM, santino83  wrote:
>
> > Hi,
>
> > First of all you should use find('first') to get a list from your
> > model. As you can read inhttp://book.cakephp.org/view/810/find-list,
> > you could set $displayField in Model and tell to cake which field it
> > should use as "description". In your case, it seems cake couldn't
> > concatenate fields as description, so a solution could be
>
> > 1) ovveride find in Model class
> > 2) using a custom function
>
> > In both cases, your function will retry all model records, and then
> > create a list using some utilities. I use this:
>
> > $results = $this->find('all', array( 'conditions' => ..., .. .. ) );
>
> > /*
> > * Extract list, result: model_id => code+description
> >  */
> > return $results ? array_combine(Set::extract('/MODELNAME/id',
> > $results), array_map(array($this,'getDescription'),$results) ) :
> > null;
>
> > and getDescription:
>
> > private function getDescription($data){
> >  return $data['MODELNAME']['code'].' '.$data['MODELNAME']
> > ['description'];
> > }
>
> > note: change MODELNAME rightly
>
> > On Sep 16, 3:51 pm, Ernesto  wrote:
> > > Hello.
>
> > > i have a model that's using a simple 3-columns table
>
> > > item_id
> > > code
> > > description
>
> > > i want to obtain a select box that shows the fields "code" and
> > > "description" concatenated.
>
> > > right now i'm using a foreach loop
>
> > > foreach ($items as $key => $item) $selectArray[$key] = $item["code"] .
> > > " - " . $item["description"];
>
> > > is there any way to do this directly in the "find" call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$model->find("list") and concatenated fields

2009-09-16 Thread Ernesto

Hello.

i have a model that's using a simple 3-columns table

item_id
code
description

i want to obtain a select box that shows the fields "code" and
"description" concatenated.

right now i'm using a foreach loop

foreach ($items as $key => $item) $selectArray[$key] = $item["code"] .
" - " . $item["description"];

is there any way to do this directly in the "find" call?

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



Re: Containable ignoring model::order?

2009-09-09 Thread Ernesto

find call works ok

i was just wondering why Containable is ignoring my model::order.

On 9 Set, 05:20, brian  wrote:
> On Tue, Sep 8, 2009 at 7:35 PM, Ernesto wrote:
>
> > y sorry i forgot it
>
> > i'm using the italian translation of "Date" as field name ("Data").
>
> > this fields isn't the record's creation date but a date in a nearly
> > future.
>
> > i checked cases and typos... noone found.
>
> OK, but you should set the order like:
>
> 'order' => array('ModelName.data' => 'ASC')
>
> I don't know whether or not it's important that the column name be all
> lowercase.
>
> Can you post your find() call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Containable ignoring model::order?

2009-09-08 Thread Ernesto

y sorry i forgot it

i'm using the italian translation of "Date" as field name ("Data").

this fields isn't the record's creation date but a date in a nearly
future.

i checked cases and typos... noone found.

On 8 Set, 18:10, brian  wrote:
> Is the column name "Date" (or "date")? It should probably be "created"
> (Cake default) as "date" is generally a reserved word.
>
> And try it like: $order = array('ModelName.created' => 'ASC')
>
>
>
> On Tue, Sep 8, 2009 at 8:38 AM, Ernesto wrote:
>
> > hello.
>
> > i have several models associated together.
>
> > i'm getting data using Containable.
>
> > 2 models have $order = array("Date")
>
> > Containable is ignoring this.
>
> > everything else is working ok.
>
> > is there something i'm missing (other than a good english teacher :P) ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Containable ignoring model::order?

2009-09-08 Thread Ernesto

hello.

i have several models associated together.

i'm getting data using Containable.

2 models have $order = array("Date")

Containable is ignoring this.

everything else is working ok.

is there something i'm missing (other than a good english teacher :P) ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Menus best practice

2009-09-07 Thread Ernesto

Hi Martin.

thx for the responses

i'll try the second one :)

On 4 Set, 17:24, Martin Westin  wrote:
> You can create an empty element in all the other apps and just include
> the element in the layout.
>
> You can also let the current app use another layout, one which
> "inherits" the global layout. In this special layout you include the
> menu element (somehow). I often work like this. With one base-layout
> and a few special ones for different sections of an application.
>
> At it's most simple such a special layout would inherit the base one
> like this:
> echo $this->renderLayout(''.$content_for_layout.' div>','base_layout');
>
> As you can see this is a strictly hierarchal "russian doll" thing.
>
> On Sep 4, 4:37 pm, Ernesto  wrote:
>
>
>
> > hello.
>
> > i have an element that contains a simple menu
>
> > i can't put this menu in the layout because the layout file is shared
> > across many apps
>
> > my goal is to show the menu in every view of my app.
>
> > any idea?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Menus best practice

2009-09-04 Thread Ernesto

hello.

i have an element that contains a simple menu

i can't put this menu in the layout because the layout file is shared
across many apps

my goal is to show the menu in every view of my app.

any idea?

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



Re: Cake looking for css controller?

2009-09-04 Thread Ernesto

thanks grigri.

the path & name were correct.

the problem was the layout's name "content + leftbar.ctp"

it looks like the "+" was the cause

:)

On 4 Set, 12:28, grigri  wrote:
> Looks like your css files are not where they should be. Check all
> their filenames and paths.
>
> Because missing asset files (img, css, js, ...) can really slow down a
> website (in debug mode especially), and make nonsense of your logs and
> sometimes trash your sessions, I usually modifiy the .htaccess file to
> ignore missing asset files. These lines should do the trick:
>
> # Do not route missing asset requests through cake
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> # This is an exception because they are generated through cake
> RewriteCond %{REQUEST_FILENAME} !img/pictures/
> RewriteRule ^/?((img|js|css|swf)/.*)$ empty [L]
>
> Where "empty" is a zero-byte file in the webroot. Depending on your
> Apache version you might be able to do this:
>
> RewriteRule ^/?((img|js|css|swf)/.*)$ - [R=404]
>
> Which makes more sense, but some versions don't allow it.
>
> This greatly helps in debugging issues like this.
>
> hth
> grigri
>
> On Sep 4, 9:20 am, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i'm having troubles with one of my cake apps
>
> > basically the app won't load any css.
> > if i copy/paste css link in browser's address bar cake returns an
> > error page like this:
>
> > Missing Controller
>
> > Error: CssController could not be found.
>
> > Error: Create the class CssController below in file:
> > pacchi_alluminio_grezzi\controllers\css_controller.php
>
> >  > class CssController extends AppController {
>
> >         var $name = 'Css';}
>
> > ?>
>
> > Notice: If you want to customize this error message, create
> > pacchi_alluminio_grezzi\views\errors\missing_controller.ctp
>
> > other 4 apps, sharing the same core/webserver with the broken one, are
> > working flawlessly
>
> > css are linked via htmlHelper.
>
> > what can i do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake looking for css controller?

2009-09-04 Thread Ernesto

Hello.

i'm having troubles with one of my cake apps

basically the app won't load any css.
if i copy/paste css link in browser's address bar cake returns an
error page like this:

Missing Controller

Error: CssController could not be found.

Error: Create the class CssController below in file:
pacchi_alluminio_grezzi\controllers\css_controller.php



Notice: If you want to customize this error message, create
pacchi_alluminio_grezzi\views\errors\missing_controller.ctp

other 4 apps, sharing the same core/webserver with the broken one, are
working flawlessly

css are linked via htmlHelper.

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



get current MySQL version

2009-07-23 Thread Ernesto

hello.

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



Disable an helper from a controller action

2009-07-13 Thread Ernesto

Hello.

i have a controller with some actions:

- index
- add
- delete
- pdfreport

i want to disable the "TidyHelper" in pdfreport action 'cause it will
break my pdf.

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



Re: load a CSS file if DEBUG > 0

2009-07-13 Thread Ernesto

y u're right.

thx for help.

On 13 Lug, 11:15, Andreas Derksen  wrote:
> hi,
> what would be the point of doing so? besides, i think view "things"
> belong to the view part of mvc :)
>
> greets
> Andreas
>
> Ernesto schrieb:
>
>
>
> > same way i'm using.
>
> > what about load this css from App_Controller?
>
> > On 13 Lug, 10:15, Andreas Derksen  wrote:
>
> >> Hi,
> >> i do: if( Configure::read('debug')>0) echo $html->css('debug'); else '';
> >> in my layouts head.
>
> >> greets
> >> Andreas
>
> >> Ernesto schrieb:
>
> >>> Hello.
>
> >>> i've coded a simple css file that helps me display the Cake's SQL log.
>
> >>> this css needs to be loaded only when debug > 0.
>
> >>> how can i do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: load a CSS file if DEBUG > 0

2009-07-13 Thread Ernesto

same way i'm using.

what about load this css from App_Controller?

On 13 Lug, 10:15, Andreas Derksen  wrote:
> Hi,
> i do: if( Configure::read('debug')>0) echo $html->css('debug'); else '';
> in my layouts head.
>
> greets
> Andreas
>
> Ernesto schrieb:
>
>
>
> > Hello.
>
> > i've coded a simple css file that helps me display the Cake's SQL log.
>
> > this css needs to be loaded only when debug > 0.
>
> > how can i do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



load a CSS file if DEBUG > 0

2009-07-13 Thread Ernesto

Hello.

i've coded a simple css file that helps me display the Cake's SQL log.

this css needs to be loaded only when debug > 0.

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



Re: Problem with cake and HTML encoding

2009-07-09 Thread Ernesto

Hurray

everything's working!!!

i changed the entire DB charset/collations to UTF-8 and added
"defaultCharSet = UTF-8" to my PHP.ini

tonight i'll be veeery drunk :)

On 9 Lug, 17:07, Ernesto  wrote:
> Yes the data is being saved but with "-00-00 00:00:00" value
>
> On 9 Lug, 16:36, Martin Westin  wrote:
>
>
>
> > Then Cake might be trying to save utf8 to the "latin" database and
> > converting the data for you at some stage.
>
> > Come to think of it... is the problematic data being saved to the db?
> > Can you check the contents of the database directly?
> > Cake might be converting the encoding at the output of the dump.
>
> > As a rule, when you have the db, Cake or the html set to a different
> > character encoding than the others you will see strange things with
> > non-latin characters. (then again, the minus-sign should be generic
> > enough to pass untouched).
>
> > Sorry, just ramblings. I havent investigated the details. I just
> > figured I'd better set everything to the same encoding to avoid
> > further problems (and oh boy did I have problems at one point).
>
> > On Jul 9, 3:02 pm, Ernesto  wrote:
>
> > > Hi Martin.
>
> > > i really appreciated your hints.
>
> > > here's my findings
> > > - I coded an "echo '';" in the non-working layout --> the dashes
> > > are correctly printed.
> > > - I coded another "echo '';" in one of the non-working views -->
> > > the dashed are still correctly printed
> > > - The data is auto-filled by the controller, this app has no forms
> > > - all 5 views are using the same DB Connection and the same Database
> > > - the SQL Connection, the DB and all the DB's tables have the same
> > > collation ("latin1_swedish_ci")
> > > - all the DateTime fields has no collation selected
> > > - Cake app has UTF-8 encoding
>
> > > the problem is still here :(
>
> > > On 9 Lug, 11:54, Martin Westin  wrote:
>
> > > > Did I get this right:
> > > > This problem is with datetime-fields when one of your layouts is used
> > > > bit not the other.
>
> > > > The problem looks a bit like an encoding problem (utf8/latin1) of some
> > > > kind. I try to make sure that html layouts, Cake's app encoding, sql
> > > > connection, database, tables and fields... in short: everything uses
> > > > the same encoding.
>
> > > > if you pr (or debug) the data, it will still be output to the browser
> > > > and to be sure the dashes (minuses) are ok you need to look at the
> > > > source of the html output.
>
> > > > You should start by looking at the form (the data is from a form?)
> > > > before posting. Does the problem-layout output the dashes ok?
> > > > Look at the html head for encoding info, compare to any encoding
> > > > headers sent (using Firefox, Developer extension).
> > > > Compare that to the working layout.
>
> > > > Then work your way back towards the model. Check in the controller,
> > > > then the Model. Hopefully you will find where thing do crazy.
>
> > > > My guess is either in the initial output to the form, or in the post
> > > > back to Cake.
>
> > > > On Jul 9, 11:05 am, Ernesto  wrote:
>
> > > > > i still haven't find a solution...
>
> > > > > i pr-ed $this->data in model::beforeSave.
>
> > > > > everything looks correct.
>
> > > > > this could be a MySQL-related issue :(
>
> > > > > On 8 Lug, 17:18, Ernesto  wrote:
>
> > > > > > this app is a very simple app. It is composed by a single 
> > > > > > controller,
> > > > > > two layouts and 5 views.
> > > > > > there's no app_controller or app_model and even no behaviors.
> > > > > > i'm having this problem on the last 2 views, both using the second
> > > > > > ("striptothebone") layout.
> > > > > > The other 3 views are working fine.
> > > > > > Every views saves one DateTime.
>
> > > > > > On 8 Lug, 16:48, Robert P  wrote:
>
> > > > > > > There are a lot of resulting steps between you passing in your 
> > > > > > > data
> > > > > > > and the resulting SQL being queried. Please provide some more
> > > > > > >

Re: Problem with cake and HTML encoding

2009-07-09 Thread Ernesto

no, i'm not using sanitize

On 9 Lug, 17:01, mehodgson  wrote:
> Are you using the Sanitize component on your data?  If you are you and
> you use the clean() function you may need to set encode=false.
>
> On Jul 8, 6:15 am, Ernesto  wrote:
>
>
>
> > Hello.
>
> > i'm having some troubles with cake.
>
> > here's my this->data array
>
> > Array(
> >         [id] = 30
> >         [date] = 2009-11-23
> > )
>
> > here's a piece of my SQL dump
>
> > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
> > `table`.`id` = 30
>
> > why is cake de-coding the "-" in date???
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with cake and HTML encoding

2009-07-09 Thread Ernesto

Yes the data is being saved but with "-00-00 00:00:00" value

On 9 Lug, 16:36, Martin Westin  wrote:
> Then Cake might be trying to save utf8 to the "latin" database and
> converting the data for you at some stage.
>
> Come to think of it... is the problematic data being saved to the db?
> Can you check the contents of the database directly?
> Cake might be converting the encoding at the output of the dump.
>
> As a rule, when you have the db, Cake or the html set to a different
> character encoding than the others you will see strange things with
> non-latin characters. (then again, the minus-sign should be generic
> enough to pass untouched).
>
> Sorry, just ramblings. I havent investigated the details. I just
> figured I'd better set everything to the same encoding to avoid
> further problems (and oh boy did I have problems at one point).
>
> On Jul 9, 3:02 pm, Ernesto  wrote:
>
>
>
> > Hi Martin.
>
> > i really appreciated your hints.
>
> > here's my findings
> > - I coded an "echo '';" in the non-working layout --> the dashes
> > are correctly printed.
> > - I coded another "echo '';" in one of the non-working views -->
> > the dashed are still correctly printed
> > - The data is auto-filled by the controller, this app has no forms
> > - all 5 views are using the same DB Connection and the same Database
> > - the SQL Connection, the DB and all the DB's tables have the same
> > collation ("latin1_swedish_ci")
> > - all the DateTime fields has no collation selected
> > - Cake app has UTF-8 encoding
>
> > the problem is still here :(
>
> > On 9 Lug, 11:54, Martin Westin  wrote:
>
> > > Did I get this right:
> > > This problem is with datetime-fields when one of your layouts is used
> > > bit not the other.
>
> > > The problem looks a bit like an encoding problem (utf8/latin1) of some
> > > kind. I try to make sure that html layouts, Cake's app encoding, sql
> > > connection, database, tables and fields... in short: everything uses
> > > the same encoding.
>
> > > if you pr (or debug) the data, it will still be output to the browser
> > > and to be sure the dashes (minuses) are ok you need to look at the
> > > source of the html output.
>
> > > You should start by looking at the form (the data is from a form?)
> > > before posting. Does the problem-layout output the dashes ok?
> > > Look at the html head for encoding info, compare to any encoding
> > > headers sent (using Firefox, Developer extension).
> > > Compare that to the working layout.
>
> > > Then work your way back towards the model. Check in the controller,
> > > then the Model. Hopefully you will find where thing do crazy.
>
> > > My guess is either in the initial output to the form, or in the post
> > > back to Cake.
>
> > > On Jul 9, 11:05 am, Ernesto  wrote:
>
> > > > i still haven't find a solution...
>
> > > > i pr-ed $this->data in model::beforeSave.
>
> > > > everything looks correct.
>
> > > > this could be a MySQL-related issue :(
>
> > > > On 8 Lug, 17:18, Ernesto  wrote:
>
> > > > > this app is a very simple app. It is composed by a single controller,
> > > > > two layouts and 5 views.
> > > > > there's no app_controller or app_model and even no behaviors.
> > > > > i'm having this problem on the last 2 views, both using the second
> > > > > ("striptothebone") layout.
> > > > > The other 3 views are working fine.
> > > > > Every views saves one DateTime.
>
> > > > > On 8 Lug, 16:48, Robert P  wrote:
>
> > > > > > There are a lot of resulting steps between you passing in your data
> > > > > > and the resulting SQL being queried. Please provide some more
> > > > > > information and code examples.
>
> > > > > > On Jul 8, 9:33 pm, Ernesto  wrote:
>
> > > > > > > DateTime
> > > > > > > default = null
> > > > > > > null field
>
> > > > > > > On 8 Lug, 15:20, Alastair  wrote:
>
> > > > > > > > On Jul 8, 2:15 pm, Ernesto  wrote:
>
> > > > > > > > > Hello.
>
> > > > > > > > > i'm having some troubles with cake.
>
> > > > > > > > > here's my this->data array
>
> > > > > > > > > Array(
> > > > > > > > >         [id] = 30
> > > > > > > > >         [date] = 2009-11-23
> > > > > > > > > )
>
> > > > > > > > > here's a piece of my SQL dump
>
> > > > > > > > > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' 
> > > > > > > > > WHERE
> > > > > > > > > `table`.`id` = 30
>
> > > > > > > > > why is cake de-coding the "-" in date???
>
> > > > > > > > Is the "date" field definitely a date or datetime type in your
> > > > > > > > database?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with cake and HTML encoding

2009-07-09 Thread Ernesto

Hi Martin.

i really appreciated your hints.

here's my findings
- I coded an "echo '';" in the non-working layout --> the dashes
are correctly printed.
- I coded another "echo '';" in one of the non-working views -->
the dashed are still correctly printed
- The data is auto-filled by the controller, this app has no forms
- all 5 views are using the same DB Connection and the same Database
- the SQL Connection, the DB and all the DB's tables have the same
collation ("latin1_swedish_ci")
- all the DateTime fields has no collation selected
- Cake app has UTF-8 encoding

the problem is still here :(

On 9 Lug, 11:54, Martin Westin  wrote:
> Did I get this right:
> This problem is with datetime-fields when one of your layouts is used
> bit not the other.
>
> The problem looks a bit like an encoding problem (utf8/latin1) of some
> kind. I try to make sure that html layouts, Cake's app encoding, sql
> connection, database, tables and fields... in short: everything uses
> the same encoding.
>
> if you pr (or debug) the data, it will still be output to the browser
> and to be sure the dashes (minuses) are ok you need to look at the
> source of the html output.
>
> You should start by looking at the form (the data is from a form?)
> before posting. Does the problem-layout output the dashes ok?
> Look at the html head for encoding info, compare to any encoding
> headers sent (using Firefox, Developer extension).
> Compare that to the working layout.
>
> Then work your way back towards the model. Check in the controller,
> then the Model. Hopefully you will find where thing do crazy.
>
> My guess is either in the initial output to the form, or in the post
> back to Cake.
>
> On Jul 9, 11:05 am, Ernesto  wrote:
>
>
>
> > i still haven't find a solution...
>
> > i pr-ed $this->data in model::beforeSave.
>
> > everything looks correct.
>
> > this could be a MySQL-related issue :(
>
> > On 8 Lug, 17:18, Ernesto  wrote:
>
> > > this app is a very simple app. It is composed by a single controller,
> > > two layouts and 5 views.
> > > there's no app_controller or app_model and even no behaviors.
> > > i'm having this problem on the last 2 views, both using the second
> > > ("striptothebone") layout.
> > > The other 3 views are working fine.
> > > Every views saves one DateTime.
>
> > > On 8 Lug, 16:48, Robert P  wrote:
>
> > > > There are a lot of resulting steps between you passing in your data
> > > > and the resulting SQL being queried. Please provide some more
> > > > information and code examples.
>
> > > > On Jul 8, 9:33 pm, Ernesto  wrote:
>
> > > > > DateTime
> > > > > default = null
> > > > > null field
>
> > > > > On 8 Lug, 15:20, Alastair  wrote:
>
> > > > > > On Jul 8, 2:15 pm, Ernesto  wrote:
>
> > > > > > > Hello.
>
> > > > > > > i'm having some troubles with cake.
>
> > > > > > > here's my this->data array
>
> > > > > > > Array(
> > > > > > >         [id] = 30
> > > > > > >         [date] = 2009-11-23
> > > > > > > )
>
> > > > > > > here's a piece of my SQL dump
>
> > > > > > > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
> > > > > > > `table`.`id` = 30
>
> > > > > > > why is cake de-coding the "-" in date???
>
> > > > > > Is the "date" field definitely a date or datetime type in your
> > > > > > database?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with cake and HTML encoding

2009-07-09 Thread Ernesto

i still haven't find a solution...

i pr-ed $this->data in model::beforeSave.

everything looks correct.

this could be a MySQL-related issue :(

On 8 Lug, 17:18, Ernesto  wrote:
> this app is a very simple app. It is composed by a single controller,
> two layouts and 5 views.
> there's no app_controller or app_model and even no behaviors.
> i'm having this problem on the last 2 views, both using the second
> ("striptothebone") layout.
> The other 3 views are working fine.
> Every views saves one DateTime.
>
> On 8 Lug, 16:48, Robert P  wrote:
>
>
>
> > There are a lot of resulting steps between you passing in your data
> > and the resulting SQL being queried. Please provide some more
> > information and code examples.
>
> > On Jul 8, 9:33 pm, Ernesto  wrote:
>
> > > DateTime
> > > default = null
> > > null field
>
> > > On 8 Lug, 15:20, Alastair  wrote:
>
> > > > On Jul 8, 2:15 pm, Ernesto  wrote:
>
> > > > > Hello.
>
> > > > > i'm having some troubles with cake.
>
> > > > > here's my this->data array
>
> > > > > Array(
> > > > >         [id] = 30
> > > > >         [date] = 2009-11-23
> > > > > )
>
> > > > > here's a piece of my SQL dump
>
> > > > > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
> > > > > `table`.`id` = 30
>
> > > > > why is cake de-coding the "-" in date???
>
> > > > Is the "date" field definitely a date or datetime type in your
> > > > database?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: some simple Helpers how-tos

2009-07-08 Thread Ernesto

THx both. they all worked :)

On 9 Lug, 02:05, brian  wrote:
> B: Do you mean a class variable?
>
> $this->myHelper->enabled = false;
>
>
>
> On Wed, Jul 8, 2009 at 2:55 PM, majna wrote:
>
> > A:
> > $view =& ClassRegistry::getObject('view');
> > debug($view->layout);
>
> > On Jul 8, 5:22 pm, Ernesto  wrote:
> >> Hello.
>
> >> 2 simple questions about helpers:
>
> >> A - how can i retrieve the current layout name from inside an helper?
>
> >> B - myHelper class has a global variable called "enabled". Is there
> >> any way to set myHelper::enabled = false from a controller?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



some simple Helpers how-tos

2009-07-08 Thread Ernesto

Hello.

2 simple questions about helpers:

A - how can i retrieve the current layout name from inside an helper?

B - myHelper class has a global variable called "enabled". Is there
any way to set myHelper::enabled = false from a controller?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with cake and HTML encoding

2009-07-08 Thread Ernesto

this app is a very simple app. It is composed by a single controller,
two layouts and 5 views.
there's no app_controller or app_model and even no behaviors.
i'm having this problem on the last 2 views, both using the second
("striptothebone") layout.
The other 3 views are working fine.
Every views saves one DateTime.

On 8 Lug, 16:48, Robert P  wrote:
> There are a lot of resulting steps between you passing in your data
> and the resulting SQL being queried. Please provide some more
> information and code examples.
>
> On Jul 8, 9:33 pm, Ernesto  wrote:
>
>
>
> > DateTime
> > default = null
> > null field
>
> > On 8 Lug, 15:20, Alastair  wrote:
>
> > > On Jul 8, 2:15 pm, Ernesto  wrote:
>
> > > > Hello.
>
> > > > i'm having some troubles with cake.
>
> > > > here's my this->data array
>
> > > > Array(
> > > >         [id] = 30
> > > >         [date] = 2009-11-23
> > > > )
>
> > > > here's a piece of my SQL dump
>
> > > > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
> > > > `table`.`id` = 30
>
> > > > why is cake de-coding the "-" in date???
>
> > > Is the "date" field definitely a date or datetime type in your
> > > database?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with cake and HTML encoding

2009-07-08 Thread Ernesto

DateTime
default = null
null field

On 8 Lug, 15:20, Alastair  wrote:
> On Jul 8, 2:15 pm, Ernesto  wrote:
>
>
>
>
>
> > Hello.
>
> > i'm having some troubles with cake.
>
> > here's my this->data array
>
> > Array(
> >         [id] = 30
> >         [date] = 2009-11-23
> > )
>
> > here's a piece of my SQL dump
>
> > UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
> > `table`.`id` = 30
>
> > why is cake de-coding the "-" in date???
>
> Is the "date" field definitely a date or datetime type in your
> database?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem with cake and HTML encoding

2009-07-08 Thread Ernesto

Hello.

i'm having some troubles with cake.

here's my this->data array

Array(
[id] = 30
[date] = 2009-11-23
)

here's a piece of my SQL dump

UPDATE `table` SET `id` = 30, `date` = '2009-11-23' WHERE
`table`.`id` = 30

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



Re: Poll: What do you build with CakePHP?

2009-07-08 Thread Ernesto

Hosted Applications

On 8 Lug, 11:04, Martin Westin  wrote:
> I was wondering what type of apps you all build?
>
> Mainly, do you mostly build:
> 1. hosted applications (e.g. Bakery, TheChaw, Backpack...), hosted in
> a single place where every user has an account in the same "instance"
> of the application.
> or
> 2. distributable applications (e.g. Neutrino, Wordpress, phpbb),
> people (buy) download the code and run on their own server.
>
> For myself, my day-job is building an application that is hosted by us
> but I still build it like a distibutable app. Then I muck about with
> dynamically loading configs and stuff to simplify deployment of new
> "instances". My hobby application (the main one) is a distributable
> app that I am thinking of re-coding as a hosted app.
>
> It seems that most successful apps these days are hosted services so i
> am curious what my fellow bakers are doing.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Strange date behavior

2009-07-07 Thread Ernesto

my controller has 5 functions, each one with his own view.
3 of them are using the "main" layout, the other 2 the
"striptothebone" layout.

these last 2 views are giving me that problem.

the other 3 are working fine.

On 7 Lug, 16:44, Carlos Gonzalez Lavin 
wrote:
> Sounds like a sanitation problem... Did you tell cake in any part of your
> application to escape into html entities? It seems to be screwing up with
> something and turning the "-" into the html entity -
>
> 2009/7/7 Ernesto 
>
>
>
>
>
> > hello.
>
> > here's my function
>
> > function addDate ($id) {
> >        $this->data["order_id"] = $id;
> >        $this->data["myDate"] = date("Y-m-d");
> >        pr ($this->data);
> >        $this->Order->save($this->data);
> > }
>
> > here's the pr output
>
> > Array(
> >        [order_id] = 1839
> >        [myDate] = 2009-07-07
> > )
>
> > and here's a portion the resultant Cake's SQL log
>
> > UPDATE `orders` SET `order_id` = 1839, `myDate` = '2009-07-07'
> > WHERE `orders`.`order_id` = 1839
>
> > please notice the "-" replaced by -
>
> > due to this replacement MySQL isn't saving my changes.
>
> > i can't find where's the error.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Strange date behavior

2009-07-07 Thread Ernesto

hello.

here's my function

function addDate ($id) {
$this->data["order_id"] = $id;
$this->data["myDate"] = date("Y-m-d");
pr ($this->data);
$this->Order->save($this->data);
}

here's the pr output

Array(
[order_id] = 1839
[myDate] = 2009-07-07
)

and here's a portion the resultant Cake's SQL log

UPDATE `orders` SET `order_id` = 1839, `myDate` = '2009-07-07'
WHERE `orders`.`order_id` = 1839

please notice the "-" replaced by -

due to this replacement MySQL isn't saving my changes.

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



Re: CakePHP and the new MS SQL 2005/2008 Driver for PHP

2009-07-06 Thread Ernesto

i have

2000.80.194.0

On 6 Lug, 16:58, Robert Edeker  wrote:
> What dll version is that?  The one I have is 2000.2.8.0 .  Although I've
> read reports of the updated driver not being reliable.
>
>
>
> On Mon, Jul 6, 2009 at 10:51 AM, Ernesto  wrote:
>
> > Hello.
>
> > i recently developed a CakePHP app using MSSQL 2005 as DB.
>
> > i updated ntwdblib.dll in apache/bin (and in php/bin also) directory
> > and now cake's mssql driver is working fine :)
>
> > On 6 Lug, 16:09, idx  wrote:
> > > Hello,
>
> > >http://groups.google.com/group/cake-php/browse_thread/thread/8babbaf1...
>
> > > Regarding this old thread, has anyone modified the mssql class
> > > appropriately to work with Microsoft's new sqlsrv driver within
> > > CakePHP?
>
> > >   I'm on the fence on whether to use Cake to quickly collect data
> > > outside of our standard application or not.  I do have access to MySQL
> > > so I could fall back to that if necessary, but would like to avoid
> > > it.  I also need to make sure this mini-app can authenticate via LDAP
> > > (active directory) and limit application access via an AD group.
>
> > >   The app itself should be dead simple, but I haven't worked with cake
> > > enough to know if I can pull it off in a few days.  (regardless of
> > > cake I still have to write an application in the other proprietary
> > > system to initiate this process so that will eat up some time.)
>
> > > Thank You,
>
> > > Robert
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP and the new MS SQL 2005/2008 Driver for PHP

2009-07-06 Thread Ernesto

Hello.

i recently developed a CakePHP app using MSSQL 2005 as DB.

i updated ntwdblib.dll in apache/bin (and in php/bin also) directory
and now cake's mssql driver is working fine :)

On 6 Lug, 16:09, idx  wrote:
> Hello,
>
> http://groups.google.com/group/cake-php/browse_thread/thread/8babbaf1...
>
> Regarding this old thread, has anyone modified the mssql class
> appropriately to work with Microsoft's new sqlsrv driver within
> CakePHP?
>
>   I'm on the fence on whether to use Cake to quickly collect data
> outside of our standard application or not.  I do have access to MySQL
> so I could fall back to that if necessary, but would like to avoid
> it.  I also need to make sure this mini-app can authenticate via LDAP
> (active directory) and limit application access via an AD group.
>
>   The app itself should be dead simple, but I haven't worked with cake
> enough to know if I can pull it off in a few days.  (regardless of
> cake I still have to write an application in the other proprietary
> system to initiate this process so that will eat up some time.)
>
> Thank You,
>
> Robert
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Containable grabbing empty data

2009-07-03 Thread Ernesto

Hello

Item belongsTo Order belongsTo Customer.

i'm grabbing data from Items Controller.

i need all items having Weight > 10 and Order.Date = $date
i also need to know who ordered that item.

here's my code

$date = date("Y-m-d");

$this->Item->find("all",
array(
"conditions" => array(
"Weight >" => 10
),
"contain" => array(
"Order" => array(
"conditions" => array(
"Date" => $date
),
"Customer"
)
)
)
);

here's my results

Array
(
[0] => Array
(
[Item] => Array
(
[Item_id] => 1105
[Order_id] => 20
[Code] => FOOFOOFOO
[Weight] => 15
)
[Order] => Array
(
[Order_id] => 20
[Date] => 2009-07-03
)
)

[1] => Array
(
[Item] => Array
(
[Item_id] => 1403
[Order_id] => 21
[Code] => ABCDEFG
[Weight] => 20
)
[Order] => Array
(
[Order_id] =>
[Date] =>
)
)
)

- there's no "Customer" model
- Items are loaded even if Item.Order does not respond to conditions

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



Read-Only app

2009-06-30 Thread Ernesto

Hello

i'm baking a read-only app. This app shouldn't save any kind of data.

here's my bet



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



Re: load css from a subfolder by default

2009-06-29 Thread Ernesto

hi Vijay. Thx for the response.

i'm looking for a method to change the default css folder.

your code surely works but that's not exactly what i'm looking for :)

On 29 Giu, 15:05, Vijay Kumbhar  wrote:
> Hello Ernesto,
>
> You can use the following code,if your css file is in webroot/abc/abc.css
> folder,
>
> $html->css('abc/abc.css');
>
> By default cakephp searches for the css in webroot folder. So better way to
> store the css , js, images in the webroot folder.
>
> On Mon, Jun 29, 2009 at 5:14 PM, Ernesto  wrote:
>
> > Hello.
>
> > is there any way to load css files from a subfolder by default?
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



load css from a subfolder by default

2009-06-29 Thread Ernesto

Hello.

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



css sharing not working.

2009-06-29 Thread Ernesto

Hello.

i'm having some troubles with css sharing.

my cake folder tree looks like this

cake
apps
 app_1
  webroot //note: this folder is empty
 app_2
  webroot //note: this folder is empty
shared_items
 views
 vendors
  css
   test.css
  js
  tcpdf

as stated in this --->
http://groups.google.com/group/cake-php/browse_frm/thread/b4414e0a78d37a63/01fcac2a00ae08de?lnk=gst&q=share+css#01fcac2a00ae08de
thread i created a vendors/css folder

i also added additional paths to both apps in bootstrap.php

 if (!defined("SHARED_ITEMS_FOLDER")) {
define("SHARED_ITEMS_FOLDER", dirname(ROOT) . DS ."shared items".
DS);
}

$viewPaths = array(SHARED_ITEMS_FOLDER ."views". DS);
$vendorPaths = array(SHARED_ITEMS_FOLDER ."vendors". DS);

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



Need help with my TidyHelper

2009-06-27 Thread Ernesto

Hello.

i have this little helper that works ok with standard HTML pages but
it screws up all my PDF reports

class TidyHelper extends AppHelper {

function __construct() {
ob_start();
}

function __destruct() {
$output = ob_get_clean();
if(class_exists("Tidy")) {
//here's the tidy code
}
echo $output;
}

}

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



Re: Cake function that does "Model.Field" to $array["Model"]["Field"]

2009-06-26 Thread Ernesto

i'm looking for the CakePHP's built-in function that converts dot-
separated strings (such as "Order.Code") to multi-level arrays like
this

Array(
[Order] => Array => (
[Code]
)
)

this function is used to parse the data posted from views

i can't find it!! T_T

On 26 Giu, 13:46, Eric Silva  wrote:
> $array["Model"]["*f*ield"] ??
>
> --
> Eric Silva
>
>
>
> On Fri, Jun 26, 2009 at 8:37 AM, Ernesto  wrote:
>
> > Hello
>
> > i can't find the CakePHP's built-in function that does "Model.Field"
> > to $array["Model"]["Field"]
>
> > i'll use that function in a Helper.
>
> > is that correct?
>
> > better ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



<    1   2   3   4   >