Automated builds including database structure and data [Slightly OT]

2006-12-08 Thread Langdon Stevenson
Hi Fellow Bakers I thought that I should share a recent experience with you. After my little disaster during the week with models in appController and a missing database table, I thought I should look into automating the synchronisations of database structures and data again. I looked for a

Re: can I use generateList( ) get rather than Id?

2006-12-08 Thread ERic ZoU
I was trying to define var $displayField = ' name '; but it seems doesnt work. Let me try again. For the second one, i should create a js: changeSelect( ). Thanks. Try to suffer it.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

RE: Group by?

2006-12-08 Thread Mariano Iglesias
You could use a custom query: $this->Model->findAll('GROUP BY field', null, null); Or you could also use this method: http://groups-beta.google.com/group/cake-php/browse_thread/thread/20f0352d66 7b0dda -MI -

RE: me again, warning and url...

2006-12-08 Thread Mariano Iglesias
Still didn't give us the ls -la ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googl

Re: Passing data to the view in a nice way?

2006-12-08 Thread the_woodsman
Thanks for the responses. Let me explain why, in my situation, this approach doesn't seem to scale. I'm talking about displaying various statistics from a DB, including aggregate functions (SUM, MAX, etc), for every week in a given month. In terms of passing this to a page, the obvious data struc

Re: me again, warning and url...

2006-12-08 Thread Rafael Apocalypse
-> Can you dump us ls -la of your amp/tmp? I couldn't understand that! I made all folders and subfolders inside tmp 777, but still doesn't working... I already deleted and replace the tmp folder... and the errors still happen, RA On 12/7/06, Mariano Iglesias <[EMAIL PROTECTED]> wrote: > > Did

Creating PDFs

2006-12-08 Thread Javier Ramirez Molina
Hello, I have been sometime trying to use the old[1] "creating pdfs easy" tutorial from the wiki, it based on html2fpdf[2] library. I can get it working but it doesn't use css at all. I'm trying to get a pdf that looks like the scaffolding index but I only get a totally plain table with some links

Re: Converting empty fields to null rather than 0 on "save".

2006-12-08 Thread nate
Better to do it in the beforeSave() callback of the model. --~--~-~--~~~---~--~~ 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 g

Converting empty fields to null rather than 0 on "save".

2006-12-08 Thread [EMAIL PROTECTED]
Hi, When I use a form to update a model, and I leave certain integer fields empty, those fields are saved as 0 in the database. Is there a simple way to change this behavior, or do I have to change these fields like this: if (trim($this->data->field) == '') { $this->data->field = NULL; } w/in

Re: SMS with Cake

2006-12-08 Thread Marcus Bointon
On 12/8/06, Sonic Baker <[EMAIL PROTECTED]> wrote: > Just wondering if anyone has come across the need to send SMS messages with > a cakePHP application before? > What would you recommend and why? Well, it's hard to say. What are you using it for, and when/how often do you need to send them? I'v

SMS with Cake

2006-12-08 Thread Sonic Baker
Just wondering if anyone has come across the need to send SMS messages with a cakePHP application before? I presume this is done in a controller and then saved to the model along with the return code from the SMS provider. Just wondering what methods people have used, ie: Send the message in the

Re: On the beauty of cakePHP deployment...

2006-12-08 Thread Langdon Stevenson
Nice story Tracy :-) I went through a similar process to discover Cake. I didn't ever develop anything with Ruby on Rails, but I had similar thoughts. Ultimately Cake was a no brainer for me. As you said, leveraging existing PHP skills, and a snap to deploy as well. It has been amazing watc

Paginated Autocomplete -- Conceptual question

