cake PHP installation problem
Hi i am trying to cake php folder(cake_1.1.19.6305) on our server(eg server.com). i have created model(product.php), views(view/products/index.thtml) and controller(product_controller.php) when i try http://server.com/cake_1.1.19.6305/ it shows index page with Your database configuration file is present. Cake is able to connect to the database. when i try http://server.com/cake_1.1.19.6305/products/index it shows error message The requested URL /cake1/products/ was not found on this server. What's the solution for this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
cake PHP installation problem
Hi i am trying to cake php folder(cake_1.1.19.6305) on our server(eg server.com). i have created model(product.php), views(view/products/index.thtml) and controller(product_controller.php) everything working fine on http://server.com/cake_1.1.19.6305/products/index when i try http://server.com/cake_1.1.19.6305/ it shows index page with Your database configuration file is present. Cake is able to connect to the database. when i try http://server.com/cake_1.1.19.6305/products/index it shows error message The requested URL /cake1/products/ was not found on this server. What's the solution for this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Bug in $model-saveAll in 1.2
try this one if($this-Contentclass-saveAll($this-data)) { $this-Session-setFlash(__('The Contentclass and all attributes has been saved', true)); $this-redirect(array('action'='edit', $id)); } else { $this-Session-setFlash(__('The Contentclass was saved but the attributes faild to saved', true)); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate one or two fields?
do you want to cum pair user written data with database?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: why does the form error appear above and below the input field?
you can display error anywhere. i am using following code for display errors at top of the form. h2Add New Product/h2 ?php echo $html-tagErrorMsg('Product/code', $pcode_error) ? ?php echo $html-tagErrorMsg('Product/product_name', 'Name required.') ? ?php echo $html-tagErrorMsg('Product/price', 'Price required in numeric.') ? form action=?php echo $html-url('/products/add'); ? method=post enctype=multipart/form-data table width=50% trtdlabelCode:/label/td td?php echo $html-inputTag('Product/code', array('size' = '40')) ?/td/tr trtdlabelName:/label/td td?php echo $html-inputTag('Product/product_name', array('size' = '40')) ?/td/tr trtdlabelPrice:/label/td td?php echo $html-inputTag('Product/price', array('size' = '40')) ?/td/tr trtd colspan='2'?php echo $html-submitTag('add') ?/td/tr /table /form On Feb 6, 10:13 am, Amit Badkas [EMAIL PROTECTED] wrote: On Feb 6, 2008 8:51 AM, johnnyice [EMAIL PROTECTED] wrote: So as most of you know the HtmlHelper::tagErrorMsg method has been deprecated and the new method to use is FormHelper::error. I want the error message to appear ABOVE the input field, but it appears below by default. I then put in the extra form-error() call and now I get the message above AND below the field. How can I force the error message to appear ABOVE the input field? Anything to do with the before, after options you send as arguments to input()?? - Yes. You have to set 'error' = false in input() method's second argument array Code is below... View echo $form-error('username'); echo $form-input('username', array('size' = '15', 'label' = 'Username')); - Above should be changed to $form-input('username), array('size' = 15, 'label' = 'Username', 'error' = false)); -- Regards, 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 Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
on edit page select radio according database value
Hi!!! please help me for select option list and radio button according to database. content in edit.thtml :- trtdlabel for=CategoryParentIdCategory/label/td td?php echo $html-selectTag('Product/category_id', $tree- show('Category/name', $CategoryArray, 'options'),'');?/td /tr trtdlabelStatus:/label/td td ?php echo $html-radio('Product/status', array('Available' = 'Available', 'Not Available' = 'Not Available'), null, array('value' = 'Available'));?/td/tr trtdlabelFeatured:/label/td td?php echo $html-radio('Product/is_featured', array('No' = 'No','Yes' = 'Yes' ), null, array('value' = 'No'));?/tdtd width=40%/td/tr content of controller :- function edit($id) { $this-set('CategoryArray', $this-Product-Category- findAllThreaded(null, null,'parent_id')); if(empty($this-data)) { $this-data = $this-Product-read(null, $id); } else { $this-cleanUpFields(); if($this-Product-save($this-data)) { $this-Session-setFlash('The Product has been saved'); $this-redirect('/products/index'); } else { $this-Session-setFlash('Please correct errors below.'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Controller without model/table possible?
you can use any number of existing models like this App::import('Model', 'Product'); $tmpProduct = new Product(); $tmpProduct-find(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: use different model in different controller.
thats working now.. Thank you so much :-) On Feb 3, 9:16 am, brian_gaff [EMAIL PROTECTED] wrote: Anupom has already told you the correct way to do it; however, if you really really want to do it like: $this-Category-find(); Then you need to add this line to the top of your Products controller: var $uses = array('Product', 'Category'); BRIAN On Feb 1, 11:47 pm, Rgarg [EMAIL PROTECTED] wrote: Hi i am using two controller Products categories in index page i want to display all information about products as well as 'category name'.category name comes from Categories table. Model of Products is: ?php class Product extends AppModel { var $name = 'Product'; var $belongsTo = array ('Category' = array('className' = 'Category','conditions'='','order'='', 'foreignKey'='category_id')); } ? controller is: class ProductsController extends AppController { //var $scaffold; var $name = 'Products'; var $helpers = array('Html', 'Form', 'Tree' ); var $components = array('Upload'); function index() { $this-Product-recursive = 0; $this-set('products', $this-Product-findAll()); } in index() i want to use $this-set('data', $this-Category-findAllThreaded(null, null, 'parent_id')); $CategoryArray = $this-Category-generateList(null, 'parent_id'); $this-set('CategoryArray', $CategoryArray); Please help me What to do for this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: use different model in different controller.
Thats is working now. thank you so much Anupom. :-) On Feb 3, 9:08 am, Anupom [EMAIL PROTECTED] wrote: Try this $this-set('data', $this-Product-Category-findAllThreaded(null, null, 'parent_id')); $CategoryArray = $this-Product-Category-generateList(null, 'parent_id'); $this-set('CategoryArray', $CategoryArray); On Feb 2, 2008 1:47 PM, Rgarg [EMAIL PROTECTED] wrote: Hi i am using two controller Products categories in index page i want to display all information about products as well as 'category name'.category name comes from Categories table. Model of Products is: ?php class Product extends AppModel { var $name = 'Product'; var $belongsTo = array ('Category' = array('className' = 'Category','conditions'='','order'='', 'foreignKey'='category_id')); } ? controller is: class ProductsController extends AppController { //var $scaffold; var $name = 'Products'; var $helpers = array('Html', 'Form', 'Tree' ); var $components = array('Upload'); function index() { $this-Product-recursive = 0; $this-set('products', $this-Product-findAll()); } in index() i want to use $this-set('data', $this-Category-findAllThreaded(null, null, 'parent_id')); $CategoryArray = $this-Category-generateList(null, 'parent_id'); $this-set('CategoryArray', $CategoryArray); Please help me What to do for this. -- Thanks Anupom Trippert Inc. [http://www.trippert.com] GopherNow. [http://www.gophernow.com/] Homepage. [http://www.anupom.wordpress.com/] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: use different model in different controller.
thanks its working now. :-) On Feb 3, 11:31 am, keymaster [EMAIL PROTECTED] wrote: Don't use $uses, ever. It is terrible for performance. Always access models through their associations, ie. $this-model1- model2-find(); If you don't have any associations to the model you want, use the following before accessing your model: App::import('Model', 'Product'); $tmpProduct = new Product(); $tmpProduct-find(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: use different model in different controller.
if i use App::import('Model', 'Product'); it gives Fatal error: Class 'App' not found in /opt/lampp/htdocs/ cake_1.1.19.6305/app/controllers/products_controller.php on line 16 On Feb 3, 11:31 am, keymaster [EMAIL PROTECTED] wrote: Don't use $uses, ever. It is terrible for performance. Always access models through their associations, ie. $this-model1- model2-find(); If you don't have any associations to the model you want, use the following before accessing your model: App::import('Model', 'Product'); $tmpProduct = new Product(); $tmpProduct-find(); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
use different model in different controller.
Hi i am using two controller Products categories in index page i want to display all information about products as well as 'category name'.category name comes from Categories table. Model of Products is: ?php class Product extends AppModel { var $name = 'Product'; var $belongsTo = array ('Category' = array('className' = 'Category','conditions'='','order'='', 'foreignKey'='category_id')); } ? controller is: class ProductsController extends AppController { //var $scaffold; var $name = 'Products'; var $helpers = array('Html', 'Form', 'Tree' ); var $components = array('Upload'); function index() { $this-Product-recursive = 0; $this-set('products', $this-Product-findAll()); } in index() i want to use $this-set('data', $this-Category-findAllThreaded(null, null, 'parent_id')); $CategoryArray = $this-Category-generateList(null, 'parent_id'); $this-set('CategoryArray', $CategoryArray); Please help me What to do for this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to upload file?
contents of add.thtml file are: *** ?php echo $html-formTag('/products/add',array('enctype'='multipart/ form-data','method'='post')) ? pPlease fill out the Product Informations./p table width=50% trtdlabelProduct Name:/label/td td?php echo $html-inputTag('Product/title', array('size' = '40')) ?/td/tr ?php // echo $html-tagErrorMsg('Product/title', $title_error) ? trtdlabelImage:/label/td td?php echo $html-fileTag('Product/image_path', array()) ?/td/ tr ?php // echo $html-tagErrorMsg('Product/image_path', 'image is required') ? trtdlabelDescription:/label/td td?php echo $html-textarea('Product/description', array('rows'='10', 'cols'='30')) ?/td/tr ?php // echo $html-tagErrorMsg('Product/description', $description_error) ? trtd colspan='2'?php echo $html-submitTag('add') ?/td/tr /table /form *** content of controller product_controller.php are: class ProductsController extends AppController { //var $scaffold; var $name = 'Products'; var $helpers = array('Html', 'Form' ); function index() { $this-Product-recursive = 0; $this-set('products', $this-Product-findAll()); } function add() { if(empty($this-data)) { $this-render(); } else { $this-cleanUpFields(); e(move_uploaded_file(this-data['product']['image_path']); if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) { $this-Session-setFlash('File is valid, and was successfully uploaded.'); $this-redirect('/products/index'); } else { $this-Session-setFlash('There\'s issues! Maybe the file is too big, or unacceptable mime type.'); $this-redirect('/products/index'); } if($this-Product-save($this-data)) { $this-Session-setFlash('The Product has been saved'); $this-redirect('/products/index'); } else { $this-Session-setFlash('Please correct errors below.'); } } } } -- On Jan 25, 12:14 pm, manish [EMAIL PROTECTED] wrote: Can you tell, what is the enctype you gave for the form? On Jan 25, 11:17 am, Rgarg [EMAIL PROTECTED] wrote: please help me.. its not working. the value of $_FILES['filename']['tmp_name'] is not comming form my add.thtml page. what's the solution for this? On Jan 24, 9:13 pm, Novice Programmer [EMAIL PROTECTED] wrote: At the face of it, every thing looks ok.. it would be great if you dont mind telling us the error messages you are getting. Thanks. On 1/24/08, Rgarg [EMAIL PROTECTED] wrote: Hi Please help me to upload a file. i am using this if (move_uploaded_file($_FILES['filename']['tmp_name'], $destination_path)) { $this-Session-setFlash('File is valid, and was successfully uploaded.'); $this-redirect('/products/index'); } else { $this-Session-setFlash('There\'s issues! Maybe the file is too big.'); $this-redirect('/products/index'); } -- Thanks Regards, Novice (http://ishuonweb.wordpress.com/). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to upload file?
Hi Please help me to upload a file. i am using this if (move_uploaded_file($_FILES['filename']['tmp_name'], $destination_path)) { $this-Session-setFlash('File is valid, and was successfully uploaded.'); $this-redirect('/products/index'); } else { $this-Session-setFlash('There\'s issues! Maybe the file is too big.'); $this-redirect('/products/index'); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to upload file?
please help me.. its not working. the value of $_FILES['filename']['tmp_name'] is not comming form my add.thtml page. what's the solution for this? On Jan 24, 9:13 pm, Novice Programmer [EMAIL PROTECTED] wrote: At the face of it, every thing looks ok.. it would be great if you dont mind telling us the error messages you are getting. Thanks. On 1/24/08, Rgarg [EMAIL PROTECTED] wrote: Hi Please help me to upload a file. i am using this if (move_uploaded_file($_FILES['filename']['tmp_name'], $destination_path)) { $this-Session-setFlash('File is valid, and was successfully uploaded.'); $this-redirect('/products/index'); } else { $this-Session-setFlash('There\'s issues! Maybe the file is too big.'); $this-redirect('/products/index'); } -- Thanks Regards, Novice (http://ishuonweb.wordpress.com/). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
retrieve data form two tables
Hi... i wants to display records form two tables(tickets,bookings) using cake php 1.2. is there any way to put 'where condition' in this-findall(). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem to updating last_login using save()
i am trying to update field 'last_login' in table 'users' like this : $someone = $this-User-findByUsername($this-data['User'] ['username']); $this-Session-write('last_login', $someone['User'] ['last_login']); $someone['User']['last_login'] = date(Y-m-d H:i:s); $this-User-save($someone); it is not working. Please tell me what to do? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem to updating last_login using save()
in database last_login is not going to change. i hv also use pr($someone) it contain all values but not reflecting in database. On Jan 22, 2:13 pm, AD7six [EMAIL PROTECTED] wrote: On Jan 22, 9:47 am, Rgarg [EMAIL PROTECTED] wrote: i am trying to update field 'last_login' in table 'users' like this : $someone = $this-User-findByUsername($this-data['User'] ['username']); $this-Session-write('last_login', $someone['User'] ['last_login']); $someone['User']['last_login'] = date(Y-m-d H:i:s); $this-User-save($someone); it is not working. Please tell me what to do? You could: a) look at the sql debug log b) explain /in what way/ it's not working c) add var_dump ($this-User-id); before your save - that's the id of the row that's going to get updated; if it's not the id of he user $someone, they aren't going to get updated ;) hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---