Re: how can access the Auth info form view
And without $session-check('Auth.User.id')) there is not helper or someting that let me use $Auth-isAuthentificate and to return true or false? If not I'm thinking to create a helper for this, that user $session and get me what I want. On Apr 22, 5:43 pm, francky06l [EMAIL PROTECTED] wrote: in the view : if($session-check('Auth.User.id')) echo $html-link() .. hth On Apr 22, 4:00 pm, Sliv [EMAIL PROTECTED] wrote: You will probably want to do that in the controller action and set a variable for the view http://manual.cakephp.org/view/172/authentication --~--~-~--~~~---~--~~ 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: does Cache prefix work?
I'm setting it where I'm using it. Since it's based on the domain name I can set it anywhere. I suppose if you store the user language in a cookie you could also read it anywhere. --~--~-~--~~~---~--~~ 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 can access the Auth info form view
when logged, you can pass user's data to the view $this-set('loggedin_user', $this-Auth-user()); and in your view: if (empty($loggedin_user)) { // not logged in } else { // logged in } On 23 avr, 08:14, candesprojects [EMAIL PROTECTED] wrote: And without $session-check('Auth.User.id')) there is not helper or someting that let me use $Auth-isAuthentificate and to return true or false? If not I'm thinking to create a helper for this, that user $session and get me what I want. On Apr 22, 5:43 pm, francky06l [EMAIL PROTECTED] wrote: in the view : if($session-check('Auth.User.id')) echo $html-link() .. hth On Apr 22, 4:00 pm, Sliv [EMAIL PROTECTED] wrote: You will probably want to do that in the controller action and set a variable for the view http://manual.cakephp.org/view/172/authentication --~--~-~--~~~---~--~~ 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: Combine and compress js / css..
Check out the following links: http://bakery.cakephp.org/articles/view/jsmin-helper-compress-and-cache-javascript http://bakery.cakephp.org/articles/view/automatic-javascript-and-css-packer https://trac.cakephp.org/ticket/2233 http://blog.bradleyboy.com/2007/07/28/assetpackager-for-cakephp/ On Apr 23, 4:53 am, Mech7 [EMAIL PROTECTED] wrote: Does anybody know a way to get this script working with Cake.. http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_com... I think because the cake url rewrite it does not work by default :( --~--~-~--~~~---~--~~ 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 can access the Auth info form view
Hi, I'm new with Cake, but maybe a way could be to use : $this-Auth- user('a_boolean_activation_var') I'm currently learning to use Auth so I'm also interested in other answers ... :o) On 23 avr, 08:14, candesprojects [EMAIL PROTECTED] wrote: And without $session-check('Auth.User.id')) there is not helper or someting that let me use $Auth-isAuthentificate and to return true or false? If not I'm thinking to create a helper for this, that user $session and get me what I want. On Apr 22, 5:43 pm, francky06l [EMAIL PROTECTED] wrote: in the view : if($session-check('Auth.User.id')) echo $html-link() .. hth On Apr 22, 4:00 pm, Sliv [EMAIL PROTECTED] wrote: You will probably want to do that in the controller action and set a variable for the view http://manual.cakephp.org/view/172/authentication --~--~-~--~~~---~--~~ 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 use not in in new find() ?
I've tried 'conditions' = array('not' = array('id' = $model_ids; but its not ok :( it generates: WHERE NOT ((`id` IN (2, 5) )) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
php4 auto-validation
Hi there, I there anyone who figured out why the auto-validation is not working on php4 ... 1. On a php4 server, when I try to enable validation on any fields (by setting the $validate variable in the model), my site just crash and I get a blank page when the validation is done. 2. If I test on a php5 server, there's no problem at all, the validation is well-done and eveything looks fine. I see the error messages in my form. So ... here it is, I can use php5 on my development server, but I can't on my live server ... it's only on php4. Anyone already addressed this issues so far? Thanks in advance for your precious help. P.S: I'm running cake 1.2.0.6311 beta --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validation of related models in cake 1.2
Hi everybody! I've reading the posts about validation of related models. I.E.; http://groups.google.com/group/cake-php/browse_thread/thread/856cda8e27da925f/0e414257fd9e64bb?hl=enlnk=gstq=validate+related+models#0e414257fd9e64bb I've the same problem: validation errors of related model doesn't goes to the view and Form::error doesn't shows. I've seen in the Trac that have been fixed in 1.1., so, what's the problem? I need to use the patch in Controller:render showed in the post above??? Thanks a lot! --~--~-~--~~~---~--~~ 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: php4 auto-validation
El 23/04/2008, a las 8:40, Hugues escribió: Anyone already addressed this issues so far? First of all, check the class var $name in your models and controllers. It is needed for php4 compatibility, For exemaple: class Post extends AppModel { var $name = 'Post'; } if not present, the application fails with no messagges or with apparently unrelated warnings. Hope that helps. -- Fran Iglesias [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: cake 1.2 r6709 - scaffolding and german umlauts
when I create an entry in the database with the scaffolding interface, it's possible to save german umlauts. The scaffolding webpages display the entered characters correct, except in input fields (if try to edit such an entry) or drop down boxes. The content is not corrupt, it's empty. It makes not difference whether I use 'encoding' = 'UTF-8' or not. The tables are InnoDB with charset=UTF-8. This worked with 1.2.0.6311, but I swtiched to a newer revision since then HABTM relations seem to be fixed in the newer revisions. Is this bug or a error in my setup? It'd help to see the relevant code, but for what it's worth, I'm working on a CakePHP project at the moment that's using various European languages and it's working fine with the latest nightly release of Cake. All I had to do was make sure that /app/views/layouts/ default.ctp and the other layouts included meta http-equiv=Content- Type content=text/html; charset=UTF-8 in the HTML headers and it's working fine with umlauts. I've also noticed that the entries in the database are latin1. Should cake convert the form data to utf8? Technically, it doesn't matter which character set you use as far as storing data into a database goes. Whatever you put in, you get the same stuff out. I would recommend using CHARSET=utf8 COLLATE=utf8_unicode_ci however, because this makes the database server realise that letters with accents and letters without accents are the same, which makes it able to search and alphabetise things properly. Hope that helps a bit, Zoe. --~--~-~--~~~---~--~~ 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: Struggling with Associations in 1.2.0.6311
Thanks Aaron, that's what I was missing! It seems a little counter- intuitive, but it works, which is what is most important. On Apr 21, 10:12 pm, aaron bauman [EMAIL PROTECTED] wrote: Your HABTM relation is backwards. Course belongsTo Accreditation, and Accreditation hasMany Course. The rule of thumb is that if a SQL table contains a foreignKey (as in this case the courses table contains accreditation_id), then it should implement a belongsTo relationship with the other table (in this case, accreditations). Your business logic will determine which relationship the other relationship (either hasOne or hasMany). /a On Apr 21, 11:49 am, NoelC [EMAIL PROTECTED] wrote: I've come unstuck when attempting to establish associations between models. As far as I can tell, I've designed the database using Cake conventions, but the results I receive from finds on models with associations are incorrect. The Cake version is 1.2.0.6311 and the database is PostgreSQL 8.3. These are the DDL statements for two of the tables in my app. CREATE TABLE courses ( id bigint NOT NULL DEFAULT nextval('courses_id_seq'::regclass), course_code dm_short_code NOT NULL, course_title dm_title NOT NULL, course_details dm_description, accreditation_id integer NOT NULL, CONSTRAINT pk_courses PRIMARY KEY (course_id), CONSTRAINT fk_course_accreditations FOREIGN KEY (accreditation_id) REFERENCES accreditations (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) CREATE TABLE accreditations ( id integer NOT NULL DEFAULT nextval('accreditation_id_seq'::regclass), accreditation_title dm_title NOT NULL, description dm_description, accreditor_id integer NOT NULL, CONSTRAINT pk_accreditations PRIMARY KEY (id) ) The two related models are defined as: class Course extends AppModel { var $name = 'Course'; var $hasOne = array('Accreditation' = array('className' = 'Accreditation', 'foreignKey' = 'id' ) ); } class Accreditation extends AppModel { var $name = 'Accreditation'; var $belongsTo = array('Course' = array( 'className' = 'Course', 'foreignKey' = 'accreditation_id' ) ); } When doing a find on a Course, it seems to be joining the courses table to the accreditations table by using course.id = accreditation.id, which is not what I would expect from the model declarations above. The generated SQL is: SELECT Course.id AS Course__id, Course.course_code AS Course__course_code, Course.course_title AS Course__course_title, Course.course_details AS Course__course_details, Course.accreditation_id AS Course__accreditation_id, Accreditation.id AS Accreditation__id, Accreditation.accreditation_title AS Accreditation__accreditation_title, Accreditation.description AS Accreditation__description, Accreditation.accreditor_id AS Accreditation__accreditor_id FROM courses AS Course LEFT JOIN accreditations AS Accreditation ON (Accreditation.id = Course.id) WHERE Course.course_code = 'X123' Perhaps I am misunderstanding the way Cake works, but I have tried many different combinations (including setting $primaryKey in the Model) but to no avail. The last part of the SQL should read: ON (Accreditation.id = Course.accreditation_id) This would give the expected results. Can anyone give me any pointers as to what I may be doing wrong? Thanks! --~--~-~--~~~---~--~~ 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: Session ID
Can you explain why you want to do this? For what circumstance do they need a persistent unique value? The only thing I can think of is to store data on a persistent medium - ie database or file. And in both of these cases you can easily generate a unique one (file / row), and just store the key (filename / row id) in the session... Or, you can change the 'Session.save' in the same file, to cause Cake to automatically save session data to disk / database. Finally, if you set the 'Security.level' to 'medium' in /app/config/ core.php then the session id won't regenerate for every request, so you could just use that. Thank you, that was very helpful! Yes, I somehow managed to overlook the obvious. Although I was setting the user's language preference as a standard CakePHP session variable, I somehow got it into my head that I need to do something more complex to store their shopping cart. You're right, there was absolutely no need for me to try to work out some elaborate method of verifying that each user's unique and not accidentally swapping shopping carts with someone else - Cake's doing all that for me, so all I needed to do was find out if a shopping cart ID is set as a regular session variable, and if not, create a new one and set it. Thanks for pointing that out. :) Zoe. --~--~-~--~~~---~--~~ 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: Ajax request loads my default layout !
ok, I found my problem ! In fact, I already load a default admin template in a beforeRender() method in the AppController :p Thank a lot ! --~--~-~--~~~---~--~~ 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: HABTM and conditions ?
Anybody has a solution ? thank ! Cordially, Neveldo :http://www.neveldo.fr --~--~-~--~~~---~--~~ 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: Trying to use Component polymorphism, How do I load a component on the fly?
I'm trying to follow your suggestion, but with adjustment so that the component instance is created in either a startup or beforeFilter method, instead of calling new in every action that needs this component. I think I have it done properly, but now I get an error when the Component tries to access it's own $components, in this case Session. Here is what I have: class ParentComponent extends Object { var $components = array('Session'); static function create( $controller, $type) { switch ($type) { case 'TypeA': if (!($controller-Parent instanceof TypeAComponent)) { App::import('Component', 'TypeA'); $controller-Parent = new TypeAComponent(); } break; case 'TypeB': if (!($controller-Parent instanceof TypeBComponent)) { App::import('Component', 'TypeB'); $controller-Parent = new TypeBComponent(); } break; } $controller-Parent -startup( $controller); } function startup( $controller) { if (!empty($controller-type)) { debug(ParentComponent - auto startup for .$controller-type); ParentComponent ::create($controller, $controller-type); } else { // component reference debug(ParentComponent - basic startup); $controller-Parent = $this; } $this-controller = $controller; } } class TypeAComponent extends InterfaceComponent { var $components = array('Session'); function startup() { debug(TypeA startup); } } class TypeBComponent extends InterfaceComponent { var $components = array('Session'); function startup() { debug(TypeB startup); } } class MyController extends AppController { var $components('Parent'); var $type; function example() { $this-type = 'TypeA'; ParentComponent::create($this, $this-type); $result = $this-Session-read('Key'); } } and the output I get is: ParentComponent - auto startup for TypeA TypeAComponent constructor TypeAComponent - startup TypeAComponent - startup--- I don't know why startup is called twice, but it shouldn't hurt Notice (8): Undefined property: TypeAComponent::$Session --- here is the problem, I cannot access the Session Component, even though it is declared Fatal error: Call to a member function read() on a non-object On Apr 23, 12:25 am, Joel Perras [EMAIL PROTECTED] wrote: App::import('Component', 'MyComponent') willloadthe component. In the Component::startup() you should have: public function startup($controller){ $this-MyComponent = $controller-MyComponent; } so that you can then create a component instance when you need it: $this-MyComponentInstance = new MyComponent(); -J. On Apr 22, 9:57 am, Anthony [EMAIL PROTECTED] wrote: I'm trying to solve the same exact problem, so far unsuccessfully... Any suggestions out there? On Apr 20, 5:44 am, mixersoft [EMAIL PROTECTED] wrote: I have a parent component that I want to use to implement an interface (java style) and multple childcomponentsthat extend the interface. I want my controllers to instantiate a specific child component, but in the code I want to reference all methods through the parent class or inteface class ParentComponent extends Object {} class TypeAComponent extends InterfaceComponent { function someMethod() { return a;} } class TypeBComponent extends InterfaceComponent { function someMethod() { return 'b';} } class MyController extends AppController { var $components('TypeAComponent'); function example() { $result = $this-Parent-someMethod(); } } The example above works fine. But I cannot figure out how toload 'TypeAComponent' or 'TypeBComponent' dynamically. How can I set MyConfroller-componentsBEFORE the controller loads thecomponents? Or how do Iloadadditionalcomponentsafterwards? I tried this in ParentComponent, but while the subclassedcomponents constructors were called properly, thecomponentswere not loaded the same way (i.e. the child component's var $component array were not loaded, i.e. Session.) class ParentComponent extends Object { static function create($type) { switch ($type) { case 'TypeA':
Re: 1.2 Beta Manual
Thanks, i tried that but the pdf stayed all wrong ... I managed to get the correct .css and now its just like the online one. Thanks again. On Apr 22, 6:56 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In Mac OS X pdf-support is built into the printing dialog. If you are using Windows you have to install Adobes pdf printing plugin found on their website:http://www.adobe.com/products/acrobat/readstep2.html They also have some online service to convert documents and urls to pdf but after the first 5, they want your money.http://createpdf.adobe.com/ /Martin On Apr 22, 1:22 pm, sike [EMAIL PROTECTED] wrote: Thank you. Btw how do you saved in pdf ? I ask this because I the css of the page is missing, i could make one but save it just like the online would be perfect. /John On Apr 22, 1:55 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The complete 1.2 docs in one page is available here:http://book.cakephp.org/complete/3/the-manual I have saved this as a pdf when I have been offline for a while. You could also save it as a Web Archive or whatever your browser calls it. I prefer pdf since I have pretty good search-functionality in my pdf viewer. hope that works for you /Martin On Apr 22, 9:33 am, sike [EMAIL PROTECTED] wrote: Hi, I'm starting now to learn how to work with Cake by the Online Manual, but since i'm on a foreign country I only have internet connection for little time. I've searche for the manual offline do downlod but I only found the 1.1 version... There isn't the 1.2 Beta version like in the online manual ? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM and conditions ?
Take a look at: http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/ Regards. On 23 abr, 11:41, Neveldo [EMAIL PROTECTED] wrote: Anybody has a solution ? thank ! Cordially, Neveldo :http://www.neveldo.fr --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error During Sending Of an Email
I am getting Error when I send email through PHPMAILER Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/bidlower/app/vendors/phpmailer/class.smtp.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (Unknown error) in /var/www/bidlower/app/vendors/phpmailer/ class.smtp.php on line 122 I am using cake version 1.1.19.6305 Help Me Out Thanks Rocky --~--~-~--~~~---~--~~ 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: Error During Sending Of an Email
Where is the CakePHP there? Try the PHPMailer support. http://phpmailer.codeworxtech.com/ []'s On Wed, Apr 23, 2008 at 8:55 AM, Rocky [EMAIL PROTECTED] wrote: I am getting Error when I send email through PHPMAILER Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/bidlower/app/vendors/phpmailer/class.smtp.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (Unknown error) in /var/www/bidlower/app/vendors/phpmailer/ class.smtp.php on line 122 I am using cake version 1.1.19.6305 Help Me Out Thanks Rocky -- Renan Gonçalves - Software Engineer Cell Phone: +55 11 8633 6018 MSN: [EMAIL PROTECTED] São Paulo - SP/Brazil --~--~-~--~~~---~--~~ 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 use not in in new find() ?
On Wed, Apr 23, 2008 at 3:44 AM, rob30 [EMAIL PROTECTED] wrote: I've tried 'conditions' = array('not' = array('id' = $model_ids; but its not ok :( it generates: WHERE NOT ((`id` IN (2, 5) )) Of course it works. Let's say I have a table called 'teams'. ibl_stats=# select count(*) from teams; count --- 1517 (1 row) So tell me what the difference between these statements are: ibl_stats=# SELECT COUNT(*) FROM teams WHERE id NOT IN (2479, 2485); count --- 1515 (1 row) ibl_stats=# SELECT COUNT(*) FROM teams WHERE NOT (id IN (2479, 2485)); count --- 1515 (1 row) Looks the same to me. -- 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 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: Validation of related models in cake 1.2
I haven't had this problem in 1.2 - even models which are nested several levels all get picked up by the form helper. Are you sure you're naming your form elements using the correct dot notation? Model.RelatedModel.FieldName You also have to either explicitly call validates() on each model, or have your save operations validate. Just validating the parent model doesn't fire validation on the related models. On Apr 23, 4:36 am, ygneo [EMAIL PROTECTED] wrote: Hi everybody! I've reading the posts about validation of related models. I.E.;http://groups.google.com/group/cake-php/browse_thread/thread/856cda8e... I've the same problem: validation errors of related model doesn't goes to the view and Form::error doesn't shows. I've seen in the Trac that have been fixed in 1.1., so, what's the problem? I need to use the patch in Controller:render showed in the post above??? Thanks a lot! --~--~-~--~~~---~--~~ 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: Error During Sending Of an Email
Sounds like your server is denying outbound connections on port 25 On Apr 23, 7:55 am, Rocky [EMAIL PROTECTED] wrote: I am getting Error when I send email through PHPMAILER Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/bidlower/app/vendors/phpmailer/class.smtp.php on line 122 Warning: fsockopen() [function.fsockopen]: unable to connect to :25 (Unknown error) in /var/www/bidlower/app/vendors/phpmailer/ class.smtp.php on line 122 I am using cake version 1.1.19.6305 Help Me Out Thanks Rocky --~--~-~--~~~---~--~~ 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: Possible Bug Identified - Re: belongsTo relationship killing my app
I'm using cake 1.2 and i have many 2 or 3 word models with abundant belongsTo relationships and I haven't run into this problem. jump on the bandwagon /a On Apr 22, 8:27 pm, Langdon Stevenson [EMAIL PROTECTED] wrote: I have finally nailed down the issue and am pleased to find that I am not going mad after all. It appears that when a model with a two word name (like FooBar1) is loaded by a hasMany relationship and has a belongsTo relationship to the parent that loaded it then PHP will fail and return a blank page. If you run the same test with the same name but make it one word (like Foobar2) then it works fine. Another interesting point to note is that if you have models called FooBar and Foobar together then it works too. Ultimately it appears that Cake is not handling the belongsTo relationship with names with two words. I have set up a completely new copy of Cake and reproduced the problem with it. This has (mostly) ruled out anything in my application or its setup as being the problem (I haven't tried it on another server). The error is reproducible using the following process: 1. Configure a clean copy of Cake 1.1.19.6261 to use a database (doesn't matter which) 2. Create: app/controllers/trials_controller.php - ?php Class trialsController extends Controller { var $uses = array('FooBar1', 'Foobar2'); function index () { }} ? app/model/foo_bar1.php -- ?php Class FooBar1 extends Model { var $name = 'FooBar1' var $useTable = 'some_table1'; var $hasMany = array('EenyMeeny');} ? app/model/eeny_meeny1.php - ?php Class EenyMeeny1 extends Model { var $name = 'EenyMeeny1' var $useTable = 'some_table2'; var $belongsTo = array('FooBar1');} ? app/model/foobar2.php - ?php Class Foobar2 extends Model { var $name = 'Foobar2' var $useTable = 'some_table1'; var $hasMany = array('Eenymeeny2');} ? app/model/eenymeeny2.php ?php Class Eenymeeny2 extends Model { var $name = 'Eenymeeny2' var $useTable = 'some_table2'; var $belongsTo = array('Foobar2');} ? app/views/trials/index.thtml Some text. Try to view: http://yourserver/trials/index The result will be a blank screen. However if you remove the hasMany entry for FooBar1 ?php Class trialsController extends Controller { var $uses = array('Foobar2'); function index () { }} ? and try again, you will get the default layout with Some text. Displayed. I think that this demonstrates the problem effectively. The next question is: how to fix it? I am assuming that this is a bug in the core model code. I have spent some time looking, but don't know enough about the core code it to be able to see where the problem is occurring. Any suggestions welcome. If I can identify where the problem is occurring, then I will look into submitting a patch. Regards, Langdon Langdon Stevenson wrote: I have a very strange problem appeared with a site that I have been working on for some time. This site is built with Cake version 1.1.19.6305 running on Apache/MySQL/Linux with PHP 5. The site has about 30 models, most have multiple hasMany relationships. Each of those relationships have a corresponding belongsTo from the child to the parent. This has all worked fine with no problem in the past. I went to test some functionality today that I haven't touched for a while and discovered that any model that is loaded that has a belongsTo relationship with a model that has already been loaded caused a blank page to be returned. No Cake debug output, no error in Apache logs, just nothing at all. Eventually I removed all of the belongsTo relationships in the chain of models for one of the pages with the problem. The page now loads fine. But if I add back in any belongsTo relationship it breaks again. I am stumped by this. I have reviewed all of the models to make sure that one isn't corrupt (trailing space issue for instance). Can't find anything of that nature. If anyone can suggest anything I would be very grateful. Regards, Langdon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Ajax::observeField
Hello everybody I'm trying to use the method in subject with no result. CakePHP 1.1.18. The PHP code in thtml is: ... echo $html-input(Project/name,array(maxlength=50,class=)); ... echo $ajax-observeField( ProjectName, array( update=web, url=/projects/webAlias/ ) )? ... the rendered code (html) is the following ... input name=data[Project][name] maxlength=50 class= value= type=text id=ProjectName / ... script type=text/javascript new Form.Element.Observer('ProjectName', 2, function(element, value) { new Ajax.Updater('web','/projects/webAlias/', { asynchronous:true, evalScripts:true, parameters:Form.Element.serialize('ProjectName'), requestHeaders:['X-Update', 'web']} ) } ) /script everything works except that it's returned to me that is missing argument 1 for the controller action. Maybe I'm missing some parameter to the observeField function. Bye Davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Getting the HTTP host ?
hi all , I would like to know if any view attribute exists to get the HTTP host from an cakephp install ( = http://www.example.com ) ? (I don't find it in the API ...) Or must I simply use $_SERVER['HTTP_HOST'] ? Thank ! Cordially, Neveldo : http://www.neveldo.fr --~--~-~--~~~---~--~~ 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: Getting the HTTP host ?
Neveldo wrote: ... Or must I simply use $_SERVER['HTTP_HOST'] ? Don't know, I always use the $_SERVER variable. Bye Davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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: Getting the HTTP host ?
you can use env('HTTP_HOST') --~--~-~--~~~---~--~~ 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: Ajax::observeField
Davide wrote: ... everything works except that it's returned to me that is missing argument 1 for the controller action. Solved at moment making the function argument as optional and testing for the existence of $this-data[Project][name] thank and bye davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with ajax
hello, I have this js function updateopt(id){ id= document.getElementById(id).innerthHTML; new Ajax.Updater('div2', '/listlevel.thtml', { parameters: { id: id }}); } listlevel.thtml is a views and in the same directory than the index.thml index.thtml h1Secteur/h1 ?php echo $ajax-div('div1'); echo $html-link(Ajouter un secteur, /sectors/add); $i=0; echoselect size='10'; foreach($sector as $sectors): $id=name.$i; echooption id=.$id. onclick=updateopt('.$id.');. $sectors['Sector']['name']./option; $i++; endforeach; echo '/select'; echo $ajax-divEnd('div1'); echo $ajax-div('div2'); echo $ajax-divEnd('div2'); ? error onclick event : Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 localhost 04/23/08 16:11:12 Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5 Prehaps /listlevel.thtml isn't found ANYBODY can help me Thanks you --~--~-~--~~~---~--~~ 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: Problem with ajax
mkaelkael wrote: ... listlevel.thtml is a views and in the same directory than the index.thml Don't know if it's right to refer directly to a thtml file, but try remove the initial slash from /listlevel.. so linking to listlevel... Bye Davide -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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: Possible Bug Identified - Re: belongsTo relationship killing my app
Actually this sounds like the problem I was describing in my post: http://groups.google.com/group/cake-php/browse_thread/thread/ea10ef81a0d82741# And effectively, it looks like a problem in Cake handling some two- word table relationships. The problem I had was with tables called users and user_types, Users table has a field called user_type_id that is a FK to user_types table. If I keep this naming convention Cake wont automatically pick up the user types. Instead if I change things to usertypes and usertype_id and get the model renamed from UserType to Usertype the thing works as expected. :P --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cake 1.2 not making instances of classes as expected.
Hello all, I am a seasoned developer and have been building apps with Cake for some time. Today I came up against a bug that I cannot figure out - Cake just STOPPED working. I'm using the 1.2 beta on php 5.x and all has been well throughout this dev. However, I moved a block of code into the AppController file to make it available to everything and it was a bit buggy. So, I moved it back to where it came from... that's all. Now I am getting a fatal error: Call to a member function findByUri() on a non-object in C:\Program Files\Zend\Apache2\htdocs\app\app_controller.php on line 52 In spite of this: var $uses = array('Page', 'User', 'PageModule', 'News', 'Location', 'Content', 'UserLocation'); ...and in spite of the fact it was working fine before! As I said, I know what I'm doing and I cannot understand why Cake isn't creating an instance of the Page model - or any classes for that matter: the problem exists for components as well. Here is the (abridged) beforeRender() method I'm using for this: function beforeRender() { // see if there's any $bodytext set to pass into the page along with the dynamic title $q = $this-Page-findByUri(str_replace('/', '', $this- params['url']['url'])); // line 52 if (!empty($q)) { $q = $this-Content-findById($q['Page']['content_id']); $this-set('pagetitle', $q['Content']['title']); $this-set('bodytext', $q['Content']['body']); } } I am desperate to get to the bottom of this... has anyone experienced this before? I really need a hand here! I have (somewhat desperately!) reinstalled Cake's Core, restarted my machine (in the hope that PHP itself was the culprit!) and looked everywhere for the cause of the bug. No joy. The full AppController file is pasted at the bottom of this message. Looking forward to your responses, Matt --- ?php class AppController extends Controller { var $components = array('ObAuth', 'Email', 'Notification', 'Submenu', 'Cookie', 'RequestHandler', 'Session'); var $uses = array('Page', 'User', 'PageModule', 'News', 'Location', 'Content', 'UserLocation'); var $helpers = array('Html', 'Form', 'Ajax', 'Session', 'Javascript', 'Crumb'); var $defaultLocation = 'London'; var $defaultExpiry = 31556926; function __construct() { parent::__construct(); // Import this [abstract] class WITHOUT instantiating an object App::import('model', 'LookupModel'); } function beforeFilter() { if ($this-referer() != '/users/login' $this-here != '/users/ login') $this-Session-write('UberReferer', $this-here); // Only instantiate if it doesn't already exist.. if (!isset($this-ObAuth)) $this-ObAuth = new ObAuthComponent(); // Just in case it hasn't been started up (Which it hasn't it seems, at beforeFilter() stage) $this-ObAuth-startup($this); if (!$loc = $this-Cookie-read('userLocation')) { $q = $this-Location-findByName($this- defaultLocation); $locationId = $q['Location']['id']; } else { $locationId = $loc; } // hard code user data until we have some test users if (!$this-ObAuth-getUserId()) { $this-userLocation = $locationId; } else { $q = $this-User-findById($this-ObAuth- getUserId()); $this-userLocation = !empty($q['User'] ['location_id']) ? $q['User']['location_id'] : $locationId; } // set user id for the app $this-userId = $this-ObAuth-getUserId(); } function beforeRender() { // see if there's any $bodytext set to pass into the page along with the dynamic title $q = $this-Page-findByUri(str_replace('/', '', $this- params['url']['url'])); if (!empty($q)) { $q = $this-Content-findById($q['Page']['content_id']); $this-set('pagetitle', $q['Content']['title']); $this-set('bodytext', $q['Content']['body']); } // App-wide admin protection function. Override it if you want.. if (eregi('admin_', $this-params['action'])) { $this-layout = 'admin'; $this-ObAuth-lock('admin'); } // set the modules that are available for this section
Re: Ajax::observeField
A strange thing regarding this topic. I can't understand where's the problem. Everytime I call the method with the observeField, all my Session data is lost and so I'm disconnected. It's the first time I'm using Ajax+AjaxHelper+Cake, so I could do something wrong. When I remove the observeField call, everything is fine. Here is the code of the methods: ?php // app/controllers/projects_controller.php class ProjectsController extends AppController { ... function beforeFilter(){ parent::beforeFilter(); array_push($this-helpers,ajax); } ... function webAlias(){ if(isset($this-data[Project][name])){ $this-layout = ajax; $this-autoRender = false; echo $this-_webAlias($this-data[Project][name]); } } } ? ?php /* * /app/app_controller.php */ class AppController extends Controller { ... function beforeFilter(){ parent::beforeFilter(); $aro = ALL; if($this-Session-check(ID)){ $aro = $this-Session-read(ARO); } if(isset($this-params[controller]) isset($this-params[action])){ if($this-checkAccess($this-params[controller],$this-params[action],$aro)){ }else{ $this-redirect(/pages/denied); exit; } } } /** * return a web alias starting from a provied string * * @param $string the provided string to be parsed * @return the translated string */ function _webAlias($string){ $ret = trim(strtolower($string)); $ret = preg_replace(/[ ]/,-,$ret); $ret = preg_replace(/^[-]+/,,$ret); $ret = preg_replace(/[-]+\$/,,$ret); $ret = preg_replace(/[^a-z0-9-]/,,$ret); return $ret; } ... } ? -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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: Ajax::observeField
On Wed, Apr 23, 2008 at 11:37 AM, Davide [EMAIL PROTECTED] wrote: A strange thing regarding this topic. I can't understand where's the problem. Everytime I call the method with the observeField, all my Session data is lost and so I'm disconnected. You might have to change some stuff in your config/core.php file. Look for Session.checkAgent Often you have do Configure::write('Session.checkAgent', false); to preserve sessions when using Ajax Hope that helps. -- 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 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: Ajax::observeField
Chris Hartjes wrote: You might have to change some stuff in your config/core.php file. Look for Session.checkAgent Often you have do Configure::write('Session.checkAgent', false); to preserve sessions when using Ajax Session.checkAgent is not defined in my core.php. I tried defining it define(Session.checkAgent,false); and call the Configure::write function webAlias(){ if(isset($this-data[Project][name])){ Configure::write('Session.checkAgent', false); $this-layout = ajax; $this-autoRender = false; echo $this-_webAlias($this-data[Project][name]); } } But none of them worked. Some other ideas? Cake version 1.1.18. -- Live life like you're gonna die. Because you're gonna. William Shatner --~--~-~--~~~---~--~~ 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: Session problem
Did you ever find a solution to this? I think I am experiencing a similar problem. I can write to a session variable, but I can only read the valid value if I do so before the action completes. Once the action completes and a new one is called, the session information is gone. I am extremely new to cake and would love to know the solution. Thanks! On Apr 17, 3:03 pm, Ramiro Araujo [EMAIL PROTECTED] wrote: I still have not succeded in this... The strange thing is that im using the Auth component, and im pretty sure It uses sessions. What I dont know if it uses them with $_SESSION or with thesession component, but I would bet for the second. Quite strange.. I'll try in other cake instalations around and see. On Apr 15, 10:38 am, Ramiro Araujo [EMAIL PROTECTED] wrote: Hi, thanks! here it is: Configure::write('Session.save', 'php'); //also tried with 'cake' Configure::write('Session.cookie', 'CAKEPHP'); Configure::write('Session.timeout', '120'); Configure::write('Session.start', true); Configure::write('Session.checkAgent', true); //also tried with false Configure::write('Security.level', 'low'); Right now im asigning with $_SESSION and reading withSession Component :D hahahah Thanks for the help! On Apr 14, 3:58 pm, b logica [EMAIL PROTECTED] wrote: How is your core.php configured? Post what you have for all Configure::write('Session.*', '...') and whether they are uncommented or not. On Mon, Apr 14, 2008 at 1:35 PM,RamiroAraujo [EMAIL PROTECTED] wrote: Hi. Im having a strange problem, and couldn't find any solution or anyone with a similar problem... Its quite simple: same controller, 2 methods: function sessionWriteTest ($key, $value) { $this-Session-write($key, $value); } function sessionReadTest ($key) { debug($this-Session-read($key)); } doesnt work... modifying the method sessionWriteTest like this, works: function sessionWriteTest ($key, $value) { $_SESSION[$key] = $value; } Am I missing something really simple? My config is set quite default, temp directories are chmod 777, and normalsessionhandling works! Thanks! --~--~-~--~~~---~--~~ 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: Ajax::observeField
On Wed, Apr 23, 2008 at 11:52 AM, Davide [EMAIL PROTECTED] wrote: Some other ideas? Cake version 1.1.18. D'oh -- that stuff I posted is Cake 1.2 specific. I don't use Cake 1.1 at all, so can't help you there. -- 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 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 -~--~~~~--~~--~--~---
Simple Ajax issue
Hi all, I'm trying myself with some ajax ... My problem is simple : I want to insert in a page the rendered view of an action (which contain an ajax pagination). To do that, I use requestAction() method. Right now, it works fine. But I want to use a different layout for the action if it is an ajax request. How can I do that ? Using $this-RequestHandler-isAjax() doesn't let me know if the action was requested normally or by requestAction() ! Thank a lot ! --~--~-~--~~~---~--~~ 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: Simple Ajax issue
Ok, I'm sorry ... I just found the $this-params['requested'] method which make what I want :) Codially, Neveldo : http://www.neveldo.fr --~--~-~--~~~---~--~~ 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: Why custom model functions inside plugin models are not called?
Thanks. I knew I was doing something slightly wrong, but since what I had worked, I sort of left it alone. -Aran On Apr 22, 2:14 pm, biesbjerg [EMAIL PROTECTED] wrote: Hi Aranworld, You should use var $belongsTo = array('Comment' = array('className' = 'PluginName.Comment')) On Apr 22, 9:02 pm, aranworld [EMAIL PROTECTED] wrote: Here is what I had to do: in pluginname/models/article.php App::import('Model', 'Pluginname.Comment'); class Article extends PluginnameModel { $belongsTo = array('Comment'); } Now in pluginname/controllers/articles_controller.php I do $uses = array('Pluginname.Article'); On Apr 21, 3:59 pm, Max [EMAIL PROTECTED] wrote: Consider a scenario: In file /app/controllers/users_controller.php //review is the plugin model which is here: /app/plugins/reviews/ models/review.php var $uses = array('User', 'Review'); function getUserReviews() { $reviews = $this-Review-getRecent(); //this will throw sql error.. anyone knows a reason? findAll() still works } On the other hand, if in bootstrap.php, I manually modify $modelPaths array to add the model location. It works just fine. I dont like this hack however... uses('Folder'); $Folder = new Folder(APP.'plugins'); $plugins = $Folder-ls(); foreach($plugins[0] as $plugin) { array_push($modelPaths, APP.DS.'plugins'.DS.$plugin.DS.'models'.DS); } Abhimanyu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Having unusual problem with Model-del() in CakePHP 1.2
Hi, I'm having a very strange problem with Model-del() in CakePHP 1.2. I've not experienced this before. This code worked well on 1.1, but I can't see how a porting issue could have come into play here. Here is my code: $this-Resource-del($id); // where id is provided as an argument to the function, but = 35 in this particular case And the output: Query: DELETE `Resource` FROM `resources` AS `Resource` WHERE `Resource`.`id` IN (35) Warning (512): SQL Error: 1064: You have an error in your SQL syntax near 'Resource` FROM `resources` AS `Resource` WHERE `Resource`.`id` IN (35) ' at line 1 [CORE\cake\libs\model\datasources\dbo_source.php, line 440] Any ideas? Thanks in advance... Dave --~--~-~--~~~---~--~~ 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: Simple Ajax issue
... but I've now another problem :p Is it possible to load a view which is not the default view of the action ? I try by using $this-view or $this-load-view, but it seems to doesn't work :( thank ! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Format date field in 3 select
Hi everybody, I'm searching for a day how format a date field from Mysql (-MM-- DD) to 3 form's selects: - date from mysql : 2008-04-23 - my form fields are build like this: for ($i=0;$i11;$i++) { $form-day('DixDate.'.$i.'.date',null,array('id'='date-sel'.$i.'- dd')).'-'. $form-month('DixDate.'.$i.'.date',null,array('id'='date-sel'.$i.'- mm')).'-'. $form-year('DixDate.'.$i.'.date','1900',$current_year,null) } I'm using day, month, year instead of input() because I'm using a date picker that is need a special DOM id to work. How can I pass the day value, the month value and year value for each field? Must I do a substr() on each of my date? I hope my message is understandable... Thanks for 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 -~--~~~~--~~--~--~---
Does CakePHP's ACL have anything like Zend_Acl's Assert functionality?
Does CakePHP's ACL have anything like Zend_Acl's Assert functionality? http://framework.zend.com/manual/en/zend.acl.advanced.html Our application will have a large number of business rules, which we need to limit access based on various non-constant criteria. If not built into cake's ACL, could anyone suggest a way to incorporate it? Thanks! --~--~-~--~~~---~--~~ 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: php4 auto-validation
Yes it is present. I doubled checked with different classes ... and finally realized that this is issue is only present when I try to validate some model with HABTM relations ... IS this a known issue? Hugues On Apr 23, 1:49 am, Fran Iglesias [EMAIL PROTECTED] wrote: El 23/04/2008, a las 8:40, Hugues escribió: Anyone already addressed this issues so far? First of all, check the class var $name in your models and controllers. It is needed for php4 compatibility, For exemaple: class Post extends AppModel { var $name = 'Post'; } if not present, the application fails with no messagges or with apparently unrelated warnings. Hope that helps. -- Fran Iglesias [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: Simple Ajax issue
if you need use a view of the same controller try with: $this-render('name_of_view'); but remember only if you need use a view of the controller if you want render a element or a view in of other controller try this $this-viewPath = 'route_of_view_folder'; $this-render('name_of_view'); ex: $this-viewPath = 'elements'.DS.'header'; $this-render('navigation); or $this-viewPath = 'posts'; $this-render('comment'); On 4/23/08, Neveldo [EMAIL PROTECTED] wrote: ... but I've now another problem :p Is it possible to load a view which is not the default view of the action ? I try by using $this-view or $this-load-view, but it seems to doesn't work :( thank ! -- Axel --~--~-~--~~~---~--~~ 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: Validation Problem
Thanks, I understand what you are saying but what I need is to be able to edit mutliple items at once. For example if I have to edit 20 countries, clicking on every one, editing it and saving it would take me alot more time then selecting the ones I need to edit and having them presented in 1 page to be edited and saved. I also need to validate them but, for example, being all Country.name I don't know how to obtain this. For the part about the parser, Thanks! I'm pretty new to php and cakephp, but willing to learn. On Apr 22, 6:49 pm, b logica [EMAIL PROTECTED] wrote: You might find it simpler to, instead creating a form, to put links around the country names pointing to an edit method. In the edit view, create one form to edit the table fields and one form to delete. So you have something like: h1Edit Canada/h1 echo $form-create('Country', array('action' = 'delete'); echo $form-hidden('Country.id', array('value' = $some_var)); echo $form-submit('delete'); echo $form-end(); echo $form-create('Country', array('action' = 'edit'); ... echo $form-submit('edit'); echo $form-end(); This way, each action points directly to the corresponding method and you only have to deal with one item at a time. I realise that this may not be practical but it may work for you. Regarding $some_var above, your code appears to assume that the country IDs names are going to line up with your counter var $i. I may be missing something but that looks odd to me. I'd think it's be better (if your $countries array is constructed as $id = $name) to do it with a while like so: foreach ($countries as $key = $name) { $html-link($name, countries/edit/${id}); } I've used my link suggestion but it's just as applicable to a form setup like you have. BTW, in your views, you don't need to put ?php ... ? around every line. If you don't have any HTML markup to add then you can just open a block: ?php echo $form-create(array('url'='/countries/process')); for($i =0; $i$countries; $i++) { echo $form-hidden('Country'.$i.'.Country.id'); echo $form-input('Country'.$i.'.Country.name'); } echo $form-submit('Save', array('name'='save')); echo $form-end(); ? Otherwise, you're making the parser (and anyone who has to look at your code) work a lot harder than necessary ;-) --~--~-~--~~~---~--~~ 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: Cakephp 1.2 Schema could not be loaded
I updated CakePHP 1.2 of latest nightly built version. The command, cake acl initdb, has revived. Successfully the above 3 tables will be created. --~--~-~--~~~---~--~~ 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: Router::queryString issue in 1.2 beta
On Wed, Apr 23, 2008 at 2:04 PM, phpappdev256 [EMAIL PROTECTED] wrote: Possible Solutions: - Modify Router::queryString and have it pass a default delimiter - Modify http_socket-httpSerialize($data) function to call http_build_query() directly with a delimiter File a ticket on trac.cakephp.org -- 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 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 -~--~~~~--~~--~--~---
Router::queryString issue in 1.2 beta
I don't know if this has been addressed yet, but this is a problem... In router.php the method queryString uses http_build_query($q). There are 2 problems... 1) http_build_query is a PHP5-only function 2) the delimiter is not passed in the router function, so it defaults to arg_separator.output = amp; So when you are writing a datasource that uses http_socket, it will use amp; to separate the Http-post($url, $data_array); This causes problems for some websites. Possible Solutions: - Modify Router::queryString and have it pass a default delimiter - Modify http_socket-httpSerialize($data) function to call http_build_query() directly with a delimiter http://www.php.net/http_build_query http://www.php.net/manual/en/ini.core.php#ini.arg-separator.output --~--~-~--~~~---~--~~ 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: Combine and compress js / css..
Thanks i fouind this one seems quite good.. the one from bradleyboy looks ok too.. except it did not work with latest version of cake. http://sandbox2.pseudocoder.com/demo/asset The only thing that i had a hard time was with prototyope.. it will not work with jsmin... so i found a cope of: protoaculous.1.8.1.min.js http://groups.google.com/group/prototype-core/files Which is allready compressed and work with jsmin :D Also what is kinda annoying is that the css by default is put in a packed dir.. but then images will not work anymore.. i put them now in css dir but maybe i will put the in a packed dir in the root later on :P On Apr 23, 10:15 am, Grant Cox [EMAIL PROTECTED] wrote: Check out the following links: http://bakery.cakephp.org/articles/view/jsmin-helper-compress-and-cac...http://bakery.cakephp.org/articles/view/automatic-javascript-and-css-...https://trac.cakephp.org/ticket/2233http://blog.bradleyboy.com/2007/07/28/assetpackager-for-cakephp/ On Apr 23, 4:53 am, Mech7 [EMAIL PROTECTED] wrote: Does anybody know a way to get this script working with Cake.. http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_com... I think because the cake url rewrite it does not work by default :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Changing username of Authenticated user
I've got a section where I'd like to let a user change their username, with something like: e.g. $this-Auth-user('username') = $this-data['User']['name']; However this gives an error, is there a way to do this properly? Zoltan www.YYZtech.ca --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$this-data disappearing
I am doing print_r($this-data) in my appController in the beforeFilter() and I get: Array ( [User] = Array ( [username] = kyle [password] = sample ) ) but when I do it in the UsersContoller in the login() I get: Array ( [User] = Array ( [username] = kyle ) ) Does anyone know why password data is disappearing? --~--~-~--~~~---~--~~ 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: Combine and compress js / css..
Also there is this built on top of the packer http://marcgrabanski.com/code/asset-mapper/ On 23/04/2008, Mech7 [EMAIL PROTECTED] wrote: Thanks i fouind this one seems quite good.. the one from bradleyboy looks ok too.. except it did not work with latest version of cake. http://sandbox2.pseudocoder.com/demo/asset The only thing that i had a hard time was with prototyope.. it will not work with jsmin... so i found a cope of: protoaculous.1.8.1.min.js http://groups.google.com/group/prototype-core/files Which is allready compressed and work with jsmin :D Also what is kinda annoying is that the css by default is put in a packed dir.. but then images will not work anymore.. i put them now in css dir but maybe i will put the in a packed dir in the root later on :P On Apr 23, 10:15 am, Grant Cox [EMAIL PROTECTED] wrote: Check out the following links: http://bakery.cakephp.org/articles/view/jsmin-helper-compress-and-cac...http://bakery.cakephp.org/articles/view/automatic-javascript-and-css-...https://trac.cakephp.org/ticket/2233http://blog.bradleyboy.com/2007/07/28/assetpackager-for-cakephp/ On Apr 23, 4:53 am, Mech7 [EMAIL PROTECTED] wrote: Does anybody know a way to get this script working with Cake.. http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_com. .. I think because the cake url rewrite it does not work by default :( --~--~-~--~~~---~--~~ 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: Combine and compress js / css..
Hey Mech7, The asset helper is my code. Sorry about the whole packed directory image thing. It's definitely something to be fixed. I generally use absolute paths in the css files, so it hasn't been a high priority for me to fix. -Matt www.pseudocoder.com On Apr 23, 2:31 pm, Mech7 [EMAIL PROTECTED] wrote: Thanks i fouind this one seems quite good.. the one from bradleyboy looks ok too.. except it did not work with latest version of cake. http://sandbox2.pseudocoder.com/demo/asset The only thing that i had a hard time was with prototyope.. it will not work with jsmin... so i found a cope of: protoaculous.1.8.1.min.js http://groups.google.com/group/prototype-core/files Which is allready compressed and work with jsmin :D Also what is kinda annoying is that the css by default is put in a packed dir.. but then images will not work anymore.. i put them now in css dir but maybe i will put the in a packed dir in the root later on :P On Apr 23, 10:15 am, Grant Cox [EMAIL PROTECTED] wrote: Check out the following links: http://bakery.cakephp.org/articles/view/jsmin-helper-compress-and-cac... On Apr 23, 4:53 am, Mech7 [EMAIL PROTECTED] wrote: Does anybody know a way to get this script working with Cake.. http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_com... I think because the cake url rewrite it does not work by default :( --~--~-~--~~~---~--~~ 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: Changing username of Authenticated user
Hey, Shouldn't you change it in db and update the auth data from the db ? look at Auth/session how the data is stored. HTH, On Wed, Apr 23, 2008 at 8:38 PM, Zoltan [EMAIL PROTECTED] wrote: I've got a section where I'd like to let a user change their username, with something like: e.g. $this-Auth-user('username') = $this-data['User']['name']; However this gives an error, is there a way to do this properly? Zoltan www.YYZtech.ca -- Marcin Domanski http://kabturek.info --~--~-~--~~~---~--~~ 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: $this-data disappearing
are you using the AuthComponent ? afaik Auth unsets the password data after login. HTH, On Wed, Apr 23, 2008 at 9:10 PM, Kyle Decot [EMAIL PROTECTED] wrote: I am doing print_r($this-data) in my appController in the beforeFilter() and I get: Array ( [User] = Array ( [username] = kyle [password] = sample ) ) but when I do it in the UsersContoller in the login() I get: Array ( [User] = Array ( [username] = kyle ) ) Does anyone know why password data is disappearing? -- Marcin Domanski http://kabturek.info --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Elementary Data Validation??
I have a form for which the following validation rules don't work. There are other validation rules that do work including a custom regular expression which makes me wonder if it is the fact that these are not text inputs that is the problem. Any help is greatly appreciated! Jee My code is as follows: var $validate = array( //SELECT form field: Must exist and be two capital letters, eg CA 'state' = array( 'alphanumeric' = array( 'rule' = array('custom', '/[A-Z]{2}$/i'), 'required' = true ) ), //SELECT form field: Must exist and be numeric greater than 0 'referral_id' = array( 'referral_id_required' = array( 'rule' = array('comparison', '=', 1), 'required' = true ) ), //CHECKBOX form field: Must exist and == true 'agreed_to_terms' = array( 'agreed_to_terms_required' = array( 'rule' = array('comparison', '=', 1), 'required' = true ) ) ); --~--~-~--~~~---~--~~ 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: cake and JS question
Try addScript() - http://api.cakephp.org/1.2/class_view.html#42c9e03d9fa609bd09d9530d9ee8266b You can use it like that: ?php $this-addScript($javascript-link(array('jquery','ui.tabs'))); ? ?php $this-addScript($javascript-codeBlock('$(function() { $ (#album-data ul).tabs(); });')); ? ?php $this-addScript($html-css(array('ui.tabs'))); ? T+ On Apr 22, 6:15 am, . [EMAIL PROTECTED] wrote: in cake 1,2 How do you add a javascript function in just one of my views? I don't want to put it in the layout because i don't need the JS in all of the pages. There are 2 cases: 1. I want to add echo $javascript-link(array(js_file)); to one of my view ctp file 2. I want to add a body onload=JS function to on of my pages How would I achieve the above without creating a new layout ctp file? Thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Forms that add/edit Multiple Models part II
Can anyone give me any suggestions for adding and editing multiple models from one form in Cake 1.2? I found a post on the topic here: http://groups.google.com/group/cake-php/browse_thread/thread/77183ca04771e348 but I get the following when I attempted it: === Warning (512): (Model::validates) Parameter usage is deprecated, use Model::set() to update your fields first [CORE/cake/libs/model/ model.php, line 2018] Warning (512): (Model::invalidFields) Parameter usage is deprecated, set the $data property instead [CORE/cake/libs/model/model.php, line 2051] Following the first logical step, I replaced validates() with set() which cleared up the Warnings, but did not actually validate the fields. I wish I knew enough about cake to even come up with a second logical step! :) Suggestions? Thanks, Jee --~--~-~--~~~---~--~~ 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: Simple Ajax issue
Thank Axel, this is what I'm looking for ! In fact, I need for one action an normal view and an ajax view ! thank ! Cordially, Neveldo : http://www.neveldo.fr --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
problems with scaffolding after submit
Hi, I'am experimenting with the blog tutorial from cookbook in the cakephp 1.2.0.6311 I tried to change the tutorial controller to a scaffolded one in posts_controller.php: ?php class NotesController extends AppController { var $scaffold; } ? Everything is working fine up to the moment when I submit an edited post. Then the browser is redirected to a page with only an unstyled message about the sql queries performed and nothing more. The html code of this page is missing even the html tag. To return to the list I've to press several times the back button. I'd expect some message saying the post was updated with link back to the list. I guess the obtained behavior is a bug or I'm doing something wrong? Thanks --~--~-~--~~~---~--~~ 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: Possible Bug Identified - Re: belongsTo relationship killing my app
Hi Aaron Given that this problem has only turned up in the the last release of 1.1 (the site was working happily prior to that), moving to 1.2 would be overkill (just refactoring alone would take weeks of work). For now I am moving back to an earlier release, but I would rather find the bug and fix it thus improving Cake. Regards, Langdon aaron bauman wrote: I'm using cake 1.2 and i have many 2 or 3 word models with abundant belongsTo relationships and I haven't run into this problem. jump on the bandwagon /a On Apr 22, 8:27 pm, Langdon Stevenson [EMAIL PROTECTED] wrote: I have finally nailed down the issue and am pleased to find that I am not going mad after all. It appears that when a model with a two word name (like FooBar1) is loaded by a hasMany relationship and has a belongsTo relationship to the parent that loaded it then PHP will fail and return a blank page. If you run the same test with the same name but make it one word (like Foobar2) then it works fine. Another interesting point to note is that if you have models called FooBar and Foobar together then it works too. Ultimately it appears that Cake is not handling the belongsTo relationship with names with two words. I have set up a completely new copy of Cake and reproduced the problem with it. This has (mostly) ruled out anything in my application or its setup as being the problem (I haven't tried it on another server). The error is reproducible using the following process: 1. Configure a clean copy of Cake 1.1.19.6261 to use a database (doesn't matter which) 2. Create: app/controllers/trials_controller.php - ?php Class trialsController extends Controller { var $uses = array('FooBar1', 'Foobar2'); function index () { }} ? app/model/foo_bar1.php -- ?php Class FooBar1 extends Model { var $name = 'FooBar1' var $useTable = 'some_table1'; var $hasMany = array('EenyMeeny');} ? app/model/eeny_meeny1.php - ?php Class EenyMeeny1 extends Model { var $name = 'EenyMeeny1' var $useTable = 'some_table2'; var $belongsTo = array('FooBar1');} ? app/model/foobar2.php - ?php Class Foobar2 extends Model { var $name = 'Foobar2' var $useTable = 'some_table1'; var $hasMany = array('Eenymeeny2');} ? app/model/eenymeeny2.php ?php Class Eenymeeny2 extends Model { var $name = 'Eenymeeny2' var $useTable = 'some_table2'; var $belongsTo = array('Foobar2');} ? app/views/trials/index.thtml Some text. Try to view: http://yourserver/trials/index The result will be a blank screen. However if you remove the hasMany entry for FooBar1 ?php Class trialsController extends Controller { var $uses = array('Foobar2'); function index () { }} ? and try again, you will get the default layout with Some text. Displayed. I think that this demonstrates the problem effectively. The next question is: how to fix it? I am assuming that this is a bug in the core model code. I have spent some time looking, but don't know enough about the core code it to be able to see where the problem is occurring. Any suggestions welcome. If I can identify where the problem is occurring, then I will look into submitting a patch. Regards, Langdon Langdon Stevenson wrote: I have a very strange problem appeared with a site that I have been working on for some time. This site is built with Cake version 1.1.19.6305 running on Apache/MySQL/Linux with PHP 5. The site has about 30 models, most have multiple hasMany relationships. Each of those relationships have a corresponding belongsTo from the child to the parent. This has all worked fine with no problem in the past. I went to test some functionality today that I haven't touched for a while and discovered that any model that is loaded that has a belongsTo relationship with a model that has already been loaded caused a blank page to be returned. No Cake debug output, no error in Apache logs, just nothing at all. Eventually I removed all of the belongsTo relationships in the chain of models for one of the pages with the problem. The page now loads fine. But if I add back in any belongsTo relationship it breaks again. I am stumped by this. I have reviewed all of the models to make sure that one isn't corrupt (trailing space issue for instance). Can't find anything of that nature. If anyone can suggest anything I would be very grateful. Regards, Langdon --~--~-~--~~~---~--~~ 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
Re: Possible Bug Identified - Re: belongsTo relationship killing my app
Hi DF It would be interesting to see if that problem still presents in a previous release of 1.1. It certainly sounds like they are related. Regards, Langdon DyingFetus_666 wrote: Actually this sounds like the problem I was describing in my post: http://groups.google.com/group/cake-php/browse_thread/thread/ea10ef81a0d82741# And effectively, it looks like a problem in Cake handling some two- word table relationships. The problem I had was with tables called users and user_types, Users table has a field called user_type_id that is a FK to user_types table. If I keep this naming convention Cake wont automatically pick up the user types. Instead if I change things to usertypes and usertype_id and get the model renamed from UserType to Usertype the thing works as expected. :P --~--~-~--~~~---~--~~ 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: testing with phpunit
Why CakePHP choose SimpleTest for their Test Suite? Because, I wanna use PHPUnit too. PHPUnit has a extension called Selenium that test web applications (html, javascript, ajax, etc... website). I'ts perfect for Web 2.0!!! Well ... Why CakePHP choose SimpleTest for their Test Suite? []'s On Mon, Apr 14, 2008 at 9:59 AM, Jay [EMAIL PROTECTED] wrote: Yes. I have to use continuous integration server XINC, which uses phpunit, so I have to. Anybody with alternate solution? -- Regards, Jay On Apr 14, 4:10 pm, the_woodsman [EMAIL PROTECTED] wrote: Is PHPUnit essential? Cake's built in testing uses SimpleTest, which is, to my knowledge, comparable to or better than PHPUnit. On Apr 14, 6:50 am, Jay [EMAIL PROTECTED] wrote: Hi, Can anybody explain me how to test cakephp in phpunit. If any example, then it would be great. -- Thanks Regards, Jay -- Renan Gonçalves - Software Engineer Cell Phone: +55 11 8633 6018 MSN: [EMAIL PROTECTED] São Paulo - SP/Brazil --~--~-~--~~~---~--~~ 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: Validation Problem
I'm a dough-head. Sorry, I didn't read your post correctly. But, would you really need to change the name f any countries? Those don't change too often. And when one did, I'd think you'd want to update the main DB record for it rather than the association to some other model. If what you want to do is to update the list of associated countries to your model, you could do: $form-select('Country.Country', $countries, null, array('class' = 'Required', 'multiple' = 'checkbox')); (note the double Country--that's important) This will create checkboxes for each country. I can't remember, offhand, how to make the associated ones checked (sorry). Your $countries var would be an array gotten from a find('list') call in the controller. Or, you could replace it with $this-requestAction('Countries/getList') if you had an appropriate controller/action for that. On Wed, Apr 23, 2008 at 1:57 PM, plinto [EMAIL PROTECTED] wrote: Thanks, I understand what you are saying but what I need is to be able to edit mutliple items at once. For example if I have to edit 20 countries, clicking on every one, editing it and saving it would take me alot more time then selecting the ones I need to edit and having them presented in 1 page to be edited and saved. I also need to validate them but, for example, being all Country.name I don't know how to obtain this. For the part about the parser, Thanks! I'm pretty new to php and cakephp, but willing to learn. On Apr 22, 6:49 pm, b logica [EMAIL PROTECTED] wrote: You might find it simpler to, instead creating a form, to put links around the country names pointing to an edit method. In the edit view, create one form to edit the table fields and one form to delete. So you have something like: h1Edit Canada/h1 echo $form-create('Country', array('action' = 'delete'); echo $form-hidden('Country.id', array('value' = $some_var)); echo $form-submit('delete'); echo $form-end(); echo $form-create('Country', array('action' = 'edit'); ... echo $form-submit('edit'); echo $form-end(); This way, each action points directly to the corresponding method and you only have to deal with one item at a time. I realise that this may not be practical but it may work for you. Regarding $some_var above, your code appears to assume that the country IDs names are going to line up with your counter var $i. I may be missing something but that looks odd to me. I'd think it's be better (if your $countries array is constructed as $id = $name) to do it with a while like so: foreach ($countries as $key = $name) { $html-link($name, countries/edit/${id}); } I've used my link suggestion but it's just as applicable to a form setup like you have. BTW, in your views, you don't need to put ?php ... ? around every line. If you don't have any HTML markup to add then you can just open a block: ?php echo $form-create(array('url'='/countries/process')); for($i =0; $i$countries; $i++) { echo $form-hidden('Country'.$i.'.Country.id'); echo $form-input('Country'.$i.'.Country.name'); } echo $form-submit('Save', array('name'='save')); echo $form-end(); ? Otherwise, you're making the parser (and anyone who has to look at your code) work a lot harder than necessary ;-) --~--~-~--~~~---~--~~ 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: Format date field in 3 select
FormHelper's datetime input type already done exactly this. You don't have to manually put together the day/month/year fields. On Apr 23, 12:43 pm, avairet [EMAIL PROTECTED] wrote: Hi everybody, I'm searching for a day how format a date field from Mysql (-MM-- DD) to 3 form's selects: - date from mysql : 2008-04-23 - my form fields are build like this: for ($i=0;$i11;$i++) { $form-day('DixDate.'.$i.'.date',null,array('id'='date-sel'.$i.'- dd')).'-'. $form-month('DixDate.'.$i.'.date',null,array('id'='date-sel'.$i.'- mm')).'-'. $form-year('DixDate.'.$i.'.date','1900',$current_year,null) } I'm using day, month, year instead of input() because I'm using a date picker that is need a special DOM id to work. How can I pass the day value, the month value and year value for each field? Must I do a substr() on each of my date? I hope my message is understandable... Thanks for 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 -~--~~~~--~~--~--~---
Re: Does CakePHP's ACL have anything like Zend_Acl's Assert functionality?
Cake provides perfectly generic, free-form ACL rules. It has built-in support for controller or action based ACL via the Auth Component, but you don't need to use either. I have very fine grained ACOs, and use AROs as roles. When I do an ACL check, I can write something like $this-Acl- check('role1', 'users/address/mailing', 'read') to see if role1 has access to other users mailing address information. You don't have to limit yourself to controller/action or any of the other methods you'll find outlined in the Bakery. You can build your ACO/ARO trees however you like and the check function will be able to check against them. On Apr 23, 12:44 pm, mcjustin [EMAIL PROTECTED] wrote: Does CakePHP's ACL have anything like Zend_Acl's Assert functionality?http://framework.zend.com/manual/en/zend.acl.advanced.html Our application will have a large number of business rules, which we need to limit access based on various non-constant criteria. If not built into cake's ACL, could anyone suggest a way to incorporate it? Thanks! --~--~-~--~~~---~--~~ 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: Why custom model functions inside plugin models are not called?
Great info... Thanks a lot. On Apr 22, 11:38 pm, biesbjerg [EMAIL PROTECTED] wrote: I'll bet echo get_class($this-Review) will output 'AppModel'. The reason is you need to define $uses like this when accessing plugin models: var $uses = array('User', 'Reviews.Review'); You should do the same when creating associations within the plugin's models: PluginName.ModelName. Good luck. On Apr 22, 12:59 am, Max [EMAIL PROTECTED] wrote: Consider a scenario: In file /app/controllers/users_controller.php //review is the plugin model which is here: /app/plugins/reviews/ models/review.php var $uses = array('User', 'Review'); function getUserReviews() { $reviews = $this-Review-getRecent(); //this will throw sql error.. anyone knows a reason? findAll() still works } On the other hand, if in bootstrap.php, I manually modify $modelPaths array to add the model location. It works just fine. I dont like this hack however... uses('Folder'); $Folder = new Folder(APP.'plugins'); $plugins = $Folder-ls(); foreach($plugins[0] as $plugin) { array_push($modelPaths, APP.DS.'plugins'.DS.$plugin.DS.'models'.DS); } Abhimanyu --~--~-~--~~~---~--~~ 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: Possible Bug Identified - Re: belongsTo relationship killing my app
Rolling back to Cake version 1.1.5850 fixes this problem. There are a lot of changes to model code in the next revision and something in there breaks Cake as described below. My PHP knowledge is not strong enough to be able to work out the problem and successfully fix it. So if anyone familiar with the core model code feels like taking a look I would be grateful. Regards, Langdon Langdon Stevenson wrote: I have finally nailed down the issue and am pleased to find that I am not going mad after all. It appears that when a model with a two word name (like FooBar1) is loaded by a hasMany relationship and has a belongsTo relationship to the parent that loaded it then PHP will fail and return a blank page. If you run the same test with the same name but make it one word (like Foobar2) then it works fine. Another interesting point to note is that if you have models called FooBar and Foobar together then it works too. Ultimately it appears that Cake is not handling the belongsTo relationship with names with two words. I have set up a completely new copy of Cake and reproduced the problem with it. This has (mostly) ruled out anything in my application or its setup as being the problem (I haven't tried it on another server). The error is reproducible using the following process: 1. Configure a clean copy of Cake 1.1.19.6261 to use a database (doesn't matter which) 2. Create: app/controllers/trials_controller.php - ?php Class trialsController extends Controller { var $uses = array('FooBar1', 'Foobar2'); function index () { } } ? app/model/foo_bar1.php -- ?php Class FooBar1 extends Model { var $name = 'FooBar1' var $useTable = 'some_table1'; var $hasMany = array('EenyMeeny'); } ? app/model/eeny_meeny1.php - ?php Class EenyMeeny1 extends Model { var $name = 'EenyMeeny1' var $useTable = 'some_table2'; var $belongsTo = array('FooBar1'); } ? app/model/foobar2.php - ?php Class Foobar2 extends Model { var $name = 'Foobar2' var $useTable = 'some_table1'; var $hasMany = array('Eenymeeny2'); } ? app/model/eenymeeny2.php ?php Class Eenymeeny2 extends Model { var $name = 'Eenymeeny2' var $useTable = 'some_table2'; var $belongsTo = array('Foobar2'); } ? app/views/trials/index.thtml Some text. Try to view: http://yourserver/trials/index The result will be a blank screen. However if you remove the hasMany entry for FooBar1 ?php Class trialsController extends Controller { var $uses = array('Foobar2'); function index () { } } ? and try again, you will get the default layout with Some text. Displayed. I think that this demonstrates the problem effectively. The next question is: how to fix it? I am assuming that this is a bug in the core model code. I have spent some time looking, but don't know enough about the core code it to be able to see where the problem is occurring. Any suggestions welcome. If I can identify where the problem is occurring, then I will look into submitting a patch. Regards, Langdon Langdon Stevenson wrote: I have a very strange problem appeared with a site that I have been working on for some time. This site is built with Cake version 1.1.19.6305 running on Apache/MySQL/Linux with PHP 5. The site has about 30 models, most have multiple hasMany relationships. Each of those relationships have a corresponding belongsTo from the child to the parent. This has all worked fine with no problem in the past. I went to test some functionality today that I haven't touched for a while and discovered that any model that is loaded that has a belongsTo relationship with a model that has already been loaded caused a blank page to be returned. No Cake debug output, no error in Apache logs, just nothing at all. Eventually I removed all of the belongsTo relationships in the chain of models for one of the pages with the problem. The page now loads fine. But if I add back in any belongsTo relationship it breaks again. I am stumped by this. I have reviewed all of the models to make sure that one isn't corrupt (trailing space issue for instance). Can't find anything of that nature. If anyone can suggest anything I would be very grateful. Regards, Langdon --~--~-~--~~~---~--~~ 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
Re: Using pagination helper on a view element
Can I add to this and say ditto? On Apr 7, 10:19 pm, Juan Luis Baptiste [EMAIL PROTECTED] wrote: Hi, I'm trying to make a view element and reuse it in various views. The element uses the pagination helper, the problem is that the element can't see the paginator helper object: : Undefined variable: paginator [APP/views/elements/servers.ctp, line 7] If I add the helper to the uses variable of the controller which calls the action that includes the element on its view, then the helper is found but I get these errors: Warning (2): array_merge() [function.array-merge]: Argument #1 is not an array [CORE/cake/libs/view/helpers/paginator.php, line 139] The code of my element is something like the the following: $servers = $this-requestAction('servers/index/'); ? table cellpadding=0 cellspacing=0 tr th?= $paginator-sort('Server Name', 'name');?/th th?= $paginator-sort('IP Address', 'ip_address');?/th /tr ?php foreach ($servers as $server): ? tr td?= $server['Server']['name']; ?/td td?= $server['Server']['ip_address']; ?/td /tr ?php endforeach; ? /table ?php $paginate= $paginator-prev(' Previous ', null, null);? ?php $paginate.= $paginator-next(' Next ', null, null);? ?php $paginate.= 'br/'.$paginator-counter(); ? ?=$html-div(null,$paginate, array('align' = 'center')); ? on the view that includes it: echo $this-renderElement('servers'); and the controller action: function index($id = null) { $servers = $this-paginate('Server'); $this-set(compact('servers')); if(isset($this-params['requested'])) { return $servers; } } So how is the propper way to use the pagination helper on a view element ? Thanks. -- Juan Luis Baptiste --~--~-~--~~~---~--~~ 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: Why custom model functions inside plugin models are not called?
Can't we also load behaviors same way? Inside /app/models/video.php var $actsAs = array('Upload' = array('field' = 'video', 'type' = 'video', 'allowedMime'=array('video/*'), 'allowedExt' = array('avi','mpg','mpeg','3gp','wmv'), 'dir' = '{WWW_ROOT}{DS}uploads{DS}videos'), 'PluginName.Trackable' = array(), ); This trackable behavior is inside some plugin.. so, will it work? doesnt look like so. On Apr 24, 7:04 am, Max [EMAIL PROTECTED] wrote: Great info... Thanks a lot. On Apr 22, 11:38 pm, biesbjerg [EMAIL PROTECTED] wrote: I'll bet echo get_class($this-Review) will output 'AppModel'. The reason is you need to define $uses like this when accessing plugin models: var $uses = array('User', 'Reviews.Review'); You should do the same when creating associations within the plugin's models: PluginName.ModelName. Good luck. On Apr 22, 12:59 am, Max [EMAIL PROTECTED] wrote: Consider a scenario: In file /app/controllers/users_controller.php //review is the plugin model which is here: /app/plugins/reviews/ models/review.php var $uses = array('User', 'Review'); function getUserReviews() { $reviews = $this-Review-getRecent(); //this will throw sql error.. anyone knows a reason? findAll() still works } On the other hand, if in bootstrap.php, I manually modify $modelPaths array to add the model location. It works just fine. I dont like this hack however... uses('Folder'); $Folder = new Folder(APP.'plugins'); $plugins = $Folder-ls(); foreach($plugins[0] as $plugin) { array_push($modelPaths, APP.DS.'plugins'.DS.$plugin.DS.'models'.DS); } Abhimanyu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---