Re: Ordenação do Paginator do Cake1.2
Na verdade não era isso que estava procurando, Eu queria algo que me falasse qual é a direção e chave corrente da paginação... para poder dar aquela informação ao meu usuário de que a página esta ordenada pelo campo Nome e Descendente. Achei o seguinte métodos PaginatorHelper::sortDir e PaginatorHelper::sortKey http://api.cakephp.org/1.2/class_paginator_helper.html#ec465140578493ae1bffa8bdce2109e1 Acho que era isso que precisava. Mas valeu pela intenção. Abraços 2008/1/17 rafael bozzetti [EMAIL PROTECTED]: Boa tarde João, Estava com a mesma dúvida e consegui ordenar de forma crescente e descente.. No meu controller tenho a função index... ai embaixo.. marcado com *** function index() { $this-Blog-recursive = 0; $this-paginate = array('limit' = 10); *** $this-paginate['order'] = array('Blog.id' = 'DESC'); $this-set('blogs', $this-paginate()); } Abraço, 2008/1/17 Joao Jose Pedrini [EMAIL PROTECTED]: Pessoal, Estou com uma dúvida com a paginação do Cake 1.2. Estou querendo colocar uma sinalização se é descendente ou ascendente e qual é a atual ordenação que a página esta exibindo. Dei uma olhada na estrutura do sort() porém não consegui uma resposta. Alguém já precisou desta funcionalidade e/ou consegue me passar uma solução? Abraços! -- Joao Jose Pedrini [EMAIL PROTECTED] Consultor - COP-JR http://blog.copjr.info/ -- Rafael Pereira Bozzetti [EMAIL PROTECTED] http://www.bozzetti.org -- Joao Jose Pedrini [EMAIL PROTECTED] Consultor - COP-JR http://blog.copjr.info/ --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: Quando ER não resolve na validação
Seria algo como isso? http://tempdocs.cakephp.org/#TOC133258 2008/1/17 DJ Spark [EMAIL PROTECTED]: provavelmente, além das regras 'prontas' , voce motnaria suas proprias regras... usando $this-Modelo-validate(); A API lista um método 'userdefined()' onde um dos argumentos é uma função que fará a validação especial... http://api.cakephp.org/1.2/class_validation.html Alguém já usou isso ? tem algum exemplo ? Spark 2008/1/17 Rodrigo Maia [EMAIL PROTECTED]: Olá pessoal, como seria se não desse para fazer uma validação usando expressão regular? Por exemplo, tornar um campo obrigatório caso um outro campo for selecionado. Ou quando um campo for maior que 200 caracteres. Ou se a data preenchida no form for maior que a data atual dar erro E assim vai. Como ficaria? -- [livesets] http://djspark.com.br/ [web] http://sydi.net [filmes] http://melhoresfilmes.com.br -- Joao Jose Pedrini [EMAIL PROTECTED] Consultor - COP-JR http://blog.copjr.info/ --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: Irregularidade da palavra Conta
Com a tabela Categoria tbm ocorre o mesmo erro. Mas já sabia que era algo com o inflections.php, não testei a solução do Bill mas acho que funciona. Com o Ruby on Rails acontece a mesma coisa, tanto que um grupo brasileiro lançaram um patch (ou plugin, não sei) para ajustar todas as diferenças para o público brasileiro ( http://blog.improveit.com.br/articles/tag/brazilianrails). Além do plural existe outras funcionalidades, como numeração, valores monetários, traduções, etc. 2008/1/18 Bill [EMAIL PROTECTED]: Tive a mesma dificuldade, com uma tabela Ocorrencias, que virou ocorrencium. Pra resolver, eu gerei via bake de maneira errada mesmo, como se a tabela fosse ocorrencium, depois disto, alterei o inflections.php da seguinte maneira: $pluralRules = array('/(.*)ia$/i' = '\1ias', '/(.*)a$/i' = '\1as' ); $singularRules = array('/(.*)ias$/i' = '\1ia', '/(.*)as$/i' = '\1a' ); e alterei os respectivos arquivos gerados de model e controller. Veja se resolve algo. Abs Bill www.cakephp.com.br por essas e outras que eu já crio tudo em inglês mesmo e se precisar, manipulo as urls no Routes... infelizmente eu não sei o que pode ser =( 2008/1/18 Marcus Reis : Saudações padeiros! Estou com problemas no bake, quando crio o model Lancamento que por sua vez pertence ao model Conta, aparece para mim desta forma: Bake Model Path: /var/www/app/models/ --- Possible Models based on your current database: 1. Conta 2. Departamento Enter a number from the list above, or type in the name of another model. One moment while the associations are detected. -- - Please confirm the following associations: --- Lancamento belongsTo Departamento? (y/n) [y] y Lancamento belongsTo Contum? (y/n) [y] Veja que ele ao invés de me perguntar: Lancamento belongsTo Conta? Ele escreve: Lancamento belongsTo Contum? ja tentei usar o inflections.php para consertar mas nao gera efeito algum, parece um bug ou palavra reservada. para reproduzir este erro crie um model com o nome Conta (tabela contas) e tente associa-lo a algum filho (no meu caso lancamentos belongs to contas). Note que na listagem inicial dos models disponiveis ele escreve Conta corretamente, mas na hora de perguntar sobre as associações que ele escreve errado (Contum). Estou usando a versao 1.2 beta nova do site cakephp.org (a alpha anterior tb ocorre este erro) Agradeço a atenção! -- Joao Jose Pedrini [EMAIL PROTECTED] Consultor - COP-JR http://blog.copjr.info/ --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: Basic Question: Refining Queries
Here's what I eventually did: $userArray = $this-User-find('User.id='.$this-User-id, null, null, 1); $this-set('data', $userArray); foreach($userArray['Friends'] as $friend) { $friendIds[] = $friend['id']; $friendConditions = array('Profile.user_id' = $friendIds); $this-set('friends', $this-User-Profile- findall($friendConditions)); } This gave me two arrays that I could use to match the friends' profiles to the users. It's a bit roundabout but it worked. Chris On Jan 20, 12:13 am, Chris Wade [EMAIL PROTECTED] wrote: A little more information. I've tried the following: $this-set('friends', $this-User-Friends-findall('user1_id='.$this-User-id)); SQL Error: 1054: Unknown column 'user1_id' in 'where clause' $this-set('friends', $this-User-Friends-findall('Friends.user1_id='.$this-User-id)); SQL Error: 1109: Unknown table 'Friends' in where clause $this-set('friends', $this-User-Friends-findall('users_users.user1_id='.$this-User-id)); SQL Error: 1109: Unknown table 'users_users' in where clause (the table does exist) There is no 'Friends' model - it's just the User model attached to itself through a HABTM relationship (described in my last post). The 'models' chapter of the manual only describes how to query this sort of relationship using recursion. I'm trying to get it to find the user's friends directly, but I can't figure out how to get it to understand that it needs to look in the join table for the relationship. Am I missing something obvious? Do I need to clarify what I'm trying to do? Thanks again, Chris On Jan 19, 1:34 pm, Chris Wade [EMAIL PROTECTED] wrote: Ah, Chaining was the word I was looking for, but I was thinking that it would give you only the records from the chained models that were related to the model of the controller you were in. Thanks for the info. So, to do something like what I want to do, I would have to say $this-User-Friends-findall([set conditions to find the friends related to the user]). The 'Friends' relationship is a HABTM relating one user directly to another through a table called users_users, which has the fields 'user1_id' and 'user2_id'. In the user model: var $hasAndBelongsToMany = array('Friends' = array('className' = 'User', 'joinTable' = 'users_users', 'foreignKey'= 'user1_id', 'associationForeignKey' = 'user2_id', 'conditions'= '', 'order' = 'created DESC', 'limit' = '5', 'unique'= true, 'finderQuery' = '', 'deleteQuery' = '' ) var $hasOne = array('Profile' = array('className' = 'Profile', 'conditions' = '', 'order' = '', 'dependent' = true, 'foreignKey' = 'user_id' ), Avatars for each user are contained in the user's profile. Given this relationship, how would you go about writing a query that would grab the avatars from the profiles for each of the current user's friends, without picking up all of the other relationships (there are several not mentioned here)? Thanks for the help. Chris On Jan 19, 9:32 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote: Chaining isn't bad, but it only gives you a reference for the model, it doesn't set any conditions. You have to pass them manually to the findAll(). You can unbind() the models you don't want to get on the findAll and set the recursion level that fits your needs. Also it is possible to set conditions dinamically on the associations through Model::bindModel(); Also if you are using CakePHP 1.2 you can use the bindable behavior (thanks Mariano) to control your associations. HTH, - Dardo Sordi. On Jan 18, 2008 10:54 PM, the_woodsman [EMAIL PROTECTED] wrote: Hi, I'm not sure I fully understand your problem, but: I'd like to figure out how to do something like: $this-set('friends', $this-User-Friends-Profiles-findAll()); This returns every profile in the system, not just those for the user's friends. Your controller isn't tied to usingjust one Model, the $uses array of the Controller can specify all the models you want: var $uses=array('Profiles','User'); then you can start all yourqueriesfrom these models, no need to
Re: dAuth v0.3 [Session losing 'salt' variable]
Well, something is removing items from ( or maybe totally wiping ) your session, and i don't think it's dAuth ;-) did grep -i session on your project yield anything? But at least you have an environment where it works. try comparing php.ini's, apache.conf's , looking up bugs for cake and php ( session bugs will probably be also in this group), downgrading the php of the new environment etc ... good luck! Dieter On Jan 19, 5:33 pm, volve [EMAIL PROTECTED] wrote: Thank you very much for getting back to me Dieter! The salt is definitely in there before attemptLogin is called as I can stick a print_r in Users/login action and I see the salt at the top of the page when I load the login form. (But the print_r inside attemptLogin shows it as missing when submitting the login form.) I spent some time last night setting-up a second development environment with PHP5 and... the problem hasn't reappeared... I know this doesn't really make sense, but I wanted to share anyway. Maybe there's some quirky CakePHP Session handling bug that isn't present in PHP5 ? All I did was copy over my previous app directory into this new environment and changed database logins. I'm still baffled, but at least it's progress (I think). :) Thanks again, -volve On Jan 19, 6:38 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I basically did a fresh install of the v0.3 files from bakery.cakephp.org and wanted to get them all working as-is before customizing (to make sure there was nothing in my project interfering, I grep'd the entire source tree for references to 'salt' and only found the new dAuth ones). Well, this is weird indeed. I also used the powers of grep on the dauth sources and found out that at only 1 place the salt is written into the session, which is in the function newSalt() of the component. By grepping on Session i could not find a place where the salt might be removed or the session cleared or anything like that. I suggest you also grep on Session in your entire project to find out if something else might be interfering. ( use grep -i to be sure you dont miss anything) Also make sure that the salt is put in the session before trying to read it out ( eg you're not going directly to the attemptLogin logic before opening the login page. and make sure you have a salt there first) --~--~-~--~~~---~--~~ 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: Dynamic form creation?
On Jan 20, 9:13 am, Baz [EMAIL PROTECTED] wrote: I guess I'm misunderstanding also, but what was the problem with $form-inputs()? If your using that database, that means model. $form-inputs() dumps inputs for all the form fields. The situation is more of like allowing the users to create models; the users define fields, rules/validations, labels, etc -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ 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: How to test that adatabase table exists ?
Hello nobody to give a suggestion ? On Jan 18, 9:39 pm, foxmask [EMAIL PROTECTED] wrote: Good evening, I would like to test if my database table exists or not If no, i will display a message to suggest to install the software If yes, i will Route::connect() to the main page of the software. I digged on the Model::Schema() but i dunno how to use it nor if it's the well way to do the trick. kind regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Auth 1.2 infinite redirect...
Could somebody clue me into why I'm encountering an infinite redirection loop? I'm using the latest Beta 1.2 series. My browser allows cookies. I am following what appears to be a pretty-good tutorial---and have made my users/groups table comply.[1] The only way to keep it from looping is to allow '*', which defeats the purpose. [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Bug in cake beta 1.2 model
@Chris I tried reporting to trac, but I got a 403 forbidden error when I tried to create a new ticket (at https://trac.cakephp.org/newticket). I realize now that I need to be registered (I just scanned the page and looked for the report a bug button and clicked), and I will report bugs through the proper channels in the future, because I totally get where you are coming from. :-) Nina On Jan 17, 10:01 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Jan 16, 2008 10:56 AM, Nina [EMAIL PROTECTED] wrote: Hi All I found (and fixed) a bug in the model.php file, and I can't report it in the trac system, so I thought I'd report it here in case someone sees it and can fix it. Nina, Is that can't or won't report the bug? It takes no more than 5 minutes to sign up for an account on trac in order to report a bug. I tell you this because I can say with great certainty that patches posted on the mailing list are extremely unlikely to be noticed. It's great that you might have found a bug, but PLEASE take the time to report it properly through trac. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard:http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
CakePHP Setup, Need Help Please
Hi Folks, Brand spankin' new to PHP CakePHP. Coming over from ASP.NET to explore. I'm following the Blog tutorial from the Cake site and here's what happens: 1.) Move it to the webroot. 2.) Checkout localhost and I can see the initial page (with CSS!) 3.) Change my db configuration to connect correctly. 4.) Refresh localhost and the initial page no longer has CSS applied!! This sounds like a mod_rewrite issue (I guess?). I went through the steps of enabling it (or so I think). But the tutorials I've read say that if you see CSS it means it's enabled. So I have no clue why connecting to the db would disable this. Help? --~--~-~--~~~---~--~~ 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: Simple Bog tutorial Sorting question
$this-set('posts', $this-Post-findAll(null,null,'id DESC')); that worked beautifully, thanks! where might i have found this topic in the documentation? i spent quite a bit of time searching before i posted here .. .but i guess i was likely searching for the vocabulary ... i mostly looked for sorting ?? thanks again! J --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Displaying error messages fro validation in element
Hi all bakers The problem is : I have 2 columns site layout where a mailing list subscription block can be seen on all the pages. So I put it into en element. Basically, this is just a form with text input and subscribe button, so I have built a mailinglist model and a mailinglist controller with an add function, called on subscribing the form. Of course, model does a validation of the mail entered. If everything goes right, I just do a redirect to the main page. BUT if a validation problems occurs, controller calls by default a add view. I do not want this ! I just want to stay on the same page (like home, products or contact) where the user typed his email in the mailing list subscriber form and I want to display the validation error message inside the mailing list element. Sounds like I have to re-render the current view (I mean HOME, PRODUCTS or CONTACT view) with an updated mailing list element block telling hey buddy, your email is wrong ! I struggle with that since 2 days. Any idea ? Regards to all ! --~--~-~--~~~---~--~~ 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: Auth in 1.2
Change back to where you had a blank screen and look in the error log for any FATAL errors. --~--~-~--~~~---~--~~ 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: Simple Bog tutorial Sorting question
... but i guess i was likely searching for the WRONG vocabulary ... --~--~-~--~~~---~--~~ 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: CakePHP Setup, Need Help Please
Ok, disregard my last message. All set! On Jan 19, 10:45 pm, longint [EMAIL PROTECTED] wrote: Hi Folks, Brand spankin' new to PHP CakePHP. Coming over from ASP.NET to explore. I'm following the Blog tutorial from the Cake site and here's what happens: 1.) Move it to the webroot. 2.) Checkout localhost and I can see the initial page (with CSS!) 3.) Change my db configuration to connect correctly. 4.) Refresh localhost and the initial page no longer has CSS applied!! This sounds like a mod_rewrite issue (I guess?). I went through the steps of enabling it (or so I think). But the tutorials I've read say that if you see CSS it means it's enabled. So I have no clue why connecting to the db would disable this. Help? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Parsing error
I have the following php script: I am trying to populate my php string as below: Code: $query_db_95 = INSERT INTO `node_revisions` (`nid`, `vid`, `uid`, `title`, `body`, `teaser`, `log`, `timestamp`, `format`) VALUES (451, 451, 1, 'Import model images', '?php\r\n\r\n// Written by Victor Kane it''s set to true,\r\n// and you get double imports.\r\n$active = false;\r\n$process_folder = ''import'';\r\n\r\include_once 'includes/ bootstrap.inc;?', ' ', ' ', ' ', ' '); $active and $process_folder are php variables. They are brown colored. I am not getting the green color for these two variables. It is giving me the parsing error. What can be wrong? Please Help. I am stuck here. Thanks in advance --~--~-~--~~~---~--~~ 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: Parsing error
On Jan 20, 2008 5:23 AM, mrp [EMAIL PROTECTED] wrote: I have the following php script: I am trying to populate my php string as below: Code: $query_db_95 = INSERT INTO `node_revisions` (`nid`, `vid`, `uid`, `title`, `body`, `teaser`, `log`, `timestamp`, `format`) VALUES (451, 451, 1, 'Import model images', '?php\r\n\r\n// Written by Victor Kane it''s set to true,\r\n// and you get double imports.\r\n$active = false;\r\n$process_folder = ''import'';\r\n\r\include_once 'includes/ bootstrap.inc;?', ' ', ' ', ' ', ' '); You might want to consider using heredoc syntax for that body part to avoid having to add all those returns/newlines. Then just append it into your SQL string. You have doubled-up single quotes around the word import. That would be fine if the desired result was to have a single set of single quotes around the word *and* this was an SQL script. However, what you'll end up with is probably not going to work well for you. Change that part to: ... false;\r\n$process_folder = 'import';\r\n\r\include_once ... $active and $process_folder are php variables. You mean that they are variables in the same context as $query_db_95? That is, there is a variable named $process_folder set before creating this SQL string? $process_folder = 'foo'; $query_db_95 = INSERT INTO ... // results in: ... r\nfoo = ''import''; ... In which case, you'll notice that you're missing a dollar sign. You'll need to add one (escaped): ... false;\r\n\$${process_folder} = 'import';\r\n\r\include_once ... They are brown colored. I am not getting the green color for these two variables. You're talking about your syntax highlighting? That's often a pretty user-specific thing. I'm sure your browns greens are not the same as mine ;-) It is giving me the parsing error. What can be wrong? Please Help. I am stuck here. $query_db_95 = ...; debug($query_db_95); --~--~-~--~~~---~--~~ 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: Parsing error
On Jan 20, 2008 12:10 PM, b logica [EMAIL PROTECTED] wrote: On Jan 20, 2008 5:23 AM, mrp [EMAIL PROTECTED] wrote: It is giving me the parsing error. What can be wrong? Please Help. I am stuck here. $query_db_95 = ...; debug($query_db_95); Whoops! It's early. That won't help until you get past the parse error, of course. I'm sure the problem lies with your quotes. --~--~-~--~~~---~--~~ 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: Dynamic form creation?
On Jan 20, 8:10 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: snip I decomposed each form element in form element linked to a model and a controller (for example, all forms have a similar client_identification part that is linked to the client controller and model). Another example is a donation_info form element that is linked to the donation model and controller. So it's a not a fully customizable dynamic form creator, the form must be assembled out of pre defined elements and they can also add some custom fields. snip Many thanks for sharing your ideas. Before starting this thread, I had 2 ideas: 1. Create model files and DB tables dynamically 2. Keep the form configurations in a DB table and handle them I felt that both of the approaches are inefficient/unintelligent and so posted this question. After googling a lot, I just seem to get some solutions/works in Django (still not sure) and I'm yet to look at those closely to see if they're efficient. Thanks again for sharing the ideas. -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog:http://rajeshanbiah.blogspot.com/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cake 1.1.19: Ability to turn debug info off during ajax - Is it broken?
I use the following code to turn off debug info during ajax calls. if ($this-RequestHandler-isAjax()) { $db = ConnectionManager::getDataSource('default'); $db-fullDebug = false; $this-RequestHandler-setAjax($this); } It worked flawlessly up to and including cake 1.1.18, but in cake 1.1.19 it no longer works and there is debug info all over the screen:. Anyone else experiencing this? --~--~-~--~~~---~--~~ 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: 404 Not found on existing controller and action
I think you may have your DEBUG var (/app/config/core.php) set to 0 (production mode), which means that your cache isn't refreshed when you create new pages etc. So you should modify it to 1 or higher (development). Good luck! On 6 jan, 16:09, Robby Anderson [EMAIL PROTECTED] wrote: I've put clearing the cache on the top of my list of things to do before I go into oh crap mode. :) Seems to solve all kinds of problems. I keep meaning to create a small script to do it and then call the script from my server start script, among other places. --~--~-~--~~~---~--~~ 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: Auth in 1.2
On Jan 20, 2008 11:43 AM, b logica [EMAIL PROTECTED] wrote: Change back to where you had a blank screen and look in the error log for any FATAL errors. I think I found the problem. I created a site-wide menu element that is in the default. It calls the action below. Because the action is not in the 'allow' list, calls to it result in the loop. $menus = $this-requestAction('menus/getMenus/header'); -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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: Auth 1.2 infinite redirect...
On Jan 20, 2008 9:11 AM, Ben Wilson [EMAIL PROTECTED] wrote: Could somebody clue me into why I'm encountering an infinite redirection loop? I'm using the latest Beta 1.2 series. My browser allows cookies. I am following what appears to be a pretty-good tutorial---and have made my users/groups table comply.[1] The only way to keep it from looping is to allow '*', which defeats the purpose. [1]: http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/ I think I've found the problem. I was using an element to create a site-wide menu. In that element, a call was made to an action that was not on the allow list. However, since it occurs on every page, including /users/login, any attempt to call it resulted in a redirect to /users/login. This resulted in the infinite loop. The culprit code follows: $menus = $this-requestAction('menus/getMenus/header'); The solution was to add the action getMenus to the allow. This corrected the problem. The solution code follows: $this-Auth-allow('getMenus'); -- Ben Wilson Words are the only thing which will last forever Churchill --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Going to CakeFest and need a roomie?
Want a chance to hurl insults at me as payback for my postings on the mailing list? I'll be speaking at CakeFest on how to get the most out of using the Cake console to speed up development time, and are looking for a roomie to help keep hotel costs down. I'm flying in on Tuesday night and leaving Friday morning. If you're going to Orlando and need a roomie, let me know. Make sure you enjoy late nights, as I'm sure there will be some of those. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ 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: cake 1.1.19: Ability to turn debug info off during ajax - Is it broken?
I had the SQL being dumped even in my ajax calls. Not sure if this is what you are looking for but I use the following to disable that. Configure::write('debug', '0'); Peter Lombardo On Jan 20, 12:58 pm, keymaster [EMAIL PROTECTED] wrote: I use the following code to turn off debug info during ajax calls. if ($this-RequestHandler-isAjax()) { $db = ConnectionManager::getDataSource('default'); $db-fullDebug = false; $this-RequestHandler-setAjax($this); } It worked flawlessly up to and including cake 1.1.18, but in cake 1.1.19 it no longer works and there is debug info all over the screen:. Anyone else experiencing this? --~--~-~--~~~---~--~~ 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 my returned value from model function
i am trying to show a returned value from a model function. function shoWonum() { $ret = $this-query(SELECT wonum FROM invoices WHERE id = 3); $wonum = $ret[0]['wonum']; return $wonum; } (this SQL stement returns '1' as the returned value - btw) in my controller i access the function by: $this-set('baseWonum', $this-Invoice-shoWonum()); in my view i have the value: $baseWonum - but it is always empty I am very new to the frame work and am sure i am making a basic mistake any help would be greatly appreciated - thank you all --~--~-~--~~~---~--~~ 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: Simple binding question.
If A deal has many tickets, and belongs to one item., then why you bind: $this-Ticket-bindModel(array('belongsTo' = array('Deal' =array('foreignKey' = 'deal_id'; $this-Ticket-bindModel(array('belongsTo' = array('Item' =array('foreignKey' = 'deal_id'; Ticket belongsTo Deal, Ticket belongsTo Item ? On Jan 19, 2008 6:43 PM, phpjoy [EMAIL PROTECTED] wrote: No, there isn't such a key Ticket.item_id Warning (512): SQL Error: 1054: Unknown column 'Ticket.item_id' in 'on clause' [CORE\cake\libs\model\datasources\dbo_source.php, line 440] There's Deal.item_id Basically a ticket belongs to a deal. A deal has many tickets, and belongs to one item. It should be: Ticket-Deal-Item I need to get Item.title for every ticket that I have. So my custom SQL query is correct, but I wonder how I could use binds to do that. That's the custom query I came up with: SELECT `Ticket`.`id`, `Deal`.`file`, `Item`.`title` FROM `tickets` AS `Ticket` LEFT JOIN `deals` AS `Deal` ON (`Ticket`.`deal_id` = `Deal`.`id`) LEFT JOIN `items` AS `Item` ON (`Deal`.`item_id` = `Item`.`id`) WHERE `Ticket`.`user_id` = 1 When I left join 'items' to deal.item_id, it works. On Jan 19, 6:40 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote: You are putting: $this-Ticket-bindModel(array('belongsTo' = array('Item' = array('foreignKey' = 'deal_id'; instead of : $this-Ticket-bindModel(array('belongsTo' = array('Item' = array('foreignKey' = 'item_id'; it's a copy and paste error. HTH, - Dardo Sordi. On Jan 18, 2008 9:39 PM, phpjoy [EMAIL PROTECTED] wrote: I wonder how I could make a simple query to work through bind(), and not use a custom query. I'm binding two models for a model: $this-Ticket-bindModel(array('belongsTo' = array('Deal' = array('foreignKey' = 'deal_id'; $this-Ticket-bindModel(array('belongsTo' = array('Item' = array('foreignKey' = 'deal_id'; The resulting query I get is this: SELECT `Ticket`.`id`, `Deal`.`file`, `Item`.`title` FROM `tickets` AS `Ticket` LEFT JOIN `deals` AS `Deal` ON (`Ticket`.`deal_id` = `Deal`.`id`) LEFT JOIN `items` AS `Item` ON (`Ticket`.`deal_id` = `Item`.`id`) WHERE `Ticket`.`user_id` = 1 Now, instead of: `Item` ON (`Ticket`.`deal_id` = `Item`.`id`) I need: `Item` ON (`Deal`.`item_id` = `Item`.`id`) Which gives this query: SELECT `Ticket`.`id`, `Deal`.`file`, `Item`.`title` FROM `tickets` AS `Ticket` LEFT JOIN `deals` AS `Deal` ON (`Ticket`.`deal_id` = `Deal`.`id`) LEFT JOIN `items` AS `Item` ON (`Deal`.`item_id` = `Item`.`id`) WHERE `Ticket`.`user_id` = 1 I tried binding item to deal, and CakePHP made 200 queries instead. That didn't work too well. Any ideas how I could make a slim query with CakePHP, without using query()? --~--~-~--~~~---~--~~ 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: Caching
Try setting, debug level to 0. On Jan 20, 2008 7:29 PM, Gary Taylor [EMAIL PROTECTED] wrote: I am relatively new to cakephp but actively involved in 2 reasonably sized projects. In one project, I really need the caching to work to improve performance. However, I am having no luck whatsoever. I have enabled the cache in the config/core.php by uncommenting the 'Configure::write('Cache.check', true);'. I have also added the following to my controller :- 'var $cacheAction=array('Images/view/'='21600');' After initially trying: 'var $cacheAction=array('view/'='21600');' But, nothing is appearing in my cache folder. I have verified that php can write to the folder and it can - no problems at all. In my development environment, I run apache very insecurely (as my user !) so that I do not have any permission problems. I ran it through the debugger and I can see that the view's _render method optionally requires a '$cached' parameter which is not passed by the 'render' method, therefore it is defaulting to false, which I believe prevents the cache from being written. I would really appreciate any help that you can offer on this one. Many Thanks Gary --~--~-~--~~~---~--~~ 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: Accessing my returned value from model function
On Jan 20, 2008 3:07 PM, dmc [EMAIL PROTECTED] wrote: i am trying to show a returned value from a model function. function shoWonum() { $ret = $this-query(SELECT wonum FROM invoices WHERE id = 3); $wonum = $ret[0]['wonum']; return $wonum; } (this SQL stement returns '1' as the returned value - btw) in my controller i access the function by: $this-set('baseWonum', $this-Invoice-shoWonum()); in my view i have the value: $baseWonum - but it is always empty I am very new to the frame work and am sure i am making a basic mistake any help would be greatly appreciated - thank you all Try debug($ret); in your model method before the return. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Caching
I am relatively new to cakephp but actively involved in 2 reasonably sized projects. In one project, I really need the caching to work to improve performance. However, I am having no luck whatsoever. I have enabled the cache in the config/core.php by uncommenting the 'Configure::write('Cache.check', true);'. I have also added the following to my controller :- 'var $cacheAction=array('Images/view/'='21600');' After initially trying: 'var $cacheAction=array('view/'='21600');' But, nothing is appearing in my cache folder. I have verified that php can write to the folder and it can - no problems at all. In my development environment, I run apache very insecurely (as my user !) so that I do not have any permission problems. I ran it through the debugger and I can see that the view's _render method optionally requires a '$cached' parameter which is not passed by the 'render' method, therefore it is defaulting to false, which I believe prevents the cache from being written. I would really appreciate any help that you can offer on this one. Many Thanks Gary --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Simple GROUP BY ?
Hi, I'm siting here for about 2 hours and get it not work. I need a simple group by in an association. This is in my controller: $this-Hotel-bindModel( array('hasMany' = array( 'HotelDescriptionTranslation' = array( 'className' = 'HotelDescriptionTranslation', 'foreignKey' = 'hotel_id', 'conditions' = $cond1 ), 'HotelDescriptionPhoto' = array( 'className' = 'HotelDescriptionPhoto', 'foreignKey' = 'hotel_id', 'conditions' = $cond2 ) ) ), FALSE ); $hotel = $this-Hotel-findByHotelId($hotel_id); Results in this query: SELECT `HotelDescriptionPhoto`.`id`, `HotelDescriptionPhoto`.`descriptiontype_id`, `HotelDescriptionPhoto`.`hotel_id`, `HotelDescriptionPhoto`.`photo_id`, `HotelDescriptionPhoto`.`url_max300`, `HotelDescriptionPhoto`.`url_original`, `HotelDescriptionPhoto`.`url_square60`, `HotelDescriptionPhoto`.`created`, `HotelDescriptionPhoto`.`modified` FROM `hotel_description_photos` AS `HotelDescriptionPhoto` WHERE (descriptiontype_id = '5' OR descriptiontype_id = '10') AND `HotelDescriptionPhoto`.`hotel_id` IN (60160) But I need a GROUP BY `HotelDescriptionPhoto`.`photo_id` inside the query... Is there an easy(?!) way to achieve this? (I would not want to create a custom query)... Regards, Alexander --~--~-~--~~~---~--~~ 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 find any services through AMF plugin
Well, I've never used the service browser, but the AMF plugin works fine from Flex. Perhaps get on #cake-amf and check that the service browser is supported - perhaps it uses something that is AMFPHP specific? On Jan 21, 1:57 am, kiang [EMAIL PROTECTED] wrote: Environments: PHP Version 5.2.4 (Windows, XAMPP) AMF Native Support enabled Compiled Version0.9 CakePHP 1.2.0.6311 beta AMF plugin fromhttps://svn.cakefoundation.org/amf/branches/amf I used service browser in amfphp and pointed to my app url after setting up AMF plugin following the wiki. Then I got the following message: (mx.rpc::Fault)#0 errorID = 0 faultCode = Client.Error.MessageSend faultDetail = Channel.Connect.Failed error NetConnection.Call.BadVersion: faultString = Send failed message = faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: ' name = Error rootCause = (Object)#1 code = NetConnection.Call.BadVersion description = details = level = error --- kiang --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help getting started...
Hi everyone, I have Apache installed on my machine ( WinXP Pro SP2 ) have a number of other php based projects running fine. The test page works, but clearly the .css file is not being found. I have tested a phpinfo.php file in the root directory and the /app/ views/users/ directory for a tutorial I am working on, and it works fine in both locations. I made a cosmetic change to cake.generic.css, but the change is not being picked up ! css is attempting to find it here: link rel=stylesheet type=text/css href=/css/cake.generic.css / My default htdocs folder is: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and my folder within this is 'cake11'. Hope someone can help. regards, Dave Porter --~--~-~--~~~---~--~~ 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: Help getting started...
http://groups.google.com/group/cake-php/browse_thread/thread/d7c7d2bd6635a76f/e976e8d9cb6153d3?lnk=gstq=manish#e976e8d9cb6153d3 On Jan 21, 6:23 am, Dave Porter [EMAIL PROTECTED] wrote: Hi everyone, I have Apache installed on my machine ( WinXP Pro SP2 ) have a number of other php based projects running fine. The test page works, but clearly the .css file is not being found. I have tested a phpinfo.php file in the root directory and the /app/ views/users/ directory for a tutorial I am working on, and it works fine in both locations. I made a cosmetic change to cake.generic.css, but the change is not being picked up ! css is attempting to find it here: link rel=stylesheet type=text/css href=/css/cake.generic.css / My default htdocs folder is: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and my folder within this is 'cake11'. Hope someone can help. regards, Dave Porter --~--~-~--~~~---~--~~ 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: Help getting started...
Take a look at Section 5 here: http://manual.cakephp.org/appendix/blog_tutorial I had the same issue and the above fixed it. And when I revisited the issue, it turned out for some reason I was missing an .htaccess in the root directory. Peter Lombardo On Jan 20, 2008 8:23 PM, Dave Porter [EMAIL PROTECTED] wrote: Hi everyone, I have Apache installed on my machine ( WinXP Pro SP2 ) have a number of other php based projects running fine. The test page works, but clearly the .css file is not being found. I have tested a phpinfo.php file in the root directory and the /app/ views/users/ directory for a tutorial I am working on, and it works fine in both locations. I made a cosmetic change to cake.generic.css, but the change is not being picked up ! css is attempting to find it here: link rel=stylesheet type=text/css href=/css/cake.generic.css / My default htdocs folder is: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs and my folder within this is 'cake11'. Hope someone can help. regards, Dave Porter -- Peter Lombardo [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Updating Sortable Lists
I have multiple sortable unordered lists that are generated from entries in a database. I'm currently using $ajax-sortable to make all of these ajax sortable, but I'd like to have the lists update database entries when things are moved from one list to another. So I don't want to use serialize, since I don't really care what order the items are in -- I just want to know the id of the list that it's in. Is there a way to identify the parent list of the item that was just dragged using javascript? Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
database.php: $test?
What are good practices for configuring a test database, as defined in database.php.default's second array? I know that it is unnecessary, but is it advised to have a test db? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---