Strange error in edit ...

2007-12-17 Thread Dilbert

I'm having a very strange error when I edit an Article...
The article is not edited, is added! There's a new article with the
changes of the article I wanted to edit.
In debug mode the query is INSERT INTO
This is the admin_edit function in the controller:

function admin_edit($id = null) {
$this-set('utente',$this-Session-Read('User'));

if (!$id  empty($this-data)) {
$this-Session-setFlash('Invalid Article');
$this-redirect(array('action'='index'), null, 
true);
}
if (!empty($this-data)) {
$this-cleanUpFields();
if ($this-Article-save($this-data)) {
$this-Session-setFlash('The Article 
has been saved');

$this-redirect(array('action'='index'), null, true);
} else {
$this-Session-setFlash('The Article 
could not be saved. Please,
try again.');
}
}
if (empty($this-data)) {
$this-data = $this-Article-read(null, $id);
}
$towns = $this-Article-Town-generateList();
$sections = $this-Article-Section-generateList();
$users = $this-Article-User-generateList();
$modes = $this-Article-Mode-generateList();
$this-set(compact('towns','sections','users','modes'));


}
--~--~-~--~~~---~--~~
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: Strange error in edit ...

2007-12-17 Thread Dilbert

I found the error...no
echo $form-input('id');
in admin_edit.ctp =)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pagination links within sections

2007-12-14 Thread Dilbert

I have a page that shows all the articles related to a town (http://
localhost/towns/view/1)
The paginator links are
http://localhost/towns/view/page:2
http://localhost/towns/view/page:3
and so on
How can I pass the town id so the link is
http://localhost/towns/view/1/page:2
http://localhost/towns/view/1/page:3
...
?
Thank you.

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



Re: Pagination links within sections

2007-12-14 Thread Dilbert

Thank you very much, I didn't know about that page :-)

On Dec 14, 3:48 pm, grigri [EMAIL PROTECTED] wrote:
 Have you read the How to retain search param in paging? entries on
 the Frequent Discussions page?

 On Dec 14, 2:45 pm, Dilbert [EMAIL PROTECTED] wrote:

  I have a page that shows all the articles related to a town (http://
  localhost/towns/view/1)
  The paginator links 
  arehttp://localhost/towns/view/page:2http://localhost/towns/view/page:3
  and so on
  How can I pass the town id so the link 
  ishttp://localhost/towns/view/1/page:2http://localhost/towns/view/1/page:3
  ...
  ?
  Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Limit number of words returned in a query

2007-12-09 Thread Dilbert

Thank you very much, the truncate function works very well.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Limit number of words returned in a query

2007-12-08 Thread Dilbert

Let's say I have an article with a text field that is the full
content. How can I have a preview of the text in the home page
limiting the numbers of phrases or words (a bit like in drupal)?
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: can't upload

2007-11-30 Thread Dilbert



On 30 Nov, 18:35, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 Check the encoding on the form, it must be multipart/form-data.

 ?php echo $form-create('Model', array('type' = 'file')); ?

 also check what is in

 ?php pr($_FILES); ?

 2007/11/30, Christopher E. Franklin, Sr. [EMAIL PROTECTED]:



  Well, I guess my first question would be, are you using a browse
  control to browse for the image on your comp or is it already on the
  hard drive of the server some where?

  Second, can you post the upload function as well?

  On Nov 30, 8:34 am, Dilbert [EMAIL PROTECTED] wrote:
   I have an article model with an image field(I don't want to create
   another model).
   This is the code for admin_add

   function admin_add() {
   if (!empty($this-data)) {
   $this-cleanUpFields();
   $this-Article-create();
   if ($this-Article-save($this-data)) {
   if (!empty($this-data['Article']['image']))
   {
   $fileup=$this-data['Article']['image'];
   
   $this-Upload-upload('$fileup','../webroot/img/
   uploads/');
}
   $this-Session-setFlash('Article
   saved');
   $this-redirect(array('action'='index'), null, true);*/

   } else {
   $this-Session-setFlash('Article not 
   saved');
   }
   }
   }

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



can't upload

2007-11-30 Thread Dilbert

I have an article model with an image field(I don't want to create
another model).
This is the code for admin_add


function admin_add() {
if (!empty($this-data)) {
$this-cleanUpFields();
$this-Article-create();
if ($this-Article-save($this-data)) {
if (!empty($this-data['Article']['image']))
{
$fileup=$this-data['Article']['image'];
$this-Upload-upload('$fileup','../webroot/img/
uploads/');
 }
$this-Session-setFlash('Article
saved');$this-
redirect(array('action'='index'), null, true);*/
} else {
$this-Session-setFlash('Article not saved');
}
}
}

The folder uploads is 777.
Where is the problem?
Thank you.

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



Unable to use TranslateBehaviour

2007-09-12 Thread dilbert

Hi,

my problem is totally weird. I´ll have to use the TranslateBehaviour
within a project and it won´t work. Finally i have installed a new
cake, create a simple model named Test, a controller named
TestsController with scaffolding enabled and the table tests. If i
try to add a new entry i get the message The Test has been saved but
nothing is inserted to the database. The tables for i18n are also
existing.

---
CREATE TABLE `tests` (
  `id` int(10) NOT NULL auto_increment,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
)

class Test extends AppModel{
var $name = Test;
var $actsAs = array(Translate = array(first_name, last_name,
description));
}

class TestsController extends AppController{
var $name = Tests;
var $scaffold;
}
---

Thanks for any ideas, solutions, whatever...


--~--~-~--~~~---~--~~
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: Unable to use TranslateBehaviour

2007-09-12 Thread dilbert

Finally i got my own solution, which in my opinion is a bug. If you
define all fields to be translated (as described above), nothing
happens. If you define for example only first_name and last_name
to translate, everything works fine. Weird, isn´t it?


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



Tutorial cake_php.doc

2007-06-30 Thread Dilbert

Hi folks!
I've red the Tutorial (the cake_php.doc file).
Who did write it? Can I translate it in italian?


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