Cake using ODBC drivers
I'm building an application that will use some stored Semantic data and Virtuoso server is a Web/DB server and RDF data storage. To connect from php to Virtuoso's SQL I should use odbc_connect(). Guys, is there any chance that Cake can use Virtuoso SQL storage as its native storage through odbc_connect? I mean can I use all the advantages of Name conventions, ORM etc.? Best regards, Luka Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Calling the plugin after matching the token in the text
Hello, everyone, my question is not strictly CakePHP related but rather more general PHP question. Although, since I'm developing with CakePHP maybe there are conventions how to solve the problem... I want to have an option to dynamically include plugins or CakePHP elements after a token has been identified in the text. For example, my blog entry holds following string: {plugin_name}, What I want it to do is to trigger a plugin and insert its result instead of the token. This can be found in many CMSs so I was hoping to someone has idea how to solve this... Is it the right way to do preg_match whole db entry in order to achieve this? what about beforeRender() ? Thanks, Luka Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Validation from another model
Hi everyone. I'm really stuck here :) I have problem with displaying an error next to a form field of the form that is being validated in another model. I have two models: Products and Cart. Product_controller has VIEW action through which I can select product variant from drop down menu and change quantity of that product that's about to be added. Form action is Products/addToCart function which saves data into Cart model and than redirects back to Product::view. Validation of quantity field works fine in Cart model and I know this because it won't save() if validation fails. That way I can use setFlash() method to throw a error message to a user explaining that some error in validation occured but what I want is to make CakePHP show an error message (from $validate variable) next to my invalid field (quantity) when it redirects back to Product::view. Someone please help me because I'll be needing this quite often. I had similar problem with saving a Comment on a Post but now I ran into this problem once again and want to solve it, with your help of course ... Best regards Luka --~--~-~--~~~---~--~~ 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 validation
I have following models: Product, ProductVariant, Cart Product (hasMany ProductVariants ) ProductVariants (belongsTo Product Cart) Cart (hasMany ProductVariants) In my Product View action I have following form to add products to Cart table with session_id as identifier of whoes products are in cart: $form-create('Product',array ('action'='addToCart','id'='add','class'='form')); echo $form-input('quantity'); echo $form-submit(); echo $form-end(); There is also a Drop down menu in this form to choose a product variant id (SEX and SIZE) but for sake of simplicity I'm gonna leave it out. Now, first I had my addToCart action defined in cart_controloler but then I moved it to Products::addToCart. I want to validate my field quantity that it is a numeric value and if it's not I want error next to that input field. My Products::addToCart action looks like this: if($this-Product-ProductVariant-Cart-save($this-data,true)) { $this-Session-setFlash(__('Added to cart', true)); } else { $this-Session-setFlash(__('Problem!', true)); } $this-redirect(array('action'='view','id'=$this-data['Product'] ['product_id'])); No matter where I define my $validate variable (Cart or Product) my validation doesn't throw an error ?!? --~--~-~--~~~---~--~~ 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 validation
I changed if($this-Product-ProductVariant-Cart-save($this-data,true)) to if($this-Product-ProductVariant-Cart-save($this-data ['Product'],true)) and validation seems to be working but I don't get a message next to a quantity input field like I do elsewhere when validating form fields?! thanks On Nov 28, 7:40 pm, luigi7up [EMAIL PROTECTED] wrote: I have following models: Product, ProductVariant, Cart Product (hasMany ProductVariants ) ProductVariants (belongsTo Product Cart) Cart (hasMany ProductVariants) In my Product View action I have following form to add products to Cart table with session_id as identifier of whoes products are in cart: $form-create('Product',array ('action'='addToCart','id'='add','class'='form')); echo $form-input('quantity'); echo $form-submit(); echo $form-end(); There is also a Drop down menu in this form to choose a product variant id (SEX and SIZE) but for sake of simplicity I'm gonna leave it out. Now, first I had my addToCart action defined in cart_controloler but then I moved it to Products::addToCart. I want to validate my field quantity that it is a numeric value and if it's not I want error next to that input field. My Products::addToCart action looks like this: if($this-Product-ProductVariant-Cart-save($this-data,true)) { $this-Session-setFlash(__('Added to cart', true)); } else { $this-Session-setFlash(__('Problem!', true)); } $this-redirect(array('action'='view','id'=$this-data['Product'] ['product_id'])); No matter where I define my $validate variable (Cart or Product) my validation doesn't throw an error ?!? --~--~-~--~~~---~--~~ 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: Help with populating SELECT drop down
Sorry, all.. I found a simple solution with foreach() etc. so I didn't come back after my last post. thank you all. Ill try solution Alexander offers too... @ grigri: thanks for suc a explination. Gri gri is a belaying device if someone wondered :) bye On Nov 21, 1:15 pm, Alexandru Ciobanu [EMAIL PROTECTED] wrote: luigi7up wrote: @anja This solution works fine but I thought I could do it more elegant :) thanks @grigri I'll try this... I don't get it at first glance but I'll try it. It seems like something worth of try... I'll tell you how it went P.S. Username griGri has something to do with climbing device or not? On Nov 19, 12:24 pm, grigri [EMAIL PROTECTED] wrote: Hi Luka This sounds like a job for Set::combine() : ?php $options = Set::combine( $product['ProductVariant'], '{n}.id', array( '{0} | {1} - {2}', '{n}.sex', '{n}.size', '{n}.price' ) ); echo $form-select('variant', $options); ? hth grigri On Nov 19, 10:42 am, luigi7up [EMAIL PROTECTED] wrote: Hello I need help with populating drop down select element. I have following data in array $product that is available in my view Array ( [Product] = Array ( [id] = 1 [product_category_id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = nije_vuk_ovca [price] = 85 [special] = 0 [published] = 1 [created] = [modified] = 2008-11-07 11:56:06 ) [ProductVariant] = Array ( [0] = Array ( [id] = 1 [product_id] = 1 [sex] = male [size] = S [extras] = [price] = ) [1] = Array ( [id] = 2 [product_id] = 1 [sex] = male [size] = M [extras] = [price] = ) [2] = Array ( [id] = 3 [product_id] = 1 [sex] = male [size] = L [extras] = [price] = ) ) As you can see Product has it's variants because PRODUCT model hasMany PRODUCT_VARIANTS. In my product view I want drop down menu (SELECT) with all variants of product to be populated in following way: Isn't $this-Product-ProductVariant-find('list') what you're loooking for? I'm using something similar athttp://anunciostotal.net/ads/addto populate the subcategories and provinces select boxes. --~--~-~--~~~---~--~~ 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: Help with populating SELECT drop down
@Alexandre C. I tried your code but all I got is one field from database table: id My debug array looks like this: [1]= 1 [3]= 3 And what I need is: [1] = array(sex=male,size=L) I found something about using your method and then set::combine or something similar but this seems too complicated regarding to a nice simple solution with foreach($productVariant as $variant) bla...bla In other posts abou this they mentioned depreciated method generateList that would take other fields from database. So, it was something like combination of: find('all') and set::extract.. or so thank you for your precious time. You've been most helpful :) On Nov 21, 1:15 pm, Alexandru Ciobanu [EMAIL PROTECTED] wrote: luigi7up wrote: @anja This solution works fine but I thought I could do it more elegant :) thanks @grigri I'll try this... I don't get it at first glance but I'll try it. It seems like something worth of try... I'll tell you how it went P.S. Username griGri has something to do with climbing device or not? On Nov 19, 12:24 pm, grigri [EMAIL PROTECTED] wrote: Hi Luka This sounds like a job for Set::combine() : ?php $options = Set::combine( $product['ProductVariant'], '{n}.id', array( '{0} | {1} - {2}', '{n}.sex', '{n}.size', '{n}.price' ) ); echo $form-select('variant', $options); ? hth grigri On Nov 19, 10:42 am, luigi7up [EMAIL PROTECTED] wrote: Hello I need help with populating drop down select element. I have following data in array $product that is available in my view Array ( [Product] = Array ( [id] = 1 [product_category_id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = nije_vuk_ovca [price] = 85 [special] = 0 [published] = 1 [created] = [modified] = 2008-11-07 11:56:06 ) [ProductVariant] = Array ( [0] = Array ( [id] = 1 [product_id] = 1 [sex] = male [size] = S [extras] = [price] = ) [1] = Array ( [id] = 2 [product_id] = 1 [sex] = male [size] = M [extras] = [price] = ) [2] = Array ( [id] = 3 [product_id] = 1 [sex] = male [size] = L [extras] = [price] = ) ) As you can see Product has it's variants because PRODUCT model hasMany PRODUCT_VARIANTS. In my product view I want drop down menu (SELECT) with all variants of product to be populated in following way: Isn't $this-Product-ProductVariant-find('list') what you're loooking for? I'm using something similar athttp://anunciostotal.net/ads/addto populate the subcategories and provinces select boxes. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
About session_id
Hi all, can someone please tell me out of which session_id is made of? I need an answer because all of my visitor add products to a cart table and these entries must be unike for each visitor. What I mean is if visitor A adds 4 products to a cart within 2 hours or so they all have to be conected to him with value of his sessionID (custom made or not). When I was using pure PHP my (custom) session_id was generated as md5 (ip address, user agent, and acquired php sessionId ). That way I was pretty sure that 2 users will almost never get the same value I want to be sure that server/application will not generate same session id for at least 2 weeks. I don't know if this changes anything but y session handling in config is set to PHP and not Cake Can you provide me some guidance, please... 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 -~--~~~~--~~--~--~---
Help with populating SELECT drop down
Hello I need help with populating drop down select element. I have following data in array $product that is available in my view Array ( [Product] = Array ( [id] = 1 [product_category_id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = nije_vuk_ovca [price] = 85 [special] = 0 [published] = 1 [created] = [modified] = 2008-11-07 11:56:06 ) [ProductVariant] = Array ( [0] = Array ( [id] = 1 [product_id] = 1 [sex] = male [size] = S [extras] = [price] = ) [1] = Array ( [id] = 2 [product_id] = 1 [sex] = male [size] = M [extras] = [price] = ) [2] = Array ( [id] = 3 [product_id] = 1 [sex] = male [size] = L [extras] = [price] = ) ) As you can see Product has it's variants because PRODUCT model hasMany PRODUCT_VARIANTS. In my product view I want drop down menu (SELECT) with all variants of product to be populated in following way: select name=xxx action=yyy option value=product_variant_idsex | size - price/option /select What I was able to do is echo $form-select(variant,$product[ProductVariant]); but this populates dropDown with every table attribut in its own OPTION field. I would like something like this: form-select(variant,$product[ProductVariant][size]); but with few more attributes (size + sex + price). Hope I was clear enough what I want to do... Thank you so much Luka --~--~-~--~~~---~--~~ 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: Help with populating SELECT drop down
@anja This solution works fine but I thought I could do it more elegant :) thanks @grigri I'll try this... I don't get it at first glance but I'll try it. It seems like something worth of try... I'll tell you how it went P.S. Username griGri has something to do with climbing device or not? On Nov 19, 12:24 pm, grigri [EMAIL PROTECTED] wrote: Hi Luka This sounds like a job for Set::combine() : ?php $options = Set::combine( $product['ProductVariant'], '{n}.id', array( '{0} | {1} - {2}', '{n}.sex', '{n}.size', '{n}.price' ) ); echo $form-select('variant', $options); ? hth grigri On Nov 19, 10:42 am, luigi7up [EMAIL PROTECTED] wrote: Hello I need help with populating drop down select element. I have following data in array $product that is available in my view Array ( [Product] = Array ( [id] = 1 [product_category_id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = nije_vuk_ovca [price] = 85 [special] = 0 [published] = 1 [created] = [modified] = 2008-11-07 11:56:06 ) [ProductVariant] = Array ( [0] = Array ( [id] = 1 [product_id] = 1 [sex] = male [size] = S [extras] = [price] = ) [1] = Array ( [id] = 2 [product_id] = 1 [sex] = male [size] = M [extras] = [price] = ) [2] = Array ( [id] = 3 [product_id] = 1 [sex] = male [size] = L [extras] = [price] = ) ) As you can see Product has it's variants because PRODUCT model hasMany PRODUCT_VARIANTS. In my product view I want drop down menu (SELECT) with all variants of product to be populated in following way: select name=xxx action=yyy option value=product_variant_idsex | size - price/option /select What I was able to do is echo $form-select(variant,$product[ProductVariant]); but this populates dropDown with every table attribut in its own OPTION field. I would like something like this: form-select(variant,$product[ProductVariant][size]); but with few more attributes (size + sex + price). Hope I was clear enough what I want to do... Thank you so much Luka --~--~-~--~~~---~--~~ 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: Routing and pagination
I got it! It was so easy and automagical :) working with cake 1.2 of course... My route was wrong. To make all links shop/bla/bla/ point to products/bla/bla/ add following to routes.php: Router::connect('/shop/*', array('controller' = 'products')); On Nov 9, 9:04 pm, luigi7up [EMAIL PROTECTED] wrote: anyone ? On Nov 9, 9:57 am,luigi7up[EMAIL PROTECTED] wrote: Hi everyone, I have a problem with routing and pagination. I'm trying to build small catalog of products. To display all products from xyz category I use url: products/index/xyz ...and this works fine I wanted my visitors to have nicer URL-s so I put: Router::connect('/shop/*', array('controller' = 'products', 'action' = 'index','cat' = 'xyz')); into my routes.php and it still works fine. Problem is that my pagination still takes the old form: products/index/xyz/page:2/ AND NOT shop/xyz/page:2/ Do you have any ideas how to make paginator to echo shorter URLs as those that I'm mapping in routes.php ??? NOTE: Don't thin thak following has anything to do with my problem, still I'm gonna mention this: In my model I use custom paginate function that overrides default pagination so I could perform custom pagination queries like products/ index/xyz/page:2/ function paginate($conditions, $fields, $order, $limit ,$page = 1, $recursive = null) { $params = array( 'conditions' = $conditions, 'recursive' = $recursive, 'fields' = $fields, 'order' = $order, 'limit' = $limit, 'page' = $page ); return $this-find('all', $params); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Routing and pagination
Hi everyone, I have a problem with routing and pagination. I'm trying to build small catalog of products. To display all products from xyz category I use url: products/index/xyz ...and this works fine I wanted my visitors to have nicer URL-s so I put: Router::connect('/shop/*', array('controller' = 'products', 'action' = 'index','cat' = 'xyz')); into my routes.php and it still works fine. Problem is that my pagination still takes the old form: products/index/xyz/page:2/ AND NOT shop/xyz/page:2/ Do you have any ideas how to make paginator to echo shorter URLs as those that I'm mapping in routes.php ??? NOTE: Don't thin thak following has anything to do with my problem, still I'm gonna mention this: In my model I use custom paginate function that overrides default pagination so I could perform custom pagination queries like products/ index/xyz/page:2/ function paginate($conditions, $fields, $order, $limit ,$page = 1, $recursive = null) { $params = array( 'conditions' = $conditions, 'recursive' = $recursive, 'fields' = $fields, 'order' = $order, 'limit' = $limit, 'page' = $page ); return $this-find('all', $params); --~--~-~--~~~---~--~~ 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: Routing and pagination
anyone ? On Nov 9, 9:57 am, luigi7up [EMAIL PROTECTED] wrote: Hi everyone, I have a problem with routing and pagination. I'm trying to build small catalog of products. To display all products from xyz category I use url: products/index/xyz ...and this works fine I wanted my visitors to have nicer URL-s so I put: Router::connect('/shop/*', array('controller' = 'products', 'action' = 'index','cat' = 'xyz')); into my routes.php and it still works fine. Problem is that my pagination still takes the old form: products/index/xyz/page:2/ AND NOT shop/xyz/page:2/ Do you have any ideas how to make paginator to echo shorter URLs as those that I'm mapping in routes.php ??? NOTE: Don't thin thak following has anything to do with my problem, still I'm gonna mention this: In my model I use custom paginate function that overrides default pagination so I could perform custom pagination queries like products/ index/xyz/page:2/ function paginate($conditions, $fields, $order, $limit ,$page = 1, $recursive = null) { $params = array( 'conditions' = $conditions, 'recursive' = $recursive, 'fields' = $fields, 'order' = $order, 'limit' = $limit, 'page' = $page ); return $this-find('all', $params); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Configure::write or define()
Hello everyone... I'm little confused with defining constants in Cake. I have a gallery of pictures that are on voting for _NUMBER_OF_HOURS constant. In my old application that was written in pure PHP and not Cake I had constants.php file where, all constants were defined like this: define('name', value); I tried this in my bootstrap.php and it works and I could go with this but in manual I see some methods like Configure::write and ::read to do this?!?! As I understood old method define(); is much better because it uses php native way to define constants and latter on to use that constant you just call it like this: _CONSTANT_NAME. With configure method writing and reading takes some some time and then again it is pain in the a** to do Configure::read() every time I need value of _CONSTANT_NAME. My question is the benefit of using Cake approach??? I can see some dynamic aspects but everything can be achieved with define(); Am I 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: Configure::write or define()
Thanks for your reply. In practical example where you want to define number of hours you want your gallery pictures to be on voting what would you use? By the way is it okay to use define(); in bootstrap? Thanks On Sep 26, 12:09 pm, grigri [EMAIL PROTECTED] wrote: Benefits of using Configure: * No collisions with other php scripts. * Can be changed at runtime * Easy to organize, list, group and persist related settings Benefits of using php constants: * Less verbose * More efficient On Sep 26, 10:53 am, luigi7up [EMAIL PROTECTED] wrote: Hello everyone... I'm little confused with defining constants in Cake. I have a gallery of pictures that are on voting for _NUMBER_OF_HOURS constant. In my old application that was written in pure PHP and not Cake I had constants.php file where, all constants were defined like this: define('name', value); I tried this in my bootstrap.php and it works and I could go with this but in manual I see some methods like Configure::write and ::read to do this?!?! As I understood old method define(); is much better because it uses php native way to define constants and latter on to use that constant you just call it like this: _CONSTANT_NAME. With configure method writing and reading takes some some time and then again it is pain in the a** to do Configure::read() every time I need value of _CONSTANT_NAME. My question is the benefit of using Cake approach??? I can see some dynamic aspects but everything can be achieved with define(); Am I 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 -~--~~~~--~~--~--~---
Validation not working on model
Hello everyone, I have two models MOTIVE var $hasMany = array('Comment'); COMMENT var $belongsTp=array('Motive'); I want to make comments on motives so I added comment() function into Motive controller and in views/motive/view.php I added following form: echo $form-create('Motive',array('action' = 'comment')); echo $form-hidden('Comment.motive_id',array('value'= $motive['Motive']['id'])); echo $form-input('Comment.author'); echo $form-input('Comment.text',array('type'='textarea')); echo $form-end('Send'); In comment() function of Motives controller i have: if (!empty($this-data)) { if($this-Motive-Comment-save($this-data)) { $this-Session-setFlash(__('Posted!', true)); $this- redirect(array('controller'='motives','action'='view/'.$this- data['Comment']['motive_id'].'')); } else { $this-Session-setFlash(__('Error!', true)); } } I also added validation to my comment model: * var $validate = array( 'author' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!'), 'text' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!') ); * I don't have comments_controller and I don't wanna use it. I want to use comment() function in motives_controller so my form action sends request to Motive/comment Validation does work but it doesn't show messages text next to field in form. So, if I leave author field in comment blank I'll get error because it couldn't be saved: else { $this-Session-setFlash(__('Error!', true)); } thnx --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Making comments on motives
Hello everyone, I have two models MOTIVE var $hasMany = array('Comment'); COMMENT var $belongsTp=array('Motive'); I want to make comments on motives so I added comment() function into Motive controller and in views/motive/view.php I added following form: echo $form-create('Motive',array('action' = 'comment')); echo $form-hidden('Comment.motive_id',array('value'= $motive['Motive']['id'])); echo $form-input('Comment.author'); echo $form-input('Comment.text',array('type'='textarea')); echo $form-end('Send'); In comment() function of Motives controller i have: if (!empty($this-data)) { if($this-Motive-Comment-save($this-data)) { $this-Session-setFlash(__('Posted!', true)); $this- redirect(array('controller'='motives','action'='view/'.$this- data['Comment']['motive_id'].'')); } else { $this-Session-setFlash(__('Error!', true)); } } I also added validation to my comment model: * var $validate = array( 'author' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!'), 'text' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!') ); * and there seems to be a problem. If I leave an empty author field it will not throw a validation error? I think this has something to do with putting comment() function in motives_controller and than expecting comment model validation to do the job?!?! How can I make my validation work so it redirects back to the form and throws an error next to the field that was left empty etc.? thnx --~--~-~--~~~---~--~~ 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: Making comments on motives
No,no, I don't have Comment controller... I have MotivesController with Comment() action... Save() method works well but it doesn't use validation from comment model.!? Maybe I should create comment_controller and define comment() action there, then call it from my form and then after save() redirect back to motives_controller view() action? Hope I've been clear :) On Sep 11, 1:05 pm, Amit Badkas [EMAIL PROTECTED] wrote: 2008/9/11 luigi7up [EMAIL PROTECTED] Hello everyone, I have two models MOTIVE var $hasMany = array('Comment'); COMMENT var $belongsTp=array('Motive'); I want to make comments on motives so I added comment() function into Motive controller and in views/motive/view.php I added following form: echo $form-create('Motive',array('action' = 'comment')); echo $form-hidden('Comment.motive_id',array('value'= $motive['Motive']['id'])); echo $form-input('Comment.author'); echo $form-input('Comment.text',array('type'='textarea')); echo $form-end('Send'); In comment() function of Motives controller i have: if (!empty($this-data)) { if($this-Motive-Comment-save($this-data)) { $this-Session-setFlash(__('Posted!', true)); $this- redirect(array('controller'='motives','action'='view/'.$this- data['Comment']['motive_id'].'')); } else { $this-Session-setFlash(__('Error!', true)); } } I also added validation to my comment model: * var $validate = array( 'author' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!'), 'text' = array('rule'=VALID_NOT_EMPTY,'message'='Blank field!') ); * and there seems to be a problem. If I leave an empty author field it will not throw a validation error? I think this has something to do with putting comment() function in motives_controller and than expecting comment model validation to do the job?!?! How can I make my validation work so it redirects back to the form and throws an error next to the field that was left empty etc.? thnx - You have used incorrect model name in $form-create(), please use Comment instead of Motive and then you don't need to prefix Comment model in any of the $form-input() -- Amit http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Database optimisation (all comments in one table)
hola everyone, while developing application something crossed my mind. What about organizing all comments throughout application in one database table. What I mean is this: If application has some kind of Blog, News, picture gallery you woul create blog_comments table, news_comments table etc. What about table creating one table that would hold all comments ?!? Table comments would have following fields (id, model_name, item_id, author, text) This table would get pretty huge very soon but there is some logic in this approach :) What do you think? 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: Database optimisation (all comments in one table)
Thank you all for reply... I'll organise all comments on articles model in one table because they will be all the same (BLOG, NEWS etc.) but keep others in seperate table. For what is worth, during college I had subject Databases and Program egineering. My database will be in 3NF in both cases but there is a rule in Program engeneering that says: Group all classes/objects that are same. In other words if you have class ORDER and GUEST_ORDER you should group them because they have same attributes. So, what I relized from this discussion is following: Both approaches are good if you know when to use them :) thanks everyoune On Sep 6, 5:49 pm, villas [EMAIL PROTECTED] wrote: Teknoid and Crazy are right about the poor normalisation. However, I successfully used the idea once because it was necessary for me to process all the 'comments' for 5 different models in datetime order. If I had to go and get the comments from 5 different tables before I could process them, it would have been a bigger problem; so, I suppose it depends on what you are doing. However, in this case, maybe going against the standard normalisation advice wouldn't be such a good idea if there wasn't a good reason for it. If however, luigi7up still wishes to think about his idea, I notice that Martin Westin's approach for linking addresses to different models was a little similar in concept and that thread might be worth a read:http://groups.google.com/group/cake-php/msg/75e6eb68be6b301a?hl=en For simply reducing the number of tables, luigi7up could of course also consider the possibility of having a combined table, for example, for News and Blog items. He could perhaps call it Articles and specify whether the article is a News or Blog item with a simple flag. He would then of course only require one Comments table too. Of course he wouldn't be doing that if the fields are significantly different, but I have noticed that some CMS systems successfully simplify their schemas by combining their content types into as few tables as possible. Best regards. On Sep 6, 3:48 pm, teknoid [EMAIL PROTECTED] wrote: I see little benefit to this solution, having everything in one table is not necessarily a good thing. There are a few drawbacks to this solution... - Relying on two fields in order to establish an association - Lack of flexibility. What happens when you decide that Blog comments need to have additional fields? - Poor normalization - Possibly meaningless fields for certain records (i.e. blog_comment_vote) for Image comment (which does not require any votes) On Sep 6, 5:43 am, luigi7up [EMAIL PROTECTED] wrote: hola everyone, while developing application something crossed my mind. What about organizing all comments throughout application in one database table. What I mean is this: If application has some kind of Blog, News, picture gallery you woul create blog_comments table, news_comments table etc. What about table creating one table that would hold all comments ?!? Table comments would have following fields (id, model_name, item_id, author, text) This table would get pretty huge very soon but there is some logic in this approach :) What do you think? 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 -~--~~~~--~~--~--~---
find on hasMany
Hello Im having problem with performing find function in following scenario: I have a voting sistem for motives in gallery. User can vote only once for one motive. So in table Points there is an entry with corresponding user_id and motive_id when user votes. I have three models: USER, Motive, Points User $hasMany motives Motive $belongsTo user Motive $belongsTo User Motive $hasMany motivePoints Points $belongsTo Motive Points $belongsTo User When user wants to vote i have to perform following SQL query to check if he already voted : Select * from motives _points WHERE user_id='$id' AND motive_id = '$motive_id' I want to perform find('count') with this conditions in Motives_controller. If it returns 0 , user already voted for this motive. I tried this: $this-Motive- find('count'),array('conditions'=array('Point.user_id'=26)) It should return 1 because there is only one entry for user 2 in table Points but it returns 3 If I look in debug($this-Motive- find('all'),array('conditions'=array('Point.user_id'=26))) i get: *** *** Array ( [0] = Array ( [Motive] = Array ( [id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = motives/motiv_1 [points] = 45 [created] = 2008-09-01 11:44:45 [modified] = 2008-09-01 15:07:48 ) [User] = Array ( [id] = 26 [username] = luigi7up [password] = 670a2a8ff7b5df64e8205775d4666b55 [email] = [EMAIL PROTECTED] [first_name] = Luka [last_name] = Eterovic [group_id] = 2 ) [Point] = Array ( ) ) [1] = Array ( [Motive] = Array ( [id] = 2 [user_id] = 27 [title] = Killabear [folder] = motives/motiv_2 [points] = 130 [created] = 2008-09-01 11:46:08 [modified] = 2008-09-03 17:16:31 ) [User] = Array ( [id] = 27 [username] = gazda [password] = 7be96ec0264ec22ea292b1484ec88da3 [email] = [EMAIL PROTECTED] [first_name] = Administratrija [last_name] = Admic [group_id] = 3 ) [Point] = Array ( [0] = Array ( [id] = 1 [user_id] = 26 [motive_id] = 2 [points] = 5 [created] = -00-00 00:00:00 [modified] = -00-00 00:00:00 ) ) ) [2] = Array ( [Motive] = Array ( [id] = 3 [user_id] = 31 [title] = Funny Geraffe [folder] = motives/motiv_3/ [points] = 38 [created] = 2008-09-01 15:20:23 [modified] = 2008-09-04 10:57:43 ) [User] = Array ( [id] = 31 [username] = marljivi [password] = eb01e22ae152e997783f9617c4dd535f [email] = [EMAIL PROTECTED] [first_name] = Marljivi [last_name] = Marljivi [group_id] = 3 ) [Point] = Array ( ) ) ) *** *** I was playing with recursive = 2 and behaviour Containable to get this work but I need help. Summary: I need check in Motives_Controller if table Points, that is assocciated to motives table, contains user_id motive_id values and return true/false or number of records... 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: find on hasMany
Thanx... I'll give it a try On Sep 4, 4:23 pm, teknoid [EMAIL PROTECTED] wrote: Your usage of find() is incorrect in the example: find('count'), ... should be find('count', ... That being said, to access associated model from a controller you would use: $this-Motive-Point-find('count', array('conditions'=array('Point.user_id'=$userId, 'Point.motive_id'= $motiveId... etc.. On Sep 4, 9:31 am, luigi7up [EMAIL PROTECTED] wrote: Hello Im having problem with performing find function in following scenario: I have a voting sistem for motives in gallery. User can vote only once for one motive. So in table Points there is an entry with corresponding user_id and motive_id when user votes. I have three models: USER, Motive, Points User $hasMany motives Motive $belongsTo user Motive $belongsTo User Motive $hasMany motivePoints Points $belongsTo Motive Points $belongsTo User When user wants to vote i have to perform following SQL query to check if he already voted : Select * from motives _points WHERE user_id='$id' AND motive_id = '$motive_id' I want to perform find('count') with this conditions in Motives_controller. If it returns 0 , user already voted for this motive. I tried this: $this-Motive- find('count'),array('conditions'=array('Point.user_id'=26)) It should return 1 because there is only one entry for user 2 in table Points but it returns 3 If I look in debug($this-Motive- find('all'),array('conditions'=array('Point.user_id'=26))) i get: *** *** Array ( [0] = Array ( [Motive] = Array ( [id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = motives/motiv_1 [points] = 45 [created] = 2008-09-01 11:44:45 [modified] = 2008-09-01 15:07:48 ) [User] = Array ( [id] = 26 [username] = luigi7up [password] = 670a2a8ff7b5df64e8205775d4666b55 [email] = [EMAIL PROTECTED] [first_name] = Luka [last_name] = Eterovic [group_id] = 2 ) [Point] = Array ( ) ) [1] = Array ( [Motive] = Array ( [id] = 2 [user_id] = 27 [title] = Killabear [folder] = motives/motiv_2 [points] = 130 [created] = 2008-09-01 11:46:08 [modified] = 2008-09-03 17:16:31 ) [User] = Array ( [id] = 27 [username] = gazda [password] = 7be96ec0264ec22ea292b1484ec88da3 [email] = [EMAIL PROTECTED] [first_name] = Administratrija [last_name] = Admic [group_id] = 3 ) [Point] = Array ( [0] = Array ( [id] = 1 [user_id] = 26 [motive_id] = 2 [points] = 5 [created] = -00-00 00:00:00 [modified] = -00-00 00:00:00 ) ) ) [2] = Array ( [Motive] = Array ( [id] = 3 [user_id] = 31 [title] = Funny Geraffe [folder] = motives/motiv_3/ [points] = 38 [created] = 2008-09-01 15:20:23 [modified] = 2008-09-04 10:57:43 ) [User] = Array ( [id] = 31 [username] = marljivi [password] = eb01e22ae152e997783f9617c4dd535f [email] = [EMAIL PROTECTED] [first_name] = Marljivi [last_name] = Marljivi [group_id] = 3 ) [Point] = Array ( ) ) ) *** *** I was playing with recursive = 2 and behaviour Containable to get this work but I need help. Summary: I need check in Motives_Controller if table Points, that is assocciated
Re: find on hasMany
Works just fine... Thanx :) On Sep 4, 4:42 pm, luigi7up [EMAIL PROTECTED] wrote: Thanx... I'll give it a try On Sep 4, 4:23 pm, teknoid [EMAIL PROTECTED] wrote: Your usage of find() is incorrect in the example: find('count'), ... should be find('count', ... That being said, to access associated model from a controller you would use: $this-Motive-Point-find('count', array('conditions'=array('Point.user_id'=$userId, 'Point.motive_id'= $motiveId... etc.. On Sep 4, 9:31 am, luigi7up [EMAIL PROTECTED] wrote: Hello Im having problem with performing find function in following scenario: I have a voting sistem for motives in gallery. User can vote only once for one motive. So in table Points there is an entry with corresponding user_id and motive_id when user votes. I have three models: USER, Motive, Points User $hasMany motives Motive $belongsTo user Motive $belongsTo User Motive $hasMany motivePoints Points $belongsTo Motive Points $belongsTo User When user wants to vote i have to perform following SQL query to check if he already voted : Select * from motives _points WHERE user_id='$id' AND motive_id = '$motive_id' I want to perform find('count') with this conditions in Motives_controller. If it returns 0 , user already voted for this motive. I tried this: $this-Motive- find('count'),array('conditions'=array('Point.user_id'=26)) It should return 1 because there is only one entry for user 2 in table Points but it returns 3 If I look in debug($this-Motive- find('all'),array('conditions'=array('Point.user_id'=26))) i get: *** *** Array ( [0] = Array ( [Motive] = Array ( [id] = 1 [user_id] = 26 [title] = Nije Vuk Ovca [folder] = motives/motiv_1 [points] = 45 [created] = 2008-09-01 11:44:45 [modified] = 2008-09-01 15:07:48 ) [User] = Array ( [id] = 26 [username] = luigi7up [password] = 670a2a8ff7b5df64e8205775d4666b55 [email] = [EMAIL PROTECTED] [first_name] = Luka [last_name] = Eterovic [group_id] = 2 ) [Point] = Array ( ) ) [1] = Array ( [Motive] = Array ( [id] = 2 [user_id] = 27 [title] = Killabear [folder] = motives/motiv_2 [points] = 130 [created] = 2008-09-01 11:46:08 [modified] = 2008-09-03 17:16:31 ) [User] = Array ( [id] = 27 [username] = gazda [password] = 7be96ec0264ec22ea292b1484ec88da3 [email] = [EMAIL PROTECTED] [first_name] = Administratrija [last_name] = Admic [group_id] = 3 ) [Point] = Array ( [0] = Array ( [id] = 1 [user_id] = 26 [motive_id] = 2 [points] = 5 [created] = -00-00 00:00:00 [modified] = -00-00 00:00:00 ) ) ) [2] = Array ( [Motive] = Array ( [id] = 3 [user_id] = 31 [title] = Funny Geraffe [folder] = motives/motiv_3/ [points] = 38 [created] = 2008-09-01 15:20:23 [modified] = 2008-09-04 10:57:43 ) [User] = Array ( [id] = 31 [username] = marljivi [password] = eb01e22ae152e997783f9617c4dd535f [email] = [EMAIL PROTECTED] [first_name] = Marljivi [last_name] = Marljivi [group_id] = 3 ) [Point] = Array
Acl and Auth
Auth and acl? After 4-5 days of trying I finnaly give up :( I've read and followed about 6-7 tutorials about making user/group permissions in Cake and they all have something in common: they suck... Don't want offend anyone but it true... They all have different approach and that's confusing, they all skip registration part of user which is silly because that's where user.group.id is set and they all take some things for granted. So, after losing hope I decided to post my code and database tables entries to someone who really understands how this component works. I want to have groups of users: All/Memebers/Admins. newly registered users are in Members group by setting group_id=2. I want to restrict access to controller/actions for some groups and not users directly. As you will see I've put var $actsAs = array('Acl'); in my USER and GROUP models to behave like ACL. ** USERS MODEL: uses('Sanitize'); class User extends AppModel { var $name = 'User'; var $actsAs = array('Acl'); var $belongsTo = array('Group'); function parentNode(){ if (!$this-id) { return null; } $data = $this-read(); if (!$data['User']['group_id']){ return null; } else { return array('model' = 'Group', 'foreign_key' = $data['User'] ['group_id']); } } // Ok, even if the ACL behavior takes care of the insertion of the // corresponding ARO node, it doesn't save an alias so you have to // give one yourself. We'll be using the username for the alias. // We'll do this after a new user is saved/inserted, so do it inside // the model's afterSave function function afterSave($created) { // Do this if the save operation was an insertion/record creation // and not an update operation if($created) { // Ah, yes... we'll be needing the Sanitize component $sanitize = new Sanitize(); // Get the id of the inserted record $id = $this-getLastInsertID(); // Instantiate an ARO model that will be used for updating // the ARO $aro = new Aro(); // I'm using updateAll() instead of saveField() // Instead of querying the table to get the id of the // ARO node that corresponds to the user, I just provided // two field conditions whose combination uniquely identifies // the node (Model= User, Foreign Key= User id). // I don't know why it wasn't sanitizing my input and not // enclosing the input in quotes. I had to do it myself $aro-updateAll( array('alias'='\''.$sanitize-escape($this-data['User'] ['username']).'\''), array('Aro.model'='User', 'Aro.foreign_key'=$id) ); } return true; } } GROUP MODEL: uses('Sanitize'); class Group extends AppModel { var $name = 'Group'; var $actsAs = array('Acl'); // Associate with the Group table var $hasMany = array('User'); function parentNode(){ if (!$this-id) { return null; } $data = $this-read(); if (!$data['Group']['parent_id']){ return null; } else { return $data['Group']['parent_id']; } } function afterSave($created) { if($created) { $sanitize = new Sanitize(); $id = $this-getLastInsertID(); $aro = new Aro(); $aro-updateAll( array('alias'='\''.$sanitize-escape($this-data['Group'] ['name']).'\''), array('Aro.model'='Group', 'Aro.foreign_key'=$id) ); } return true; } } ARTICLES_CONTROLLER: var $name = 'Articles'; var $helpers = array('Html', 'Form'); // function beforeFilter(){ //$this-Auth-allow('index','view');
auth-loginError
My $this-Auth-loginError ='Invalid username or password'; won't show on login.ctp view This is what I have in app_controller: var $components = array('Acl','Auth'); function beforeFilter(){ //Mijenja hash funkciju auth komponente iz defaultne u md5 Security::setHash('md5'); $this-Auth-fields = array('username' = 'username', 'password' = 'password'); $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); //$this-Auth-loginRedirect = array('controller' = 'users', 'action' = 'index'); $this-Auth-loginError ='Invalid username or password'; $this-Auth-logoutRedirect = '/'; $this-Auth-authorize = 'controller'; } /*When authorize is set to 'controller', you'll need to add a method called isAuthorized() to your controller. This method allows you to do some more authentication checks and then return either true or false.*/ function isAuthorized() { return true; } In users_controller my login() is empty because Auth component automagic and when I debug my session with debug($_SESSION); I see that error is sent, but it si always set - even when I call users/login action for the first time (I mean without submiting wrong data)?!?!: Array ( [Config] = Array ( [userAgent] = 0f8a6ac2e2c891dce1f3f114fdaad715 [time] = 1219830026 [rand] = 32701 [timeout] = 10 ) [Message] = Array ( [auth] = Array ( [message] = Invalid username or password [layout] = default [params] = Array ( ) ) ) How can I get this login error working? 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: auth-loginError
Of course I haven't thnx it works. On Aug 27, 12:40 pm, RichardAtHome [EMAIL PROTECTED] wrote: Have you added the code to your view to display the error? http://book.cakephp.org/view/564/displaying-auth-error-messages On Aug 27, 10:22 am, luigi7up [EMAIL PROTECTED] wrote: My $this-Auth-loginError ='Invalid username or password'; won't show on login.ctp view This is what I have in app_controller: var $components = array('Acl','Auth'); function beforeFilter(){ //Mijenja hash funkciju auth komponente iz defaultne u md5 Security::setHash('md5'); $this-Auth-fields = array('username' = 'username', 'password' = 'password'); $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); //$this-Auth-loginRedirect = array('controller' = 'users', 'action' = 'index'); $this-Auth-loginError ='Invalid username or password'; $this-Auth-logoutRedirect = '/'; $this-Auth-authorize = 'controller'; } /*When authorize is set to 'controller', you'll need to add a method called isAuthorized() to your controller. This method allows you to do some more authentication checks and then return either true or false.*/ function isAuthorized() { return true; } In users_controller my login() is empty because Auth component automagic and when I debug my session with debug($_SESSION); I see that error is sent, but it si always set - even when I call users/login action for the first time (I mean without submiting wrong data)?!?!: Array ( [Config] = Array ( [userAgent] = 0f8a6ac2e2c891dce1f3f114fdaad715 [time] = 1219830026 [rand] = 32701 [timeout] = 10 ) [Message] = Array ( [auth] = Array ( [message] = Invalid username or password [layout] = default [params] = Array ( ) ) ) How can I get this login error working? 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: Auth Component - I'm going crazy
I tried few great tutorials but I'll try this one too. thanx On Aug 25, 9:36 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 3:32 PM, luigi7up [EMAIL PROTECTED] wrote: I found few posts about this problem but none of them resolves my problem. Really hard to diagnose without seeing any code. Have you tried looking at this fantastic tutorial on using the Auth component? http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful... There are some other links there that deal with the Auth component as well. -- Chris Hartjes 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: Auth Component - I'm going crazy
I'll try this. I read about this but I thought they were talking about other databases and not MySql. thx... On Aug 26, 8:57 am, aranworld [EMAIL PROTECTED] wrote: I have had situations in which I was unable to use a column named password and had to instead use something like passwd. I believe it is a reserved keyword issue with MySQL? Not sure if it was just related to an older version, but you might at least try changing the column name. -Aran On Aug 25, 12:32 pm, luigi7up [EMAIL PROTECTED] wrote: Ola, everyone... //Using RC2 version of CakePHP I'm building simple application that allows users to write articles. So there are their corresponding models and controllers. Few days ago I made custom Login/register part of application that writes username to session etc. but now I decided to use Auth component for this purpose. As soon as I define: var $components = array('Auth'); in my users_controller or app_controller, application stops working. Firefox gives following error: Firefox has detected that the server is redirecting the request for this address in a way that will never complete. So, some infinite loop occured definitely and I'm quite sure that I didn't cause it :) I found few posts about this problem but none of them resolves my problem. The weirdest thing,to me, is that error occurs as soon as I include Auth component; I don't even use one method of that class ?!? Also another confusing part with this problem is that my other controllers also stop working with same output eventhough component Auth is included only in users_controller. User model is in association with articles model but I think that articles_controller shoud with or without component Auth included in users_controller. Am I wrong? My database is USERS and has fields username and password and also there is a model for users table. Thanks in advance Luka --~--~-~--~~~---~--~~ 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: Auth Component - I'm going crazy
What about this: Also another confusing part with this problem is that my other controllers also stop working with same output eventhough component Auth is included only in users_controller. User model is in association with articles model but I think that articles_controller shoud with or without component Auth included in users_controller. Am I wrong? On Aug 25, 9:36 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 3:32 PM, luigi7up [EMAIL PROTECTED] wrote: I found few posts about this problem but none of them resolves my problem. Really hard to diagnose without seeing any code. Have you tried looking at this fantastic tutorial on using the Auth component? http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful... There are some other links there that deal with the Auth component as well. -- Chris Hartjes 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: Auth Component - I'm going crazy
I think I know what's causing the problem. I have a ELEMENT that is calling index() action of users_controller to get some data from users model and in index() function I have: $users = $this-paginate(); if(isset($this-params['requested'])) { return $users; } $this-set('users', $users); If I comment this there are no errors?!? My element looks like this: $users = $this-requestAction('users/index/sort:id/direction:desc/ limit:5'); foreach($users as $user): echo $user['User']['username']; echo 'br /'; endforeach; Hope this helps... Luka In my users_controller I have index() action On Aug 25, 9:36 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On Mon, Aug 25, 2008 at 3:32 PM, luigi7up [EMAIL PROTECTED] wrote: I found few posts about this problem but none of them resolves my problem. Really hard to diagnose without seeing any code. Have you tried looking at this fantastic tutorial on using the Auth component? http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful... There are some other links there that deal with the Auth component as well. -- Chris Hartjes 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 -~--~~~~--~~--~--~---
Auth Component - I'm going crazy
Ola, everyone... //Using RC2 version of CakePHP I'm building simple application that allows users to write articles. So there are their corresponding models and controllers. Few days ago I made custom Login/register part of application that writes username to session etc. but now I decided to use Auth component for this purpose. As soon as I define: var $components = array('Auth'); in my users_controller or app_controller, application stops working. Firefox gives following error: Firefox has detected that the server is redirecting the request for this address in a way that will never complete. So, some infinite loop occured definitely and I'm quite sure that I didn't cause it :) I found few posts about this problem but none of them resolves my problem. The weirdest thing,to me, is that error occurs as soon as I include Auth component; I don't even use one method of that class ?!? Also another confusing part with this problem is that my other controllers also stop working with same output eventhough component Auth is included only in users_controller. User model is in association with articles model but I think that articles_controller shoud with or without component Auth included in users_controller. Am I wrong? My database is USERS and has fields username and password and also there is a model for users table. Thanks in advance Luka --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
something like Joomla modules
Hello everyone. I just started to explore Cake PHP and already love it. I'm trying to create a simple CMS. I have few questions about how to solve some problems that came along development. I was using Joomla for a few years so I'm used to refer some elements like pools, latest comments, tags cloud, menus etc. as MODULES. My question is what would be a good approach to build them in Cake PHP. For example: should I define a new helper/component that would check installed and active modules and then call that helper from a view or template file? Some guidelines how to approach would be just fine Hope you understand my question :) Thank you very much... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---