How to get JSON Response with AJAX link

2008-04-25 Thread Tomka

Hello.

I try to get a JSON object as response of an AJAX request.

The code in my view looks like this:

echo $ajax-link(TEST,
array(controller = mycontroller, action = myjsonview),
array(complete = testfunction(request, json);)
);

If I set the option update with an id of a div, I see the response:
a well formatted JSON-Object - so myjsonview seems to be coded
correctly. But how can a access this JSON-Object in my complete-
function?

Thanks for help!

Tomka.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Determine insert or update in beforeSave()

2008-04-04 Thread Tomka

Hello,

is there a better way to see whether model-beforeSave() is invoked
for an update or insert than to use

if (empty($this-id)  empty($this-data[$this-alias]['id'])){
  // insert
} else {
  // update
}

?

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



Old Model layout accessed

2008-04-04 Thread Tomka

Hello.

For development I use a local Xampp-installation on WinXP. My app
(cakePHP 1.2) is deployed on a linux webserver.

The following problem only exists on my development machine:
From time to time cake seems to access an old model-layout - I dont
know where to cache it. I changed the table-layout for the user-table
for example (deleting the column person_id). Now sometimes I get the
error

SQL Error: 1054: Unknown column 'User.person_id' in 'field list' [CORE
\cake\libs\model\datasources\dbo_source.php, line 440]

Usually this happens after I delete the app-directory in the htdocs-
path of xampp and copy the new files to there from my development
path.
Reload the accessed page does not help. Accessing the same page two
minutes later without doing anything at this time makes the error
disapear.

Where is the information cached and how can I disable this cache for
development?

Thanks in advance,

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



Re: Old Model layout accessed

2008-04-04 Thread Tomka

Hello.

 The cache is only read in production mode, in debug mode it's
 refreshed every time, so it's not a problem for development.

Thanks for your answer. I found this cache-directory and my models are
cached there although I set

Configure::write('debug', 2);

in config/core.php

Is there another position to activate development-mode in 1.2?

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



Re: Old Model layout accessed

2008-04-04 Thread Tomka

Argh!

I found my problem: In my development folder (the location where I
edit my files) the tmp-directory was not empty but contained a very
old model-cache!

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



Add new user form contains username of current user

2008-04-04 Thread Tomka

Hello.

I have a model User which I use with the Auth-component for Login to
the admin-area.
I also hava an UserController with a admin_add-method for adding new
users.

My problem: In the form of the add-view the field username is always
preset with the username of the current user.
setting the option value =  is no solution as the field should be
preset with the username if the form did not validate and is displayed
a second time.

Excerpt for my form-code:

echo $form-create(User);
echo $form-input(username, array(label = Benutzername));
echo $form-end(Save new user);

I think the problem is that the current logged-in user is stored in
the session. But how can I distinguish between this setting and the
user-input?

Thanks in advance.

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



setflash does not work

2008-02-24 Thread Tomka

Hello.

I'm using 1.2 beta and tried some baked code:

In my controller:
function view($id = null) {
$this-Session-setFlash(__(Invalid Place., true));
$this-redirect(array(action = index));
}

debug-Level is set to 2:
Configure::write('debug', 2);

If i request this action in the browser I'm directly redirected and
don't see the flash. What's wrong here?

Thanks for answers,

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



Debug Level 3 does not work

2008-02-18 Thread Tomka

Hello.

I'm using 1.2 beta.

In my installation there seems to be no difference between debug level
2 and 3! I can't see any controller dump. Does anyone has a hint for
me?

Thanks in advance,

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



Accessing schema in view

2008-02-17 Thread Tomka

Hello.

I tried and searched for an hour, but I could not find a solution:

How can I access the schema of a model in a view?

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



Paginator does not sort desc

2008-02-16 Thread Tomka

Hello.

I want to provide two buttons for each column in a table. The first
should sort the table asc by this colum, the second should sort desc.
Therefor I use the option direction.
But this option is not checked in the method paginator-sort. It
always sorts asc if the table was not sorted by this column before. Is
there a solution for my problem other than writing an own helper
extending the paginator?

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



Image as Title in Paginator prev and next

2008-02-10 Thread Tomka

Hello,

I'm using Version 1.2.

Is it somehow possible to use an image or another html-content as
title in the paginator's prev- and next-methods? Unfortunately my html
is escaped.
I'm looking for a parameter like in
link ($title, $url=null, $htmlAttributes=array(),
$confirmMessage=false, $escapeTitle=true)
the last one.

Thanks for answers.
Tomka

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