Problems after moving to another server and PHP version - Fatal Error Error: include(): Cannot redeclare class debugger
Hello. Recently the application I've created with CakePHP 2.3.0, and which was settled on a server with PHP 5.3.3-7, has been moved to new environment, based on PHP 5.4.34-1 version. On the new environment a fatal error occurs: Error: include(): Cannot redeclare class debugger File: /home/html/directory/lib/Cake/Core/App.php Line: 560 What can be the cause of such error? I would be very appriciated for help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Problem with tree data - find('threaded') displays all, but getting threaded data from node (or using children() function) does not return all records
Hello. I have a Comment model, which uses the Tree Behavior. Comments are related to Post model, with the use of post_id field in comments table. The problem is, as described in topic - when I use the find('threaded') function like this: $comments=$this-Comment-find('threaded', array( 'conditions' = array('post_id'=$p['Post']['id']), 'fields' = array('Comment.id', 'parent_id', 'nick', 'comment', 'created'), 'order' = array('created'='asc') )); everything works fine - all comments are existing in $comments array, as tree data. The problem occurs when I want to get comments only from given parent_id node (so when I want to get subtree of comments). I have to use this method (getting subtree of comments from parent comments), because I want my comments to be paginated. To paginate comments I first paginate comments with parent_id=NULL, and then for each parent comment I get a threaded list of child comments: So the simplified code looks like this: - first - get the parent comments: $this-paginate=array( 'conditions'=array('parent_id'=NULL,'post_id'=$p['Post']['id']), 'fields'=array('Comment.id','parent_id','lft','rght','nick','comment','created'), 'limit'=$this-comments_num, 'order'=array('Comment.created'='asc'), 'page'=$page_num, ); $comments=$this-paginate('Comment'); - second - get threaded child comments for each parent comment: if($comments) { foreach($comments as $key=$value) { $comments[$key]['children']=$this-Comment-find('threaded', array( 'conditions'=array('post_id' = $p['Post']['id'], 'lft ' = $value['Comment']['lft'], 'rght ' = $value['Comment']['rght']), 'fields'=array('Comment.id','parent_id','nick','comment','created'), 'order'=array('Comment.created'='asc') ) ); } } But the problem is, the subtree of comments does not contain all the threaded children. I checked some of the comments that didn't show up in a subtree and it turns out that their rght field value is not smaller than rght or parent, but it is a bigger value. What caused that situation? Why find('threaed') of whole comments table returns all the nodes and comments correcty, but getting a subtree fails on some records (the ones that have the rght value bigger than parent rght value)? I also tried to do this in a way to first get all the childrens ids of a parent node, and then get all threaded comments with conditions containing 'Comment.id' = '$children_ids. But the $children_ids array is being created on the basis of Tree Behavior childen() function, which also does not return all the records (again, the ones with higher rght values are not displayed). Some one please help :-)) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: get the id's from checkbox list
Hello. I think you need to add some index to the checkboxes (so it would be rather an array), because if there are several items in $tutor variable, you keep creating checkboxes with the same name - data[*Model*][available]. So every checkbox has the same name and you keep overwriting them if the $tutor array has more than 1 element. That causes the situation that only the data from the last checkbox is being sent within the form. I would do it like this: $i=0; foreach($tutor as $item) { echo $this-Form-checkbox('available.'.$i, array('value' = $id, 'checked' = 0, 'hiddenField'=false); $i++; } or even without the $i variable (notice the dot after the available): foreach($tutor as $item) { echo $this-Form-checkbox('available.', array('value' = $id, 'checked' = 0, 'hiddenField'=false); } hiddenField is set to false for the purpose of not displaying a hidden field for checkbox. Then in the controller you can get the array of checked values of all checkboxes like this: $ids=array() foreach($this-request-data[*Model*]['available'] as $item) { $ids[]=$item; } Just remember to add 'hiddenFIeld' = false to checkboxes. If your request will be blackholed, simply add the following code at the beggining of your controller: public function beforeFilter() { parent::beforeFilter(); if(in_array($this-params['action'],array('*name_of_the_controllers_action*'))) { $this-Security-unlockedFields=array('available'); } } or put the $this-Form-unlockField('available'). Hope this helps. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: get the id's from checkbox list
Oh, and if it did not work as expected, try putting a model name before the available in the checkbox. Let's say that you use the Tutor model - the code should look like this: echo $this-Form-checkbox('Tutor.available.'.$i, array('value' = $id, 'checked' = 0, 'hiddenField'=false); or without the $i: echo $this-Form-checkbox('Tutor.available.', array('value' = $id, 'checked' = 0, 'hiddenField'=false); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: cakePHP File Download was not found or not readable
Thanks for suggestion, but I already tried that. The files folder has 0777 permissions. I also tried to change files attributes to 0777, but the problem still occurs. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: cakePHP File Download was not found or not readable
Had anyone else same problem? I'm using ver 2.4.4 and I have problems with forced downloading files. When I click a download link, which in generalization does this: $this-response-file('files'.DS.$f['file']['file_name'].'.'.$f['File']['file_ext'],array('download'=true,'name'=$f['File']['file_name'].'.'.$f['File']['file_ext'])); I get error like: File XXX cannot be written, because source file could not be read. Try again later or contact your server administrator. The download window with option to write file appears, but clicking on OK button does nothing (there is no file being saved). The $f variable contains all the needed data ('file_name' and 'file_ext'). This problem occurs only on the production server. On the localhost everything works fine. Files definately exist in the app/webroot/files folder. The app/tmp folder has 0777 permissions. What could it be? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Paginator and multilingual routes
Hello. I have a problem with paginator helper. I'm developing an app in 2 language versions. The app conatains among others blog, which is paginated. Now, the url's in routes.php look for exmaple like this: Router::connect('/blog/search/*', array('controller' = 'blog_categories', 'action' = 'search')); Router::connect('/blog/suche/*', array('controller' = 'blog_categories', 'action' = 'search')); This is the route for blog search option. Now, when I'm on a blog search results page, and I'm on the English version of website - everything works fine. The URLs of pages look like /blog/search/2, /blog/search/3 etc. But when I switch to German version, the paginator URLs are the same... and I want them to also be translated and look like: /blog/suche/2, /blog/suche/3, etc. I guess it is because the '/blog/search/*' is defined first. When I remove that line from routes.php - the /blog/suche/ links are in pagination. How to fix this? In such way that in the german version, paginated links will also be german? Regards and many thanks for help. Anna -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
What are the cookies set by CakePHP automatically (cookie named CAKEPHP) for?
Hello. I have following question - what are the cookies, which are set automatically by CakePHP, for? By cookies set automatically I mean the cookie named CAKEPHP with some hashed value. I do not use any cookies in my application (but I use sessions) and I wonder why is there always a CAKEPHP cookie set, after visiting the page. The reason I'm asking is because today a law on cookies came into force (in my country as well as in UE I guess) - from now on website operators need to inform users about the fact that website uses cookie files. And also, what is the purpose of using that cookies files. So the users need to be informed of the purpose of collecting information through cookies. I will be very appreciated for help:) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: ajax Update in a page with 2 divs
Hello. When I have to update two (or more) different elements, but both of them with different content, I simply only set 'update' in a form on a element where I have to display more complex data (for example from database), and then I update second div using JavaScript (in a view of updated element). For example: I have a submit comment ajax form, and after the form is submitted - I want to save comment to database and display refreshed list of comments and also the message Comment has been added (but in a different place than updated list of comments). Let's assume that the view (list of comments and comment submit form) looks like this: divAdd comment/div div id=message/div div ?php echo $this-Form-create('Comment')? ?php echo $this-Form-textarea('comment')? ?php echo $this-Js-submit('Add comment', array( 'url' = '/comments/add/'.$p['Post']['id'], 'update' = '#comments_list', 'evalScripts' = true, ));? /div div id=comments_list //here goes the list of comments /div After you submit a form, the action add in Comments controller is being done - a comment is entered to a database and you retrieve updated list of comments from database. The div with comments_list id is updated with the list of updated comments. So your Comments/add.ctp view contains list of comments and a JavaScript code to update message div with an info that comment has been added: //here goes the list of comments script type=text/javascript document.getElementById('message').innerHTML='div class=messageComment has been added. Thank you!/div'; /script You have to remember to add 'evalScripts' = true to the submit button, otherwise JS code won't be executed. Hope this helps a bit. On Wednesday, March 20, 2013 11:12:52 AM UTC+1, Chris wrote: hi guys,... how you all doing, can anyone help please,... I got an ajax form that submits and add bookmarks to a site and it's working,... Is it possible to Update in a page with 2 divs ? and how can I do that in a form: , 'update' = 'updateBookmark1',...? and where should I insert 'updateBookmark2',... ?? thanks in advance, div id=updateBookmark1 this update confirmation /div div id=updateBookmark2 this need to update content /div ,... kind of refreshing content in a page . . . p style=float: left; margin: 0 0 0 35px; ?php echo $ajax-submit('Add', array('url'= array('controller'='bookmarks', 'action'='add'), 'update' = 'updateBookmark1', 'complete' = 'javascript:resetBookmarkForm();' )); ? ?php echo $form-end(); ? /p -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: What are the cookies set by CakePHP automatically (cookie named CAKEPHP) for?
You're completely right. Sorry for the dumb question, I lastly had small amount of sleep and great amount of work. Anyway, no explanation is good here. Cheers! On Friday, March 22, 2013 11:02:59 AM UTC+1, AD7six wrote: but I use sessions It should be obvious that the cookie you're looking at is the *session* cookie. The hashed value it contains is the session id. AD On Friday, 22 March 2013 10:01:56 UTC+1, Anna P wrote: Hello. I have following question - what are the cookies, which are set automatically by CakePHP, for? By cookies set automatically I mean the cookie named CAKEPHP with some hashed value. I do not use any cookies in my application (but I use sessions) and I wonder why is there always a CAKEPHP cookie set, after visiting the page. The reason I'm asking is because today a law on cookies came into force(in my country as well as in UE I guess) - from now on website operators need to inform users about the fact that website uses cookie files. And also, what is the purpose of using that cookies files. So the users need to be informed of the purpose of collecting information through cookies. I will be very appreciated for help:) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to change order only for child elements in find('threaded').
Thanks a lot! Your suggestion solved my problem. Just like you said, I run select query with ascending order, then if the sorting is set to DESC, I run array_reverse on result set. Cheers!:) On Monday, November 26, 2012 8:10:50 PM UTC+1, cricket wrote: Model::_findThreaded() uses Set::nest() to create the threaded array. So, perhaps the simplest approach would be to use 'ASC' by default, then test for $sort _after_ you get the results back. To switch to descending order for just the parent comments, run the result through array_reverse(). On Mon, Nov 26, 2012 at 5:10 AM, Anna P apa...@o2.pl javascript: wrote: Hello. I got problem with setting up an order for child elements different than for parent elements. I have a blog with comments. Users can switch between comments order - comments can either be sorted descending or ascending. The problem is, when the order is set to descending, also the child elements are sorted descending. That way, the child comments which are answers to parent comments are also shown in a way that the newest one is on top. And I would like to order the child elements by ascending way, even when parents are sorted descending. I tried to use IF statement in order clause like this: if($sort=='desc') { $order='IF parent_id IS NULL THEN created desc ELSE created asc END'; } else { $order='created asc'; } $comments=$this-Comment-find('threaded',array('conditions'=array('post_id'=$p['Post']['id']), 'fields'=array('Comment.id','parent_id','comment','created'), 'order'=$order)); but I get an error: Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parent_id IS NULL THEN created END desc, IF parent_id IS NOT NULL THEN id END as' at line 1 I've read somewhere that the DESC and ASC cannot be used inside IF or CASE statement. How else could the default ordering for whole table be changes to another only for child elements? Regards thank you in advance for help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake...@googlegroups.comjavascript:. To unsubscribe from this group, send email to cake-php+u...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
How to change order only for child elements in find('threaded').
Hello. I got problem with setting up an order for child elements different than for parent elements. I have a blog with comments. Users can switch between comments order - comments can either be sorted descending or ascending. The problem is, when the order is set to descending, also the child elements are sorted descending. That way, the child comments which are answers to parent comments are also shown in a way that the newest one is on top. And I would like to order the child elements by ascending way, even when parents are sorted descending. I tried to use IF statement in order clause like this: if($sort=='desc') { $order='IF parent_id IS NULL THEN created desc ELSE created asc END'; } else { $order='created asc'; } $comments=$this-Comment-find('threaded',array('conditions'=array('post_id'=$p['Post']['id']), 'fields'=array('Comment.id','parent_id','comment','created'), 'order'=$order)); but I get an error: Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'parent_id IS NULL THEN created END desc, IF parent_id IS NOT NULL THEN id END as' at line 1 I've read somewhere that the DESC and ASC cannot be used inside IF or CASE statement. How else could the default ordering for whole table be changes to another only for child elements? Regards thank you in advance for help. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
How to get posts that match specified several tags
Hello. I'm creating a search engine for a blog and I've got a problem with selecting posts based on a given, several tags. I have following models: - Post (posts) - Tag (tags) - PostsTag (posts_tags) In Post model there is a hasAndBelongsToMany relationship with Tag model defined. Let's say I have following posts and tags assigned to them: - Raspberry icecream - with icecream tag assigned - Pineapple icecream - with icecream and pineapple tags assigned - Pineapple pie - with pineapple and pie tags assigned What I'm trying to do is select posts that match not only one tag, but all the tags that are specified in a search phrase. Let's say that I've entered to the search engine following search phrase: pineapple icecream . Now, what I want to achieve is to posts that have pineapple tag assigned to them and also have icecream tag assigned. So in search results there is only Pineapple icecream displayed, because it is assigned to both search conditions words - pineapple and icecream. How can I do this? I tried like that: $tags=$this-Tag-find('all',array('conditions'=$cond,'fields'=array('id'))); //here I get all the tags that match every word in search conditions if($tags) { foreach($tags as $t) { $tags_ids[]=$t['Tag']['id']; } $posts_tags=$this-PostsTag-find('all',array('conditions'=array('tag_id'=$tags_ids),'fields'=array('post_id'))); if($posts_tags) { foreach($posts_tags as $pt) { $posts_ids[]=$pt['PostsTag']['post_id']; } } } and then I do the search for posts based on the $posts_ids condition. But with this solution, I get in search results all the posts, which have either icecream tag or pineapple tag. Which does not suit my needs. Any help will be greatly appreciated. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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 cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakeEmail SMTP syntax error 555 (#5.5.4) while sending e-mail to multiple users (with the use of bcc array)
It turned out that mail server had limit on number of recipients in one e-mail (I tried to send one mail to 200 e-mail addresses, the limit was 100 recipients). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: header information in outlook
I didn't manage to solve the problem using the Mail transport. However, I switched e-mail transport to Smtp and now it works fine. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakeEmail SMTP syntax error 555 (#5.5.4) while sending e-mail to multiple users (with the use of bcc array)
Hello. I have following problem: I use Smpt method to deliver e-mails from website. E-mails which are sent to just one recipient (for example: message with registration confirmation, message with new password, etc.) work just fine. The problem is when it comes to send message to multiple recipients, while sending a newsletter. When I try to send newsletter to let's say 2 e-mail addresses - it all works fine. But when I try to send it to all users (about 200 of them), there is a following error: SMTP Error: 555 syntax error (#5.5.4) *Error: * An Internal Error Has Occurred. Stack Trace #0 /home/users/opg/public_html/lib/Cake/Network/Email/SmtpTransport.php(156): SmtpTransport-_smtpSend('RCPT TO:_sendRcpt() #2 /home/users/opg/public_html/lib/Cake/Network/Email/CakeEmail.php(967): SmtpTransport-send(Object(CakeEmail)) ... What could be the cause of this? I cannot find any information in the web. Could it be something wrong with the mail server? I checked e-mail addresses, to which the newsletter was going to be sent - and they all seem correct. Thank you in advance -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: header information in outlook
Has somebody solved that issue or know what causes the problem? I use Outlook Express 6 on XP and it displays e-mail messages correctly (they are sent as both - text and html). But with Outlook on Windows 7 e-mail displays header information, and content in both formats. I use CakePHP 2.0.5 and CakeEmail. Thanks in advance for help! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with CakeEmail - rewrite default config and bcc delivery does not work
I managed to switch to a newsletter layout by creating another config in app/Config/Email.php : public $newsletter = array( 'transport' = 'Mail', 'charset' = 'utf-8', 'headerCharset' = 'utf-8', 'layout' = 'default', 'template' = 'newsletter', 'emailFormat' = 'html', ); and I load it like this: $email = new CakeEmail('newsletter'); And now it works fine, it uses 'newsletter' layout. But still, bcc doesn't work - email isn't delivered to recipients. I've read in cookbook that bcc should be an array where key is an e- mail address and value is either name or e-mail, so I changed my bcc array to something like this: array(1) { [email @ domain.com]= string(X) email @ domain.com } but it still doesn't work... (of course email in array is a real, existing address). Please help anyone -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with CakeEmail - rewrite default config and bcc delivery does not work
Hello. I have set following default config in app/Config/email.php : public $default = array( 'transport' = 'Mail', 'charset' = 'utf-8', 'headerCharset' = 'utf-8', 'layout' = 'default', 'emailFormat' = 'both', ); Sending e-mails to one e-mail address (without cc and bcc) based on this config works good. But I want to send newsletters based on different layout, and to several e-mail addresses given in bcc config. E-mails does not deliver to addresses specified in $this-bcc config. I also try to override default layout, but it keeps sending e-mail with the default one. Here is what I do to send e-mail in my newsletter controller: App::uses('CakeEmail','Network/Email'); $default_email=Configure::read('default_email'); $email = new CakeEmail(); $email-config('default'); $email-from(array($default_email='Sitename')); $email-sender(array($default_email='Sitename')); $email-replyTo($default_email); $email-layout = 'newsletter'; $email-template('newsletter'); $email-emailFormat='html'; $email-viewVars(array('data'=$data)); $email-subject($data['Newsletter']['title']); $email-to($default_email); $email-bcc=$bcc; $email-send(); What could be the problem? I edited temporarily the send() function in lib/Cake/Network/Email/ CakeEmail.php and var_dump'ed $this-bcc and $this-layout and it returned me the accurate values. But still, e-mail is not delivered to bcc and the layout remains default. I pass an array like this to a bcc: array(1) { [0]= string(X) em...@domain.com } Thank you very much for help! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Web conference scripts suitable for CakePHP ?
Hello. I'm searching for a open source scripts / solutions for on-line web conferences (like BigBlueButton.org). Has anyone integrated such solution into CakePHP website? What scripts or software, which is easy to integrate, would you recommend? I need this for an online webinars. Thank you in advance! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Data validation in multilingual website (with i18n)
Hello. I'm building an multilingual website in CakePHP 2.0.5 with the use of I18n. My question is: how can I define (in model class) validation rules, so they apply to specified language version (locale)? I have an i18n table, languages table (id,code), subpages table (id,created) While adding new subpage (or editing a subpage) I want to display fields for title and content in all the language versions at one form. The simple view ($langs is the list of languages from languages table): ?php echo $this-Form-create('Subpage',array('url'='/admin/subpages/ add'))? table cellspacing=0 cellpadding=0 class=table ?php foreach($langs as $l):? trtd colspan=2Language: ?php echo $l['Language']['code']?/ td/tr trtdTitle/td td?php echo $this-Form-text('Subpage.title.'.$l['Language'] ['code'])? ?php echo $this-Form-error('title')? /td /tr trtdContent/td td?php echo $this-Form-textarea('Subpage.content.'. $l['Language']['code'],array('class'='ckeditor'))?/td/tr ?php endforeach;? /table ?php echo $this-Form-submit('Add subpage',array('class'='submit','div'=false))?/div ?php echo $this-Form-end();? The part of code in controller's action: if($this-request-is('post')) { if(!empty($this-request-data)) { $this-Subpage-set($this-request-data); if($this-Subpage-validates()) { $this-Subpage-create(); $this-Subpage-save($this-request-data); } } } It works fine and on add subpage action it entries both translations to i18n table. The problem is, I have a validate variable defined for Subpage model like this: public $validate = array ( 'title' = array( 'minlength' = array( 'rule' = array('minLength', '1'), 'message' = 'Title cannot be empty', ), 'maxlength' = array( 'rule' = array('maxLength', '40'), 'message' = 'Title cannot be longer than 40 characters', ), 'chars' = array( 'rule' = array('custom', '/^[A-Za-ząĄćĆęĘłŁńŃóÓśŚźŹżŻ0-9\ ]* $/'), 'message' = 'Title can contain only letters, numers and spaces ', ), ), If I enter an unaccepted string into the title field in ONE of the language versions and submit form, both fields (in both languages) are marked as invalid and for both fields the error is being displayed (apart from the fact that second field is filled correctly). Does anyone know how to fix this or what should the $validate var look like? Thank you in advance for help. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with saveAll translations within one form - CakePHP multilingual website
Hello. I'm making multilingual website and I want administrator to add and edit subpage in all available languages within one form. The add function works fine, the problem is when I want to edit subpage and all translations at one time - one of the fields does not want to update in i18n table. Model: http://pastebin.com/Mas1aciu add function (works fine, adds record to subpages table and records to i18n table containing title, link and content in every language): http://pastebin.com/N61WLwNQ add view: http://pastebin.com/Y6a1WquA edit function: http://pastebin.com/1ZdumqUe edit view: http://pastebin.com/BWcXvGKY Editing title and content and saving form changes only the translations of fields link and content in i18n table. The title just won't change at all in translations table, after editing a form. I've just build another model - Category. Same issue here, although I translate only two fields (name and link, based on the name). The same situation with editing - only link translation is being updated, and name isn't. Anyone has a clue? Or maybe there is some better solution to create and update dynamic translations with the use of one form? Regards, Anna -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP 2.x - Call to undefined method View::fetch()
Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded the 2.0.5 Stable version, set it up on my localhost, created DB with simple table 'subpages' and Subpage model, created simple layout with couple of html tags and: body ?php echo $this-fetch('content'); ? /body And what I get is an error: Fatal error: Call to undefined method View::fetch() in (...)default.ctp on line 14 This is a clean version of Cake, I didn't modify anything. Just added one simple model Subpage.php and default.ctp with call to fetch function, as wrote in Cookbook. Anybody knows what could be the problem? Thanks in advance for help! Anna -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.x - Call to undefined method View::fetch()
Thanks very much. I've checked Cookbook again - of course I didn't notice a key information which is: New in version 2.1. : On 16 Sty, 17:01, Tilen Majerle tilen.maje...@gmail.com wrote: of course, View::fetch() is available since 2.1, but you have 2.0.5 use $content_for_layout instead -- Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded the 2.0.5 Stable version, set it up on my localhost, created DB with simple table 'subpages' and Subpage model, created simple layout with couple of html tags and: body ?php echo $this-fetch('content'); ? /body And what I get is an error: Fatal error: Call to undefined method View::fetch() in (...)default.ctp on line 14 This is a clean version of Cake, I didn't modify anything. Just added one simple model Subpage.php and default.ctp with call to fetch function, as wrote in Cookbook. Anybody knows what could be the problem? Thanks in advance for help! Anna -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP AJAX auto-refresh div in specified time interval - is it possible?
Hello there. I have a question - is it possible to autorefresh content of specified element (such as div) in given time interval (for example: 10 seconds)? I need AJAX to do this, because refreshing should result in fetching the data from database. I have an CakePHP app, let's call it online store with loyalty program. If user buys products, he/she receives so called bonus points which he/she can later spend on next shopping. These bonus points are temporary and they expire after one month. The point I need this auto-refresh option is to prevent this kind of situation: - user gathered X points which are about to expire soon - user places an order in which he/she exploits gathered points - on the order details page there is a form which directs to outside payment system - automatic function checks if there are any expired points in system and remove them - function updates the orders at the same time (if user used X points on his order and they expire - number of used points in specified order is turned to NULL and the value of order is properly increased - if the user does stays at the order details page and does not refresh it (after the automatic function updates value of order and deletes used point) - he/she can proceed to payment system with the old value of order (not updated). So, I want to place script on a order details page which will autoupdate the div with form to payment system and value of order which should be settled. Is it possible? Is it the right solution for that kind of matter? I would be really appriciate for any help. Thanks in advance! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Help with query (or subquery?)
Hello. It's maybe not such a CakePHP question, but rather regarding a rather complex (for me) SQL query. I have a table storing e-mail addresses to which has been sent an invite to a website: CREATE TABLE IF NOT EXISTS `recomm_emails` ( `id` mediumint(7) unsigned NOT NULL AUTO_INCREMENT, `user_id` smallint(5) unsigned NOT NULL, `email` varchar(100) NOT NULL, `registered` tinyint(1) NOT NULL DEFAULT '0', `active` tinyint(1) NOT NULL DEFAULT '0', `created` date NOT NULL, PRIMARY KEY (`id`) ) 'user_id' is the ID of registered user, who has sent an invitation to given e-mail address. The 'registered' field means that user who got the invitation has registered in website. The 'acitve' field holds the information if invited user has activated his account after registration. The problem is, I have to create a statistics of invitations. List should be divided into pages and should contain: - User.id and User.login_name (both from users table), - total number of all invited users, - number of users who registered and activated account (registered=1 and active=1), - number of users who registered but didn't activate the account (registered=1 and active=0) - number of users who didn't register at all (registered=0). I need this kind of list, because it will have to be also ordered by selected parameters (chosen from 4 numbers above). So everything must be in one query. How to write such a query? I can't come up with solution for a long time! Please help!:) I first came up to an idea to do it by PHP, but it is not a very nice solution, because on one page I shall present about 30 records, and there is no point to get data from whole the users table (which can have let's say couple tousend of records). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
how to set session variable after render?
Hello. Just like in topic: how can I set session variable after page render? The issue is: on first visit on home page, I want to display several animations (logo sliding down, some not visible boxes appearing after timeout). But I want to display animations only once, on the first visit. I wanted to set function afterRender() in AppController and there set a session variable to switch between showing/not showing animations, but it seems there is no such function in 1.2.X How can I accomplish this? Many thanks in advance, Anna Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CakePHP 1.2.6 - problem with displaying form error messages
Hello. What do you mean by manually? I don't want to save data to database with just checking if data is not empty. I want to validate entered data and display errors before saving to database table. As I wrote, in model I supply which fields I want to validate - I supply rule for field and message which should be displayed if field hasn't been filled out correctly. In controller I use $this-User-set($this-data) and $this-User- validates() to check if supplied data is valid. If it's not valid, I use $this-validateErrors($this-User) to display error messages. The problem is, $form-error('field') doesn't display error message from $validate variable. Validation function creates the div error- message for message, but the div is empty. If I use $form-error('field','Some message') - message is displayed. But I don't want to enter messages text in the view. I rather keep that in user.php model in $validate variable. But this way, message is not displayed and I don't know why. I even changed the version of CakePHP from 1.2.6 to 1.2.5, but it still doesn't show error messages, which is really weird, cause I use this solution in every project and in every project on 1.2.5 it always worked. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP 1.2.6 - problem with displaying form error messages
Hello all. I have a problem with displaying error messages after form validation. Model user.php: var $validate = array( 'fname' = array( 'rule' = array('custom','/^[A-Za-z\ ]{2,30}$/'), 'message' = 'Supply real first name', 'allowEmpty' = false, ), 'lname' = array( 'rule' = array('custom','/^[A-Za-z\ ]{2,40}$/'), 'message' = 'Supply real last name', 'allowEmpty' = false, ), ); In controller, I use $this-User-set($this-data) and $this-User- validates() to validate inputs. If form hasn't been filled correcty $this-validateErrors($this-User) returns invalid fields. The problem is, error message, with the use of: $form-error('fname') or $form-error('lname') is not displaying. Model is validated correctly (it returns information that fname or lname are not correctly filled, it even creates div class=error- message/div div for both fields. But there is no message in the div. When I type: $form-error('fname','Supply real first name') error message is displayed. But I don't want to put error messages in the view. I rather want to hold it in model's $validate variable. What do I do wrong? Or maybe it's some king of bug in 1.2.6? Many thanks in advance:) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP + JS/AJAX - performing actions on browser window close - is it possible?
Hello! I have a question, is there a way to perform an action, when user tries to close browser window? For example: in an on-line store, when unregistered user places some order and doesn't proceed to payment system (its order is still not paid) and wants to leave website/close browser window. Is there a way in that case to display an information box on browser window close attempt like You have an order which hasn't been paid yet. Would you like to pay for order? and if user clicks Yes it redirects him to some URL address with order details and doesn't close browser window. And if he clicks No, before window is closed, some actions are performed on Database (order and all its relative information is deleted). Many thanks in advance! Anna Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to run CRON job with the setup on a virtual server?
Hello. I would like to set a CRON job for my application. In my server administrative panel I want to define the path for the CRON job. The problem is, that I cannot give path as URL (like /mysite.com/users/ some_cron_function), but I have to specify physical file that is on a server (full path to specified file like /www/app/...) How to do this? Because I want to run CRON as a function in a defined controller class. I do not want to put that function in separate file, because it operates on a database. Thanks in advance for help!:) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Allowed memory size exhausted - on clean cakephp install
OK, thanks for help, it seems that I have NO configuration file on my server. --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Allowed memory size exhausted - on clean cakephp install
Hello! I am moving my web application to dedicated server. I uploaded all of my app files and voila - under server IP I got blank page. So I've figured out to install clean cakephp version first and see if it works there. I uploaded Cakephp 1.2.4.82.84 version and it displayed me Cake's welcome page. I changed db config and Cake said it is able to connect to db. But when I entered app_controller.php file and wrote this: var $uses = array('User'); it started to show this message: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 30720 bytes) in [...]/www/cake/libs/view/helpers/form.php on line 1312 and firstly it showed error at cake/libs/i18n.php at line 437 for another model and error at cake/libs/view/view.php on line 663 for another model What is going on? This is a clean CakePHP application with just models at model catalog and thats all. Please,help. :-) --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to set 301 redirect in htaccess for domain .com.pl to redirect to .pl
Thank you for suggestion, but that doesn't seem to work either. Still when I enter .com.pl it doesn't redirect me to .pl --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to set 301 redirect in htaccess for domain .com.pl to redirect to .pl
Hello. I have two domains with the same content. Let's say that it's - www.domain.pl and www.domain.com.pl I want to redirect .com.pl domain to .pl How to set 301 redirect in htaccess file? I tried like this: IfModule mod_rewrite.c RewriteEngine on RewriteRule ^www.domain.com.pl$ /www.domain.pl [R=301,L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule but it doesn't work (I enter .com.pl site and it doens't redirect me to .pl) Thanks in advance! --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to set 301 redirect in htaccess for domain .com.pl to redirect to .pl
I also tried following: IfModule mod_rewrite.c RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?domain.com.pl(.*) [NC] RewriteRule ^(.*)$ http://www.domain.pl/$1 [R=301,L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule But it doesn't seem to work. When I enter on .com.pl it doesn't redirect me to .pl. Anybody help?:-) --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: findAllThreaded root hack for version 1.2.x
anyone?:) --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
findAllThreaded root hack for version 1.2.x
Hello. Can anyone help me with hacking findAllThreaded function for version 1.2.x ? In 1.1.x it looked like it to set the root ID for function: function findAllThreaded($root = null, $conditions = null, $fields = null, $sort = null) { return $this-__doThread(Model::findAll($conditions, $fields, $sort), $root); } But in 1.2.x findAllThreaded is deprecated: function findAllThreaded($conditions = null, $fields = null, $order = null) { return $this-find('threaded', compact('conditions', 'fields', 'order')); } How to supply to findAllThreaded function the root ID of a model which I want to get all children from? Thanks in advance, Anna --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange Reguested URL not found problem.
Thanks for a hint, I didn't realize it could be that kind of problem. I just changed link from icons to web-icons and voila :-) It works. Thanks again! --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Strange Reguested URL not found problem.
Hello. I have searched all over the web about the The requested URL was not found on this server and still can't solve the problem. It's rather strange, because with one parameter it works (page is displayed) and with other - it doesn't. You can see it here: http://www.gurufreebies.com/icons When I try to choose a subcategory from the left menu (for example nature) cake display's 404 Not Found. But when I try to select subcategory for graphics or photos: http://www.gurufreebies.com/photos it shows everything fine. Displaying list of images (no matter if they are icons, photos or graphics) is set on a one function in the same controller. Function takes 3 parameters - main category name, subcategory name = NULL, page number = NULL What could possibly be wrong? Why with one parameter function works OK and displays stuff and with other - it doesn't ? What is even more interesting - in polish version of this site, displaying list of icons from chosen subcategory - works fine. (for example : www.gurufreebies.pl/ikony/natura ) Debug set to 2 showed nothing, deleting files from cache did nothing, tmp is ste to writable, db connection is OK, route is also set OK. Thanks in advance for any suggestions:) Anna --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Simple chat between two persons? Please help
Hello. I'm looking for simple chat code for CakePHP 1.2. The chat must be only between two logged persons (it's not a general chat for everyone, but a kind of private messaging). If anyone could help I would be very appreciated. Anna --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Ajax form FIELDS validation :-) How to?
Hello! I have a register form with several fields, which I want to validate in real-time using ajax. Let's say that form has 4 fields: login_name, pass, confirm_pass, email. Validation rules in model User are: login - from 3 to 20 letters, pass - the same, email - VALID EMAIL. What I want is to code that kind of form: When user enters login_name, the ajax-observeField calls action with validating login_name field. When I enter login_name and go to another field (or better - without clicking outside the input), ajax validates that field and puts either tick or cross image with error message, if field didn't pass validation. I want to validate each field without submiting the form. I tried this way: form view: ?php echo $form-create('User',array('url'='/users/register'))? ?php echo $form-text('login_name',array('id'='login_name'));? ?php echo $ajax-observeField('login_name',array('url' = '/ users/verify_field/login_name','update' = 'login-error')); ?br/ span id=login-error?php echo $form-error ('login_name','Wrong login');?/span ?php if(isset($login_error)):?span class=error-message? php echo $login_error;?/span?php endif;?/div div class=clean/div (the same with other fields, instead login_name there is: pass,confirm_pass,email). function verify_field in controller: function verify_field($field) { $this-layout = 'blank-nohtml'; //blank html if(!empty($this-data['User'][$field])) { $this-User-set($this-data); if($this-User-validates() !($field=='login_name' $this- User-find(login_name='.$this-data['User']['login_name'].'))) { $img=tick; } else { if($field=='login_name' $this-User-find(login_name='. $this-data['User']['login_name'].')) { $this-set('login_error',ERROR_LOGIN_USED); } $this-validateErrors($this-User); $img=cross; } $this-set('img',$img); } } verify_field view: ?php echo $html-image('icons/'.$img.'.png')?nbsp; ?php echo $form-error('login_name',ERROR_LOGIN);? ?php if(isset($login_error)):?span class=error-message?php echo $login_error;?/span?php endif;? But this is validation for only one field. How to make it better? And the most important question: when I verify filed like this, I do get correct image (tick if validation passed, cross if not), but the $form-error doesn't show anything if the field didn't pass validation. For any help I would be very greatful. If you know any ajax form field validation tutorials - let me know. Kisses :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
How to update two divs with $ajax-link ??
Hi! I have a problem with updating divs with ajax component. I use $ajax- link to update one div which holds picture thumbnail and link to its original size and I have to update another div with just link to the picture. How can I update two divs with one $ajax-link ? Cheers! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to update two divs with $ajax-link ??
Hi again! I tried this way: ?php echo $ajax-link('Frame product', '/products/frameimage/'. $p['Product']['id'], array('update' = array('p-image','p-link')); ? so as the second argument I gave link. But the problem is that I want to update two divs with two different things (so I want to call two functions (two links/urls) and two views for them). In 'p-image' I have an image thumbnail and in 'p-link' i have link to the image of original size. In the $ajax-link call I want to call function 'updateimage' in Products controller (and in the 'p-image' div I want the views/ products/updateimage.ctp to display) and call another funcion 'updatelink' in Products controller (and in the 'p-link' div I want the views/products/updatelink.ctp to display). How to do that? I tried to set the link as a variable in the 'updateimage' function (by $this-set('updated_link',$updated_link)), and then in 'p-link' to dipslay $updated_link (with 'p-image' and 'p-link' update) but it doesn't work. please, help:) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validating only several fields in model
Hi! I have an issue with data validation. I have model Administrator with fields : firstname,lastname,password In Administrator model I set validation for every field (let's say firstname can't be empty, lastname can't be empty and password can't be empty and can consist only letters). I want to define function which will allow user to edit (update) Administrator's firstname and lastname. So in my function admin_edit: function admin_edit($id) { if(!empty($this-data)) { $this-Administrator-set($this-data); if($this-Administrator-validates()) { //updating fields in DB } else { $this-validateErrors($this-Administrator); } } } In my view I have a form with two text fields: firstname and lastname. I don't want password to be upadted. And here's the problem: when I pass variables from form to admin_edit function, validation function validates EVERY field in model (firstname,lastname and password). And I only give function two values: firstname and lastname; so the password - $this- data[Administrator][passowrd] - is empty and returns false from validation. How can I validate only firstname and lastname fields, without validating password? Any help appriciated. :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
select options attributes in 1.2
how do I set options attributes in select helper in 1.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-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 -~--~~~~--~~--~--~---
findAllThreaded hack with root doesn't work
Hi! I used hack for findAllThreaded function from this group - I replaced cake's function with: function findAllThreaded($root = null, $conditions = null, $fields = null, $sort = null) { return $this-__doThread(Model::findAll($conditions, $fields, $sort), $root); } I need this function to display posts on a forum: //forums_controller.php: function topic($id) { $this-set('posts',$this-Post-findAllThreaded()); } The problem is - when I supply root's ID ( $this-Post- findAllThreaded($id)) , function doesn't find any children. If I leave $this-Post-findAllThreaded() with no root ID specified - it finds all children. If I specify fields I want to find, for example: $this-Post- findAllThreaded('','','Post.id,Post.parent_id,Post.title')); it finds nothing and returns empty array. What is wrong? Thanks in advance! PS. Maybe someone knows any FORUM TUTORIAL for cakephp? It's a bit time consuming to write it all by myself.. Cheers! --~--~-~--~~~---~--~~ 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: Two dependent select tags with data from DB (ajax?) - please help:)
Thank you both for help! Finally, I decided to use tutorial from devmoz.com . It works, but I have one problem. I use dependent selects in registration form. Fields 'city_id' (first select) and 'district_id' (second select) must be selected by user - both of them are validated in form. The problem is - when I select city and district and then fail with another field (for example I won't enter my e-mail address in form, just to make form validate data) - first select shows me the city I chose, but second select doesn't show me the district I chose and it also doesn't show district which belong to the chosen city (it shows me nothing). Why is that? How to fix this? Thanks in advance - Anna:) --~--~-~--~~~---~--~~ 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 losing session after redirect
I'm using version 1.1.18. The problem is: in the login action I set session variable for user and then redirect. After redirect cakephp is losing session. I tried with CAKE_SESSION_SAVE - 'php', 'cake' (with sessions folder writable), CAKE_SECURITY - 'high', 'medium','low' Nothing works. I searched on group but found no solution. Anyone please help:-)) it's driving me crazy:/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Two dependent select tags with data from DB (ajax?) - please help:)
Hello! I'm wondering if anyone has any simple script or knows good tutorial about two dependent select tags. I use and understand a little of JS, but AJAX is too much for me. I just need this one functionality from AJAX - I have two tables: cities (id,name) and districts(id,city_id,name) I want to create two select tags: select name=data[Profile][city_id] ?php foreach($cities as $c):? option value=?php echo $c['City']['id']??php echo $c['City'] ['name']?/option ?php endforeach;? /select select name=data[Profile][district_id] ..options with districts dependent from the chosen city... /select Anyone please help... Can it be done like this... $cities are sorted by name, and when I enter on the registration page (this is where I need these two select tags), first select shows me first city from the $cities array and second select shows me districts of this city. Thank you 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 -~--~~~~--~~--~--~---
Blank page after form submitting
Hi, as in the topic - when I submit form (customer registration for example), cake php displays me blank page (without title and any content at all), although the form action, routes, URL - are good. My DEBUG is 3. Anyone please help cause it's driving me crazy:-/ --~--~-~--~~~---~--~~ 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: Blank page after form submitting
Thank you for answer:) I solved my problem by putting into controller $this-render();: function register() { $this-render(); //.code...; } Don't know why it didn't render the page correctly.. --~--~-~--~~~---~--~~ 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: Blank page after form submitting
That's what I thought. Oh, and I made a mistake, I use $this-render() and the end of the code in controller:-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
PHP session doesn't work outside controller...why?
Hi again. Anyone had this thing? I use PHP sessions and in login() action, when user is authenticated i set: $_SESSION['login']=$this-data['User']['login'] Under this line i use: var_dump($_SESSION) to check if the variable was set. And it is. The problem is, it doesn't exist outside the users controller... in layout I try to var_dump($_SESSION) and it doesn't seem to have set 'login' ... what's the matter? 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: is_file returns false - while the file exists
Thank you! if(file_exists(IMAGES_DIR. 'upload' . DS . 'filename')) worked for me. Thank you once again:-)) --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
No, I don't use js (as for now). --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
Yes, there is UTF-8 in layout, DB stores data in UTF-8, encoding for connection with DB is set to UTF8, in cake there is UTF8 set for DB connections, I use UTF8 editor it's driving me crazy!:[ --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
Yes it is:]. In fact, in the layout I use: ?php ini_set('default_charset', 'utf-8'); header('Content-Type: text/html; charset=utf-8');? at the beggining, so the browser knows what the encoding is. --~--~-~--~~~---~--~~ 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: is_file returns false - while the file exists
OK so how to use it? When I try if(is_file(../img/upload/photo_file1_.$item['Item'] ['id']..jpg)): (the path, which img src just gives me the right image) it doesn't work as 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 -~--~~~~--~~--~--~---
wrong coding in layout variables from beforeRender function
Hi! Anyone has an idea how to solve my problem?;-) I insert data to database using FCK editor, the data in DB looks OK. My DB has all the fields in UTF8, in database.php i set encoding = 'UTF8', in app_model.php I have 'set names utf8'. In the views where I display subpages and it's titles everything is OK, the letters are correct. But in my layout I have a menu with links to all the subpages, as their titles. And the coding doesn't work. It gives me ??? for polish letters. I retrieve the titles of subpages in app_controller.php in function beforeRender. Shouldn't it work the same as for controllers for views? What's the matter with it, why doesn't it give me the results in correct encoding? Please, 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 -~--~~~~--~~--~--~---
Can any1 help? CAKEPHP= a lot of numbers in url and js window not opening in IE
Hi. To make it quicker, I'm giving you an url to my site where the problem exists: http://wolos.pl/galeria/slub/nasza-sesja When I try to open a photo in IE it gives me error... in FF works fine code for each pic looks like: a href=# onclick=window.open('http://www.wolos.pl/zdjecia/?php echo $th['Photo']['id']?','wolos.pl','menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no, location=no, left=0, top=0') ?php echo $html-image('photos/'.$c_link.'/'.$s_link.'/'.$th['Photo'] ['file'].'_small.jpg');? /a I'm using this code on my others site and works fine under IE and FF. ANd also, why it gives me the strange URL looking like http:// www.wolos.pl/galeria/slub/nasza-sesja?CAKEPHP=21ikh12ioh512bj12(...)# in app/config/core.php i have define('CAKE_SESSION_SAVE', 'php'); please 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: Can any1 help? CAKEPHP= a lot of numbers in url and js window not opening in IE
ok I managed windows in IE but the browser still gives me URL with CAKEPHP numbers. don't want to see that in my adress bar, how to get rid of 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 -~--~~~~--~~--~--~---
How to set title of home page that doesn't have a controller? (../views/pages/home.thtml)
Hi:) I have one question. For each page i set title in that page's controller using $this-pageTitle = '' But how do I set the title of home page (that lays in views/pages/ home.thtml) that shows up when i go to 'http://www.mysite.com' or 'http://www.mysite.com/index.php' ? That home page doesn't have a controller. I thought that i can do this in app_controller.php , but when I use $this-pageTitle it gives me an error. Please 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: submitTag - how to pass the name of submit button?:)
Why yes, it worked:-) Thank you very much!:) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---