2006-12-08 Thread Noah
I have auto-complete controller: function index() { $criteria = "term LIKE '%{$this->data['Art']['term']}%'"; $options = array( "show" => 100, "order" => "account", "sortBy"=> "account", "ajaxDivUpdat

Group by?

2006-12-08 Thread Erich C. Beyrent
Where do you specify "group by" clauses in your model? Is there a way, or do I need to write a custom query? -Erich- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send e

Re: Set variable in view for access in layout

2006-12-08 Thread Christoph
> Look at Rossoft's Head Helper: > http://rossoft.wordpress.com/2006/03/28/register-head-tags-from-helpers-2/ Excellent! That is exactly what I needed. Thank you very much! thnx, Christoph --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: logging or saving all sql statements in Model

2006-12-08 Thread nate
Queries are actually logged at the db level, and you can get an access to the database object by doing the following: $db =& ConnectionManager::getDataSource('default'); $db->fullDebug needs to be set to true in order to enable query logging. Once that happens, any queries which are executed ag

On the beauty of cakePHP deployment...

2006-12-08 Thread tracyfloyd
Just wanted to drop a note to the group and cakePHP team. I have been reading up on Ruby on Rails and have been really enticed by the "programming pain" it promised to lessen, but I have not had the time or energy to learn Ruby enough to be comfortable using the framework. Along comes cakePHP an

RE: findall custom query

2006-12-08 Thread Mariano Iglesias
Who said it doesn't accept arrays of conditions? http://manual.cakephp.org/chapter/models -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge.

Re: findall custom query

2006-12-08 Thread [EMAIL PROTECTED]
Thanks Adrian, this works: $userid=1; $this->set('notes', $this->Note->findAll("global = 1 OR user_id = $userid")); Cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, s

Re: Ajax sortable list

2006-12-08 Thread Nio
I wrote a tutorial about sortable in Chinese: http://nio.infor96.com/ajax-in-cakephp-sortable/ On 12/8/06, Claudio Poli  <[EMAIL PROTECTED]> wrote: > > > Uncle Bill ha scritto: > > > Does the second post in that link solve the problem? It doesn't seem > > like it. Did you get it working? > > yes,

Re: findall custom query

2006-12-08 Thread [EMAIL PROTECTED]
>Have you created all the belongsTo and hasMany relationships that you > need to link the two tables together? yes, my models look like this: note.php: var $belongsTo = array('User' => array('className' => 'User', 'conditions' => '',

Re: Ajax sortable list

2006-12-08 Thread Claudio Poli 
Uncle Bill ha scritto: > Does the second post in that link solve the problem? It doesn't seem > like it. Did you get it working? yes, works for me. I've workarounded the issue putting a javascript that collects every id, and then send them to the controller that parses them. --~--~-~-

RE: findall custom query

2006-12-08 Thread Adrian Godong
Well, the first param for the findAll is the "SQL condition". CakePHP is not smart enough (yet) to understand arrays of conditions, it just accepts a string and place it after the WHERE clause in the SQL statement. To answer your question, change the array into it's SQL language (i.e. global=1 AN

Re: findall custom query

2006-12-08 Thread [EMAIL PROTECTED]
>Have you created all the belongsTo and hasMany relationships that you > need to link the two tables together? yes, my models look like this: note.php: var $belongsTo = array('User' =>array('className' => 'User', 'conditions' => '',

RE: findall custom query

2006-12-08 Thread Mariano Iglesias
Try this: $this->set('notes', $this->Note->findAll(array ('Notes.public' => 1, 'Users.user_id' => $id ))); -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share y

Re: findall custom query

2006-12-08 Thread [EMAIL PROTECTED]
the MySQL Query would be: SELECT * FROM notes WHERE global = "1" OR user_id = "1" ; How could I do that in cake with findAll? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this grou

Re: findall custom query

2006-12-08 Thread Chris Hartjes
On 12/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > This doesn't work: > $id=1; > $this->set('notes', $this->Note->findAll(array ('global' => 1, > 'user_id' => $id ))); > > How can I tell findAll give the right result? > Have you created all the belongsTo and hasMany relationships that

RE: can I use generateList( ) get rather than Id?

2006-12-08 Thread Adrian Godong
To simplify your code, you can define var $displayField = 'name' in your Model, and have everything generated by the generateList(); <-- no params necessary. You will need to utilize Javascript on your second question. On the first selectTag, add 'onChange' => 'javascript:changeSelect();' on the

findall custom query

2006-12-08 Thread [EMAIL PROTECTED]
Hi there, I have two tables: users: -id -name notes: -id -user_id -public A user can write notes. He can chose, if this note could be seen by the public. Now I want to print out all notes that are flaged as public and are from the user with the id "1". This doesn't work: $id=1; $this->set('n

Re: can I use generateList( ) get rather than Id?

2006-12-08 Thread ERic ZoU
Ok. thanks kind buddy in the irc , jacob and kalileo The first question's solution in already in the API. $this->set('list',$this->Fenlei->generateList(null, null, null, '{n}.Fenlei.name', '{n}.Fenlei.name')); BUT how is the second one ? --~--~-~--~~~---~--~~ Y

RE: Passing data to the view in a nice way?

2006-12-08 Thread Mariano Iglesias
Looks nice. I just prefer to take variables out of strings: link($book['Book']['title'], 'view/' . $book['Book']['id']); ?> -MI --- Remember, smart coders answer ten questions for every question they ask.

Re: Passing data to the view in a nice way?

2006-12-08 Thread Tijs Teulings
I haven't run into a query yet where a simple foreach loop did not suffice; are you doing something similar like this in your views?: link($book['Book']['title'], "view/{$book['Book']['id']}"); ?> where my controller did: set('books', $this->Book->findAll()); That's not too b

can I use generateList( ) get rather than Id?

2006-12-08 Thread ERic ZoU
Hi, everyone, I have such situation. I use generate( ) to get a model's list array like: Array { [0] => yellow [1] => red [2] => black } And then I use selectTag('Fenlei/lanmu_id', $lanmus,'', null, null, false);?> It works fine. It pass the id to the Fenlei/lanmu_id. But now I

RE: Output format of findAll

2006-12-08 Thread Mariano Iglesias
Well yes, that's what you think, but that's not how it works ;) So what is your general issue? Tell away and maybe we can help -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart,

RE: Model not available from app_controller

2006-12-08 Thread Mariano Iglesias
Oh wait I've just realized that we are discussing this issue over a thread that is not related. Please move this topic to a new thread. -MI --- Remember, smart coders answer ten questions for every question they ask. So be

Re: Ajax sortable list

2006-12-08 Thread purepear
Read this: http://groups.google.com/group/cake-php/browse_thread/thread/e921d173b7c41519/898e0eb3133671b7#898e0eb3133671b7 I think it'll help you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. T

Re: Set variable in view for access in layout

2006-12-08 Thread RRose
Look at Rossoft's Head Helper: http://rossoft.wordpress.com/2006/03/28/register-head-tags-from-helpers-2/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-

Re: local configuration file

2006-12-08 Thread [EMAIL PROTECTED]
Now it's working! Here is my code: /myconfig.php: /app/config/bootstrap.php: if (file_exists(ROOT.'/myconfig.php')) { include_once ROOT.'/myconfig.php'; } Now I can use my defines everywhere in the app. For example in the database.php: var $default = array('driver' => 'mysql',

Re: Model not available from app_controller

2006-12-08 Thread Steniskis
Hi, Eventually I found a problem on a table name in one of my models. I think there was two problems with a difficulty to identify the errors. Thanks for your help Sten --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

Re: Output format of findAll

2006-12-08 Thread the_woodsman
Hi everyone, Thanks for your comments. Mariano, I couldn't get the link to work, but from everyone's comments I've found enough info. I still think that if you use alias an aggregate with the same name as a field in the real table, it would make sense for it to come under the Model's array rath

Passing data to the view in a nice way?

2006-12-08 Thread the_woodsman
Hi Bakers, I think there's something I'm not getting about the mechanism for passing data in to the view, because my attempts quickly become very hard to read. I'm frequently passing data from multiple Models and aggregate functions into my views. However, the format returned from Cake's query f

Re: Set variable in view for access in layout

2006-12-08 Thread Christoph
> you can just set it from the controller > vars that you set(), are available in both regular views and layouts Yes, I know you can do that but I'd rather try to get it done via the view. That way, the designers working on the view (who don't necessarily work on the controller) can add referenc

Re: Set variable in view for access in layout

2006-12-08 Thread [EMAIL PROTECTED]
you can just set it from the controller vars that you set(), are available in both regular views and layouts --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to ca

Re: logging or saving all sql statements in Model

2006-12-08 Thread Copongcopong
bump --~--~-~--~~~---~--~~ 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

Set variable in view for access in layout

2006-12-08 Thread Christoph
>From what I understand, the view is parsed and rendered first then the layout. Apart from using the session, is there a way to set a variable such that it will be available in the layout for me to use there? thnx, Christoph --~--~-~--~~~---~--~~ You received t

Re: Model not available from app_controller

2006-12-08 Thread Steniskis
Hi Mariano, Thank you for your help but in fact all works except one page and to be precise the error displayed is about this line in the head helper $this->_register(array($file,'css',$htmlAttributes)); This error masks something else... Sten --~--~-~--~~~---~--~---

Re: local configuration file

2006-12-08 Thread [EMAIL PROTECTED]
> But this doesn't work. All I get is a blank page. This blank page was in debug level 0. With debug level 3 I get the message: Parse error: parse error in /app/config/database.php on line 60 Missing Database Connection: ConnectionManager requires a database connection Seems like the vars ar

Re: local configuration file

2006-12-08 Thread [EMAIL PROTECTED]
> But this doesn't work. All I get is a blank page. This blank page was in debug level 0. With debug level 3 I get the message: Parse error: parse error in /bild/adjust/asw/kora/app/config/database.php on line 60 Missing Database Connection: ConnectionManager requires a database connection Seems

Re: local configuration file

2006-12-08 Thread [EMAIL PROTECTED]
Hi, thanks for the hint! > if (file_exists(ROOT . 'myconfig.php')) { > include_once ROOT . 'myconfig.php'; The only problem I have right now is, that I want to all the database settings in my own config file. And the database.php in /app/config uses the vars in my config file. I would like to

RE: Model not available from app_controller

2006-12-08 Thread Mariano Iglesias
Is CSS a helper you built? If so, aren't you missing the $ ? If you are trying to link to a CSS file in your then do: css('css_file'); ?> Where css_file is a reference to WEBROOT/css/css_file.css -MI --- Remember, smar

Re: local configuration file

2006-12-08 Thread themanfrombucharest
Hi Felix, Take a look at app/config/bootstrap.php. This is the application specific bootstrap that gets called after cake's own bootstrap (it's all in the comments) so you can use it to include everything you need. You'll probably do something like: if (file_exists(ROOT . 'myconfig.php')) { in

Re: Model not available from app_controller

2006-12-08 Thread Steniskis
Hello Thank you AD7six for your insight, happy for you Langdon. I did what you suggest AD7six, it was fine for my app_controller but now I have this message "Call to a member function on a non-object in /var/www/html/SID/app/views/layouts/default.thtml" It is a problem with the head helper. So I p