CakePHP 1.3 Multiple Model Trees with translations getting errors

2012-10-16 Thread Constantin.FF
I am using one database table for storing all the data of the site. Every model saves its records in this table and every model has Tree and Translate behavior. Every record has a `type` row where the model name is stored. So when saving data for each model it also saves a record in the i18n ta

Switch languages links

2012-01-31 Thread Constantin.FF
I have the following routes: Router::connect("/:lang", array('controller' => 'pages', 'slug' => 'home'), array('lang' => '[a-z]{3}', 'pass' => array('slug'))); Router::connect("/:lang/:controller", array(), array('lang' => '[a- z]{3}', 'pass' => array('slug'))); Router::connect("/:lang/

Transfer params for current window

2012-01-07 Thread Constantin.FF
I have a link that opens a popup window. If the window is opened as popup there are some things that are to be shown and other to be hidden. And if it is not opened as popup you get the usual stuff. For example in tinymce you open a popup window to insert a image , so I need an 'Insert' link for ev

Different localization phrase

2012-01-04 Thread Constantin.FF
I need to translate several phrases into different from the current language. If I write __('Title') I get it in the current language set in the session. How to get it in the other languages? For example I need to get 'Title' translated into French, Italian, German ... on one page -- Our newest s

Re: Error saving i18n

2011-12-29 Thread Constantin.FF
also i use $model->data[$model->alias]['title'] = $title; to set the title field On Dec 28, 8:39 pm, Constantin FF wrote: > absolutely the same result after adding >         $model->set(array('title' => $title, 'body' => $title)); > at the end of beforeSave -- Our newest site for the community:

Error saving i18n

2011-12-28 Thread Constantin.FF
I am using Behavior which beforeSave sets the title of the post. I am using this for attachments to set title, slug, create thumbs and so on .. With the testing till now these are the results: Set title inside: -Behavior beforeSave - does not save inside i18n table -Model bofereSave - does not sav

Re: CakePHP does not save multilanguage attachment

2011-11-23 Thread Constantin.FF
@msujit do you use a Behavior in your attachment model to set the title and to create thumbs before inserting them in the database or everything is inside the model? I have tested to set a new 'title' field in me form and this title got inside the i18n table. On Nov 23, 5:43 pm, Constantin FF wro

CakePHP does not save multilanguage attachment

2011-11-23 Thread Constantin.FF
My Attachment model actAs Translate to be able to translate the image titles, I get the attachment saved in it's attachments table, but nothing goes to the i18n table. This is the beforeSave model data: Array ( [Attachment] => Array ( [parent_id] => 0 [type] =>

Redirect depending on form field

2011-11-18 Thread Constantin.FF
I am trying to get page redirected (after add or edit) depending on a field of the form. Here is what I have done so far: View: ... $back_link = array('action' => 'browse', $this->Form- >value('Post.parent_id')); echo $this->Form->hidden('redirect_id', array('value' => json_encode($back_link))); .

Re: Slow reorder TreeBehaviour

2011-10-28 Thread Constantin.FF
Probably this could work but will be almost impossible to calculate the step for moveDown of each post also in this action are involved parents and children so in the $newSort each post is as post_id => order number. So if I do it like you suggested, first I will have to separate posts with same pa

Slow reorder TreeBehaviour

2011-10-28 Thread Constantin.FF
I need my tree sorted by each post sort value. Here is the function dealing with this. But it is executed extremely slow if some of the parents has more than 20-30 children function _sortPosts($newSort){ foreach ($newSort AS $id => $value) {

Moving part of a Tree in other section

2011-10-21 Thread Constantin.FF
My Post model have Tree behavior, and everything work just fine. Each post has a parent_id and lft,rght column. If I create and move posts in single level, everything is OK. But I get an error when I try to move a post which has one or more children. How to deal with this? Thanks -- Our newest s

Cookie write always return false

2011-10-21 Thread Constantin.FF
It is not a big deal but probably I do something wrong. This code always return false, but the cookie is set fine if($this->Cookie->write('paginate_limit', '7')){ $this->Session->setFlash(__('OK', true), 'default', array('class' => 'error'));

Re: Pagination generatetreelist results

2011-10-19 Thread Constantin.FF
the issue became a bit more complicated. Here is what I need as a result. I have the Post Model which behave as a Tree, and also every post has a parent or for the first level the parent is 0. Also every post has a sort number which helps for them to be sorted. I wold like to display paginated resu

Pagination generatetreelist results

2011-10-19 Thread Constantin.FF
I need to paginate the results of generatetreelist together with the Posts results. Already I have $this->paginate('Post' ); but also I need the treelist of the posts. I can do this by if check before the display of posts in the view or merging the arrays in the controller but is there more simple

Re: Tree reorder by value

2011-10-15 Thread Constantin.FF
e?  A MPTT tree should have a lot > > more values that this, mainly including parent_id, lft and rght. > > > HTH, Paul > > > On Oct 15, 12:29 am, "Constantin.FF" wrote: > >> I need to reorder a part of my tree. > >> I have given values for exam

Re: Tree reorder by value

2011-10-15 Thread Constantin.FF
s > > keys do ksort($myArray['my_key']). It's a standard PHP function that > > returns true or false. Google is your mate. > > > Jeremy Burns > > Class Outfit > > >http://www.classoutfit.com > > > On 15 Oct 2011, at 00:29, Constantin.FF wr

Tree reorder by value

2011-10-14 Thread Constantin.FF
I need to reorder a part of my tree. I have given values for example: Array ( [0] => 4 [1] => 5 [2] => 6 [3] => 9 [4] => 8 ) where for example 0,1,2,3,4 is the new order of the relevant item ids I have read all the documentation according the reorder (which is not much), and als

Re: Node and attachment forms on single page

2011-10-03 Thread Constantin.FF
... I tried to change the file input form with simple title and body fields, and to remove the Attachable behavior form the AddAttachment behavior ... and it is working, like this it add new row to the 'nodes' table with correct title adn body -- Our newest site for the community: CakePHP Video T

Node and attachment forms on single page

2011-10-03 Thread Constantin.FF
I have very simple Nodes model/view/controller which by default stores information like Title, Body... To each Node I need attached images, or other files. So I created a Uploads M/V/C with the attachable behavior from phpvideotutorials: http://pastebin.com/87pQtgib Now if I use the Uploads M/V/C I

David Persson Media Plugin - data to different database fields

2011-09-30 Thread Constantin.FF
Hello, I just installed David Persson Media Plugin to use it with Ajax uploader. The tutorial from here: http://pixelcone.com/tutorial/ajax-file-upload-using-jquery-and-cakephp-media-plugin/ But my database have different field names. And I would like to save some more information, not only the d