pre production check off list
I remember seeing a check off list of things to do before making your app live (ie: set degub to 0). But I cant seem to find it anymore. Can some one point me in the right direction where this info is. Thanks! Clint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: retrieving data from another table
Ok, im not sure what I was doing wrong but it was just as simple as you mentioned. I just added $this->Product->recursive = 2; and viola, everything was fetched properly. Thanks a million! On May 18, 11:55 am, justclint wrote: > Hey Faza and Rick thanks for your reply. Yes, I am trying to get > Gender.name. So what Im trying to do is get my array to show up > something like: > > [Product] => Array > ( > [id] => 21 > [color_id] => 3 > [image_thumb] => aw_ls_black.png > [price] => 27.95 > [shipping_price] => 5.00 > [style_id] => 1 > ) > > [Style] => Array > ( > [id] => 1 > [name] => All Weather Longsleeve Compression Shirt > > [Gender] => Array > ( > [gender_id] => 2 > [gender_name] => Men > ) > [category_id] => 2 > [material_id] => 2 > [application_id] => 2 > > *Notice the sub array Gender under Style array > > I tried doing the "$this->Style->recursive = 1; " and > "$this->Product->Style->recursive = 1; " in my products_controller as shown > below but > > still not getting the correct results. > > function view($id = null) { > if (!$id) { > $this->Session->setFlash(__('Invalid Product.', > true)); > $this->redirect(array('action'=>'index')); > } > $this->Style->recursive = 1; > $this->set('product', $this->Product->read(null, $id)); > > } > > And in my product/view Ive tried echo $product['Gender']['name'] > $product['Style']['Gender.name'] but obviously its showing as an > unrecognized variable. > > Im reading up on the containable right now as I've never used that > behavior before. > > Any additional help would be great. Thanks guys! > > On May 18, 6:19 am, Rick wrote: > > > What name are you trying to get? Looks like you have Style.name > > already available in your result. > > > If there is a Gender.name you are trying to see you can set the > > recursive to a higher number before the find: > > > $this->Style->recursive = 2; > > > Or use the Containable behavior as mentioned above. > > > On May 17, 5:22 pm, justclint wrote: > > > > Im pulling the data successfully but Im trying to get the "name" value > > > as opposed to the "id" value in a separate table. > > > > When I do debug I get this: > > > ( > > > [Product] => Array > > > ( > > > [id] => 21 > > > [color_id] => 3 > > > [image_thumb] => aw_ls_black.png > > > [price] => 27.95 > > > [shipping_price] => 5.00 > > > [style_id] => 1 > > > ) > > > > [Style] => Array > > > ( > > > [id] => 1 > > > [name] => All Weather Longsleeve Compression Shirt > > > [gender_id] => 2 > > > [category_id] => 2 > > > [material_id] => 2 > > > [application_id] => 2 > > > > For sake of example I will just reference the gender_id. I need it to > > > show the name not the id. > > > > I have the following tables/models. > > > > Products > > > Styles > > > Genders > > > > Product Model: > > > class Product extends AppModel { > > > > var $name = 'Product'; > > > > var $belongsTo = array( > > > 'Style' => array( > > > 'className' => 'Style', > > > 'foreignKey' => 'style_id', > > > 'conditions' => '', > > > 'fields' => '', > > > 'order' => '' > > > ), > > > ); > > > > } > > > > Styles Model: > > > class Style extends AppModel { > > > > var $name = 'Style'; > > > > var $belongsTo = ar
Re: link TO an image
Are you placing the folder "upload" somewhere in the webroot folder? If not, you would want to create your upload folder in the webroot folder. If they are images getting uploaded you might make a folder structure like: webroot/img/photos/mediagallery/uploads/ Then your image helper would look something like: $html->link($html->image('photos/mediagallery/uploads/main_demo.jpg'), array($html->url(' photos/mediagallery/uploads/main_zoom.jpg')), array('title' => 'hello', 'escape' => false, 'class' => 'mg_main')); Hope this helps. On May 18, 12:50 pm, foldiman wrote: > I'm stuck trying to construct a URL using the html helper that points > to an jpeg sitting in an 'uploads' folder in my webroot folder. I've > tried the following. > > $html->link($html->image('/uploads/main_demo.jpg'), array($html->url('/ > uploads/main_zoom.jpg', true)), array('title' => 'hello', 'escape' => > false, 'class' => 'mg_main')); > > However, this creates the following URL which is obviously broken. > > http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg > > When I remove the 'true' option from the $html->url statement I get > this which is also wrong. > > http://mysite/photos/mediagallery/uploads/main_zoom.jpg > > And then I also noticed that when I go to the following url, Cake asks > for a controller which is of course missing. > > http://mysite/uploads/main_zoom.jpg > > So how can I just point the browser to this image? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: retrieving data from another table
Hey Faza and Rick thanks for your reply. Yes, I am trying to get Gender.name. So what Im trying to do is get my array to show up something like: [Product] => Array ( [id] => 21 [color_id] => 3 [image_thumb] => aw_ls_black.png [price] => 27.95 [shipping_price] => 5.00 [style_id] => 1 ) [Style] => Array ( [id] => 1 [name] => All Weather Longsleeve Compression Shirt [Gender] => Array ( [gender_id] => 2 [gender_name] => Men ) [category_id] => 2 [material_id] => 2 [application_id] => 2 *Notice the sub array Gender under Style array I tried doing the "$this->Style->recursive = 1; " and "$this->Product- >Style->recursive = 1; " in my products_controller as shown below but still not getting the correct results. function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Product.', true)); $this->redirect(array('action'=>'index')); } $this->Style->recursive = 1; $this->set('product', $this->Product->read(null, $id)); } And in my product/view Ive tried echo $product['Gender']['name'] $product['Style']['Gender.name'] but obviously its showing as an unrecognized variable. Im reading up on the containable right now as I've never used that behavior before. Any additional help would be great. Thanks guys! On May 18, 6:19 am, Rick wrote: > What name are you trying to get? Looks like you have Style.name > already available in your result. > > If there is a Gender.name you are trying to see you can set the > recursive to a higher number before the find: > > $this->Style->recursive = 2; > > Or use the Containable behavior as mentioned above. > > On May 17, 5:22 pm, justclint wrote: > > > Im pulling the data successfully but Im trying to get the "name" value > > as opposed to the "id" value in a separate table. > > > When I do debug I get this: > > ( > > [Product] => Array > > ( > > [id] => 21 > > [color_id] => 3 > > [image_thumb] => aw_ls_black.png > > [price] => 27.95 > > [shipping_price] => 5.00 > > [style_id] => 1 > > ) > > > [Style] => Array > > ( > > [id] => 1 > > [name] => All Weather Longsleeve Compression Shirt > > [gender_id] => 2 > > [category_id] => 2 > > [material_id] => 2 > > [application_id] => 2 > > > For sake of example I will just reference the gender_id. I need it to > > show the name not the id. > > > I have the following tables/models. > > > Products > > Styles > > Genders > > > Product Model: > > class Product extends AppModel { > > > var $name = 'Product'; > > > var $belongsTo = array( > > 'Style' => array( > > 'className' => 'Style', > > 'foreignKey' => 'style_id', > > 'conditions' => '', > > 'fields' => '', > > 'order' => '' > > ), > > ); > > > } > > > Styles Model: > > class Style extends AppModel { > > > var $name = 'Style'; > > > var $belongsTo = array( > > 'Gender' => array( > > 'className' => 'Gender', > > 'foreignKey' => 'gender_id', > > 'conditions' => '', > > 'fields' => '', > > 'order' => '' > > ), > > 'Category' => array( > > 'className' => 'Category', > > 'foreignKey' => 'category_id', > > 'conditions
retrieving data from another table
Im pulling the data successfully but Im trying to get the "name" value as opposed to the "id" value in a separate table. When I do debug I get this: ( [Product] => Array ( [id] => 21 [color_id] => 3 [image_thumb] => aw_ls_black.png [price] => 27.95 [shipping_price] => 5.00 [style_id] => 1 ) [Style] => Array ( [id] => 1 [name] => All Weather Longsleeve Compression Shirt [gender_id] => 2 [category_id] => 2 [material_id] => 2 [application_id] => 2 For sake of example I will just reference the gender_id. I need it to show the name not the id. I have the following tables/models. Products Styles Genders Product Model: class Product extends AppModel { var $name = 'Product'; var $belongsTo = array( 'Style' => array( 'className' => 'Style', 'foreignKey' => 'style_id', 'conditions' => '', 'fields' => '', 'order' => '' ), ); } Styles Model: class Style extends AppModel { var $name = 'Style'; var $belongsTo = array( 'Gender' => array( 'className' => 'Gender', 'foreignKey' => 'gender_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Category' => array( 'className' => 'Category', 'foreignKey' => 'category_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Material' => array( 'className' => 'Material', 'foreignKey' => 'material_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Application' => array( 'className' => 'Application', 'foreignKey' => 'application_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); } Gender Model: var $name = 'Gender'; var $hasMany = array( 'Style' => array( 'className' => 'Style', 'foreignKey' => 'gender_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); } ?> The page im trying to get this on is my product view page. Action looks like this: function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Product.', true)); $this->redirect(array('action'=>'index')); } $this->set('product', $this->Product->read(null, $id)); } Ive been playing with this for hours and I just cant seem to get it. If you need more info, please dont hesitate to ask. Your help is greatly appreciated. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: retrieve specific data
Hey Brian, I just redid another app in the console and somehow someway doing this: echo $product['Color']['name']; works now. I really appreciate your help. Thanks so much! clint On Apr 3, 9:41 pm, justclint wrote: > No, I dont have any afterFind code. > > On Apr 3, 9:29 pm, justclint wrote: > > > Thanks Brian, I in regards to the category and other fields, they have > > the same issue but I've just deleted them so just to simplify and to > > work with one item and then I can repeat whatever the solution is. > > > Yes, you are correct about the foreach. It is as follows on the index > > view: > > - > > > echo $paginator->counter(array( > > 'format' => __('Page %page% of %pages%, showing %current% records out > > of %count% total, starting on record %start%, ending on %end%', true) > > )); > > ?> > > > > > > > > sort('id');?> > > sort('name');?> > > sort('color_id');?> > > > > > > > $i = 0; > > foreach ($products as $product): > > $class = null; > > if ($i++ % 2 == 0) { > > $class = ' class="altrow"'; > > } > > ?> > > > > > > > > > > > > > > > > > > > > > > > > > link(__('View', true), > > array('action'=>'view', > > $product['Product']['id'])); ?> > > link(__('Edit', true), > > array('action'=>'edit', > > $product['Product']['id'])); ?> > > link(__('Delete', true), array > > ('action'=>'delete', $product['Product']['id']), null, sprintf(__('Are > > you sure you want to delete # %s?', true), $product['Product'] > > ['id'])); ?> > > > > > > > > > > -- > > > Thanks! > > > On Apr 3, 9:20 pm, brian wrote: > > > > Wait a sec--you also don't have any Category, Sport, or Material data > > > in that array, although they are clearly part of the query. > > > > But, then again, you *do* have Color in there. Weird. > > > > On Sat, Apr 4, 2009 at 12:17 AM, brian wrote: > > > > I just looked closer and see that you have: > > > > > $this->set('products', $this->paginate()); > > > > > So, your view var should be $products. So, is this line inside of a > > > > loop? > > > > > > > > > > IOW, you're doing something like: > > > > > foreach($products as $product) > > > > > Anyway, as you can see from the debug output, the Color array is > > > > present alongside each Product. So this seems a bit baffling. Can you > > > > post the entire loop? > > > > > BTW, you don't need the query to be: > > > > > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > > > > ... as it's Color.id that Product.color_id is the foreign key for. > > > > What you want (and what you seem to be getting, if not able to access) > > > > is Color.name. > > > > > I'm not sure what to make of this. Do you have any afterFind code? > > > > > On Fri, Apr 3, 2009 at 11:58 PM, justclint wrote: > > > > >> I forgot to mention, this is the dubug I ran: debug($products, > > > >> $showHTML = false, $showFrom = true); > > > > >> On Apr 3, 8:56 pm, justclint wrote: > > > >>> I'd never used the debugger before so I had to do a little reading > > > >>> first but I ran it and here's the results: > > > >>> --- > > > >>> Array > > > >>> ( > > > >>> [0] => Array > > > >>> ( > > > >>> [Product] => Array > > > >>> ( > > > >>> [id] => 1 > > > >>> [name] => Item 1 > > >
Re: retrieve specific data
No, I dont have any afterFind code. On Apr 3, 9:29 pm, justclint wrote: > Thanks Brian, I in regards to the category and other fields, they have > the same issue but I've just deleted them so just to simplify and to > work with one item and then I can repeat whatever the solution is. > > Yes, you are correct about the foreach. It is as follows on the index > view: > - > echo $paginator->counter(array( > 'format' => __('Page %page% of %pages%, showing %current% records out > of %count% total, starting on record %start%, ending on %end%', true) > )); > ?> > > > > sort('id');?> > sort('name');?> > sort('color_id');?> > > > $i = 0; > foreach ($products as $product): > $class = null; > if ($i++ % 2 == 0) { > $class = ' class="altrow"'; > } > ?> > > > > > > > > > > > > > link(__('View', true), > array('action'=>'view', > $product['Product']['id'])); ?> > link(__('Edit', true), > array('action'=>'edit', > $product['Product']['id'])); ?> > link(__('Delete', true), array > ('action'=>'delete', $product['Product']['id']), null, sprintf(__('Are > you sure you want to delete # %s?', true), $product['Product'] > ['id'])); ?> > > > > > -- > > Thanks! > > On Apr 3, 9:20 pm, brian wrote: > > > Wait a sec--you also don't have any Category, Sport, or Material data > > in that array, although they are clearly part of the query. > > > But, then again, you *do* have Color in there. Weird. > > > On Sat, Apr 4, 2009 at 12:17 AM, brian wrote: > > > I just looked closer and see that you have: > > > > $this->set('products', $this->paginate()); > > > > So, your view var should be $products. So, is this line inside of a loop? > > > > > > > > IOW, you're doing something like: > > > > foreach($products as $product) > > > > Anyway, as you can see from the debug output, the Color array is > > > present alongside each Product. So this seems a bit baffling. Can you > > > post the entire loop? > > > > BTW, you don't need the query to be: > > > > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > > > ... as it's Color.id that Product.color_id is the foreign key for. > > > What you want (and what you seem to be getting, if not able to access) > > > is Color.name. > > > > I'm not sure what to make of this. Do you have any afterFind code? > > > > On Fri, Apr 3, 2009 at 11:58 PM, justclint wrote: > > > >> I forgot to mention, this is the dubug I ran: debug($products, > > >> $showHTML = false, $showFrom = true); > > > >> On Apr 3, 8:56 pm, justclint wrote: > > >>> I'd never used the debugger before so I had to do a little reading > > >>> first but I ran it and here's the results: > > >>> --- > > >>> Array > > >>> ( > > >>> [0] => Array > > >>> ( > > >>> [Product] => Array > > >>> ( > > >>> [id] => 1 > > >>> [name] => Item 1 > > >>> [color_id] => 2 > > >>> ) > > > >>> [Color] => Array > > >>> ( > > >>> [id] => 2 > > >>> [name] => White > > >>> ) > > > >>> ) > > > >>> [1] => Array > > >>> ( > > >>> [Product] => Array > > >>> ( > > >>> [id] => 2 > > >>> [name] => Item 2 > > >>> [color
Re: retrieve specific data
Thanks Brian, I in regards to the category and other fields, they have the same issue but I've just deleted them so just to simplify and to work with one item and then I can repeat whatever the solution is. Yes, you are correct about the foreach. It is as follows on the index view: - counter(array( 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) )); ?> sort('id');?> sort('name');?> sort('color_id');?> > link(__('View', true), array('action'=>'view', $product['Product']['id'])); ?> link(__('Edit', true), array('action'=>'edit', $product['Product']['id'])); ?> link(__('Delete', true), array ('action'=>'delete', $product['Product']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $product['Product'] ['id'])); ?> -- Thanks! On Apr 3, 9:20 pm, brian wrote: > Wait a sec--you also don't have any Category, Sport, or Material data > in that array, although they are clearly part of the query. > > But, then again, you *do* have Color in there. Weird. > > On Sat, Apr 4, 2009 at 12:17 AM, brian wrote: > > I just looked closer and see that you have: > > > $this->set('products', $this->paginate()); > > > So, your view var should be $products. So, is this line inside of a loop? > > > > > > IOW, you're doing something like: > > > foreach($products as $product) > > > Anyway, as you can see from the debug output, the Color array is > > present alongside each Product. So this seems a bit baffling. Can you > > post the entire loop? > > > BTW, you don't need the query to be: > > > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > > ... as it's Color.id that Product.color_id is the foreign key for. > > What you want (and what you seem to be getting, if not able to access) > > is Color.name. > > > I'm not sure what to make of this. Do you have any afterFind code? > > > On Fri, Apr 3, 2009 at 11:58 PM, justclint wrote: > > >> I forgot to mention, this is the dubug I ran: debug($products, > >> $showHTML = false, $showFrom = true); > > >> On Apr 3, 8:56 pm, justclint wrote: > >>> I'd never used the debugger before so I had to do a little reading > >>> first but I ran it and here's the results: > >>> --- > >>> Array > >>> ( > >>> [0] => Array > >>> ( > >>> [Product] => Array > >>> ( > >>> [id] => 1 > >>> [name] => Item 1 > >>> [color_id] => 2 > >>> ) > > >>> [Color] => Array > >>> ( > >>> [id] => 2 > >>> [name] => White > >>> ) > > >>> ) > > >>> [1] => Array > >>> ( > >>> [Product] => Array > >>> ( > >>> [id] => 2 > >>> [name] => Item 2 > >>> [color_id] => 1 > >>> ) > > >>> [Color] => Array > >>> ( > >>> [id] => 1 > >>> [name] => Black > >>> ) > > >>> ) > > >>> ) > >>> > > >>> So in the following under the products->color_id, I know the field is > >>> getting populated in the table as an id but how do I get it to show > >>> the color name that corresponds to that id? > > >>> Thanks Brian! > > >>> On Apr 3, 8:37 pm, brian wrote: > > >>> > Odd. The query shows that it should be in there
Re: retrieve specific data
I forgot to mention, this is the dubug I ran: debug($products, $showHTML = false, $showFrom = true); On Apr 3, 8:56 pm, justclint wrote: > I'd never used the debugger before so I had to do a little reading > first but I ran it and here's the results: > --- > Array > ( > [0] => Array > ( > [Product] => Array > ( > [id] => 1 > [name] => Item 1 > [color_id] => 2 > ) > > [Color] => Array > ( > [id] => 2 > [name] => White > ) > > ) > > [1] => Array > ( > [Product] => Array > ( > [id] => 2 > [name] => Item 2 > [color_id] => 1 > ) > > [Color] => Array > ( > [id] => 1 > [name] => Black > ) > > ) > > ) > > > So in the following under the products->color_id, I know the field is > getting populated in the table as an id but how do I get it to show > the color name that corresponds to that id? > > Thanks Brian! > > On Apr 3, 8:37 pm, brian wrote: > > > Odd. The query shows that it should be in there. Did you try the > > debug() i mentioned? ;-) > > > On Fri, Apr 3, 2009 at 10:12 PM, justclint wrote: > > > > Thanks for the quick response Brian! > > > > When I add: > > > > > > > > I get error: > > > > Notice (8): Undefined index: Color [APP\views\products\index.ctp, > > > line 48] > > > > Any suggestions? > > > > Thanks! > > > > On Apr 3, 6:56 pm, brian wrote: > > >> The SQL query is fetching Color.name. You're looking in the Product > > >> array. The Color name will be in the Color array. > > > >> > > > >> When in doubt, do a debug($this->data) in your view. > > > >> On Fri, Apr 3, 2009 at 9:48 PM, justclint wrote: > > > >> > My app is working but a couple of my fields are not pulling the data I > > >> > want. > > > >> > I have a table called products and another table called colors. My > > >> > colors table has 2 fields, id and name. > > > >> > When adding the product, you select the color (from drop down menu) > > >> > and it will insert the color id into the color_id field of the > > >> > products table. > > > >> > Once I add a product, instead of displaying the actual color it shows > > >> > the colors id. (ie: 2 instead of blue) > > > >> > How do I get my page to pull the actual color name not the color id? > > > >> > When launching the page it does the following query: > > > >> > SELECT `Product`.`id`, `Product`.`name`, `Product`.`category_id`, > > >> > `Product`.`material_id`, `Product`.`color_id`, `Product`.`sport_id`, > > >> > `Product`.`price`, `Product`.`image_link`, `Product`.`buy_link`, > > >> > `Category`.`id`, `Category`.`name`, `Material`.`id`, > > >> > `Material`.`name`, `Color`.`id`, `Color`.`name`, `Sport`.`id`, > > >> > `Sport`.`name` FROM `products` AS `Product` LEFT JOIN `categories` AS > > >> > `Category` ON (`Product`.`category_id` = `Category`.`id`) LEFT JOIN > > >> > `materials` AS `Material` ON (`Product`.`material_id` = > > >> > `Material`.`id`) LEFT JOIN `colors` AS `Color` ON > > >> > (`Product`.`color_id` = `Color`.`id`) LEFT JOIN `sports` AS `Sport` ON > > >> > (`Product`.`sport_id` = `Sport`.`id`) WHERE 1 = 1 LIMIT 20 > > > >> > I think I need the following part of the query to be changed from: > > > >> > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`id`) > > > >> > to > > > >> > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > > >> > My controller is just the default one after creating through the > > >> > console so Products->index looks like: > > > >> > function index() { > > >> > $this->Product->recursive = 0; > > >> > $this->set('products', $this->paginate()); > > >> > }
Re: retrieve specific data
I'd never used the debugger before so I had to do a little reading first but I ran it and here's the results: --- Array ( [0] => Array ( [Product] => Array ( [id] => 1 [name] => Item 1 [color_id] => 2 ) [Color] => Array ( [id] => 2 [name] => White ) ) [1] => Array ( [Product] => Array ( [id] => 2 [name] => Item 2 [color_id] => 1 ) [Color] => Array ( [id] => 1 [name] => Black ) ) ) So in the following under the products->color_id, I know the field is getting populated in the table as an id but how do I get it to show the color name that corresponds to that id? Thanks Brian! On Apr 3, 8:37 pm, brian wrote: > Odd. The query shows that it should be in there. Did you try the > debug() i mentioned? ;-) > > On Fri, Apr 3, 2009 at 10:12 PM, justclint wrote: > > > Thanks for the quick response Brian! > > > When I add: > > > > > > I get error: > > > Notice (8): Undefined index: Color [APP\views\products\index.ctp, > > line 48] > > > Any suggestions? > > > Thanks! > > > On Apr 3, 6:56 pm, brian wrote: > >> The SQL query is fetching Color.name. You're looking in the Product > >> array. The Color name will be in the Color array. > > >> > > >> When in doubt, do a debug($this->data) in your view. > > >> On Fri, Apr 3, 2009 at 9:48 PM, justclint wrote: > > >> > My app is working but a couple of my fields are not pulling the data I > >> > want. > > >> > I have a table called products and another table called colors. My > >> > colors table has 2 fields, id and name. > > >> > When adding the product, you select the color (from drop down menu) > >> > and it will insert the color id into the color_id field of the > >> > products table. > > >> > Once I add a product, instead of displaying the actual color it shows > >> > the colors id. (ie: 2 instead of blue) > > >> > How do I get my page to pull the actual color name not the color id? > > >> > When launching the page it does the following query: > > >> > SELECT `Product`.`id`, `Product`.`name`, `Product`.`category_id`, > >> > `Product`.`material_id`, `Product`.`color_id`, `Product`.`sport_id`, > >> > `Product`.`price`, `Product`.`image_link`, `Product`.`buy_link`, > >> > `Category`.`id`, `Category`.`name`, `Material`.`id`, > >> > `Material`.`name`, `Color`.`id`, `Color`.`name`, `Sport`.`id`, > >> > `Sport`.`name` FROM `products` AS `Product` LEFT JOIN `categories` AS > >> > `Category` ON (`Product`.`category_id` = `Category`.`id`) LEFT JOIN > >> > `materials` AS `Material` ON (`Product`.`material_id` = > >> > `Material`.`id`) LEFT JOIN `colors` AS `Color` ON > >> > (`Product`.`color_id` = `Color`.`id`) LEFT JOIN `sports` AS `Sport` ON > >> > (`Product`.`sport_id` = `Sport`.`id`) WHERE 1 = 1 LIMIT 20 > > >> > I think I need the following part of the query to be changed from: > > >> > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`id`) > > >> > to > > >> > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > >> > My controller is just the default one after creating through the > >> > console so Products->index looks like: > > >> > function index() { > >> > $this->Product->recursive = 0; > >> > $this->set('products', $this->paginate()); > >> > } > > >> > My Product model looks like: > > >> > var $belongsTo = array( > >> > 'Color' => array( > >> > 'className' => 'Color', > >> > 'foreignKey' => 'color_id', > >> > 'conditions' => '', > >> > 'fields' =&
Re: retrieve specific data
Thanks for the quick response Brian! When I add: I get error: Notice (8): Undefined index: Color [APP\views\products\index.ctp, line 48] Any suggestions? Thanks! On Apr 3, 6:56 pm, brian wrote: > The SQL query is fetching Color.name. You're looking in the Product > array. The Color name will be in the Color array. > > > > When in doubt, do a debug($this->data) in your view. > > On Fri, Apr 3, 2009 at 9:48 PM, justclint wrote: > > > My app is working but a couple of my fields are not pulling the data I > > want. > > > I have a table called products and another table called colors. My > > colors table has 2 fields, id and name. > > > When adding the product, you select the color (from drop down menu) > > and it will insert the color id into the color_id field of the > > products table. > > > Once I add a product, instead of displaying the actual color it shows > > the colors id. (ie: 2 instead of blue) > > > How do I get my page to pull the actual color name not the color id? > > > When launching the page it does the following query: > > > SELECT `Product`.`id`, `Product`.`name`, `Product`.`category_id`, > > `Product`.`material_id`, `Product`.`color_id`, `Product`.`sport_id`, > > `Product`.`price`, `Product`.`image_link`, `Product`.`buy_link`, > > `Category`.`id`, `Category`.`name`, `Material`.`id`, > > `Material`.`name`, `Color`.`id`, `Color`.`name`, `Sport`.`id`, > > `Sport`.`name` FROM `products` AS `Product` LEFT JOIN `categories` AS > > `Category` ON (`Product`.`category_id` = `Category`.`id`) LEFT JOIN > > `materials` AS `Material` ON (`Product`.`material_id` = > > `Material`.`id`) LEFT JOIN `colors` AS `Color` ON > > (`Product`.`color_id` = `Color`.`id`) LEFT JOIN `sports` AS `Sport` ON > > (`Product`.`sport_id` = `Sport`.`id`) WHERE 1 = 1 LIMIT 20 > > > I think I need the following part of the query to be changed from: > > > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`id`) > > > to > > > `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) > > > My controller is just the default one after creating through the > > console so Products->index looks like: > > > function index() { > > $this->Product->recursive = 0; > > $this->set('products', $this->paginate()); > > } > > > My Product model looks like: > > > var $belongsTo = array( > > 'Color' => array( > > 'className' => 'Color', > > 'foreignKey' => 'color_id', > > 'conditions' => '', > > 'fields' => '', > > 'order' => '' > > ) > > ); > > > My Color model looks like this: > > > var $hasMany = array( > > 'Product' => array( > > 'className' => 'Product', > > 'foreignKey' => 'color_id', > > 'dependent' => false, > > 'conditions' => '', > > 'fields' => '', > > 'order' => '', > > 'limit' => '', > > 'offset' => '', > > 'exclusive' => '', > > 'finderQuery' => '', > > 'counterQuery' => '' > > ) > > ); > > > And Products->index view looks like this: > > > > > > > > > > > > > > > > > > > > > > > > > > Your help is greatly appreciated. > > > 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
retrieve specific data
My app is working but a couple of my fields are not pulling the data I want. I have a table called products and another table called colors. My colors table has 2 fields, id and name. When adding the product, you select the color (from drop down menu) and it will insert the color id into the color_id field of the products table. Once I add a product, instead of displaying the actual color it shows the colors id. (ie: 2 instead of blue) How do I get my page to pull the actual color name not the color id? When launching the page it does the following query: SELECT `Product`.`id`, `Product`.`name`, `Product`.`category_id`, `Product`.`material_id`, `Product`.`color_id`, `Product`.`sport_id`, `Product`.`price`, `Product`.`image_link`, `Product`.`buy_link`, `Category`.`id`, `Category`.`name`, `Material`.`id`, `Material`.`name`, `Color`.`id`, `Color`.`name`, `Sport`.`id`, `Sport`.`name` FROM `products` AS `Product` LEFT JOIN `categories` AS `Category` ON (`Product`.`category_id` = `Category`.`id`) LEFT JOIN `materials` AS `Material` ON (`Product`.`material_id` = `Material`.`id`) LEFT JOIN `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`id`) LEFT JOIN `sports` AS `Sport` ON (`Product`.`sport_id` = `Sport`.`id`) WHERE 1 = 1 LIMIT 20 I think I need the following part of the query to be changed from: `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`id`) to `colors` AS `Color` ON (`Product`.`color_id` = `Color`.`name`) My controller is just the default one after creating through the console so Products->index looks like: function index() { $this->Product->recursive = 0; $this->set('products', $this->paginate()); } My Product model looks like: var $belongsTo = array( 'Color' => array( 'className' => 'Color', 'foreignKey' => 'color_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); My Color model looks like this: var $hasMany = array( 'Product' => array( 'className' => 'Product', 'foreignKey' => 'color_id', 'dependent' => false, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); And Products->index view looks like this: > Your help is greatly appreciated. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: view pdf files?
Thanks Brian. That helps a lot. The only thing Ive been using webroot for was just images and my ccs and js. I didnt realize it was meant to be (literally) the webroot. This is the first MVC framework I've used. Well my forms finally link correctly now. However I did notice one little detail. It doesnt bother me, I dont need to fix it but I just thought Id throw this out there. I noticed that if I had a directory in my views like: /fitness_lab/forms (forms being a folder with views in it) then I could not make the same directory in the webroot. I had to change it to: /fitness_lab/form (no 's'). Brian, thanks again for all your help! justclint On Feb 9, 6:23 pm, brian wrote: > You don't need the controller serve PDFs unless you have some reason > to keep them inaccessible to casual browsers and want to use some kind > of authorisation. In that case, you'd want to look at MediaView. > Otherwise, just let Apache serve it as any other file. Hence, you put > it under webroot. Anything that's under that directory is accessible > with a direct link--images, javascript, CSS files, etc. So, you can > create whatever directory structure you want in there if you have > reason to. > > Perhaps the confusion stems from the fact that the HtmlHelper has a > method to create image links. But, if you look carefully, you'll see > that the URL points directly to the image file under webroot, not a > controller. I think that maybe the only reason $html->image() exists > is because too many people were becoming confused by Cake's mysterious > DOCUMENT_ROOT shuffling (I was) that they were messing up their img > links. > > To answer your other question about the views dir, all those files in > there are basically templates for displaying a controller's output. > That's not the webroot, but simply a convenient directory in which to > store template files. What mscdex was suggesting is, if you happened > to have a controller action where you wanted to redirect the request > to somePDFfile, you'd use the public URL as the param to redirect(). > Something like > > $this->redirect('/fitness_lab/forms/health_questionnaire.pdf'); > > But I'm pretty sure that's not what you're after here. Just leave the > controller out of it. > > On Mon, Feb 9, 2009 at 8:01 PM, justclint wrote: > > > Thanks mscdex. Your 2nd suggestion is exactly what Im trying to do. > > Brian suggested adding the directory to webroot which works as > > intended. > > > However, I did have the pdfs in a the views folder and I tried the > > redirect() but I run into the same problem trying to define what the > > controller and action would be for apdffile. > > > How would I use this redirect to show thepdffile? > > > Thanks! > > > justclint > > > On Feb 8, 10:08 pm, mscdex wrote: > >> Generally if you are manually rendering a view, you should do: > >> $this->autoRender = false; > > >> If you are trying to get thePDFto show up instead of the controller > >> action's view, you could try doing a $this->redirect() as documented > >> here:http://book.cakephp.org/view/425/redirect --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: view pdf files?
Thanks mscdex. Your 2nd suggestion is exactly what Im trying to do. Brian suggested adding the directory to webroot which works as intended. However, I did have the pdfs in a the views folder and I tried the redirect() but I run into the same problem trying to define what the controller and action would be for a pdf file. How would I use this redirect to show the pdf file? Thanks! justclint On Feb 8, 10:08 pm, mscdex wrote: > Generally if you are manually rendering a view, you should do: > $this->autoRender = false; > > If you are trying to get the PDF to show up instead of the controller > action's view, you could try doing a $this->redirect() as documented > here:http://book.cakephp.org/view/425/redirect --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: view pdf files?
Thanks Brian. I created a folder in webroot that leads to my pdf. It works great! Just on a side note, is this a standard way of doing this, creating additional folder structures in the webroot? I was just under the impression that all this was supposed to be done in the views folder. Thanks! justclint On Feb 8, 10:45 pm, brian wrote: > Oh, I thought you meant it was a direct link to the PDF. Which your > link appears to be. But your controller action seems to be trying to > render the PDF. Do you have a route set up for > "health_questionaire.pdf" to point to > YourController::health_questionnaire()? Unless you've overloaded > render() in some funky fashion, that's not going to work. If you want > Cake to feed the PDF file, have a look at MediaView.[1] > > But, if you just need a direct link to a PDF file, the URL should > point to wherever the file is relative to the webroot dir (eg > /fitness_lab/forms/health_questionnaire.pdf if the file is in > app/webroot/fitness_lab/forms dir). Just make sure it's below webroot. > MediaView can serve files that are parked above webroot, btw (ie > inaccessible to normal requests). > > [1]http://api.cakephp.org/class/media-view > > On Mon, Feb 9, 2009 at 12:39 AM, justclint wrote: > > > Thanks for replying Brian. Actually I had a wrong link in there but > > after fixing it I dont get the error message anymore. Now it just > > renders my index page while the url still end in .pdf. > > > In my controller I got this: > > > function forms() { > > $this->pageTitle = 'Fitness Lab : Forms'; > > $this->set('page', 'forms'); > > $this->set('pageName', 'Forms'); > > $this->render('/fitness_lab/forms/index'); > > }// end forms() > > > function health_questionnaire() { > > $this->pageTitle = > > 'Fitness Lab : Forms : Health > > Questionnaire'; > > // set page info > > $this->set('page', > > 'forms'); > > > > $this->set('pageName', 'Health Questionnaire'); > > // set view file > > > > $this->render('/fitness_lab/forms/health_questionnaire.pdf'); > > }// end > > health_questionnaire() > > > Im not using a mode since the content is static. > > > In my views folder I have fitness_lab/forms. > > > My link in fitness_lab/forms/index looks like this > > > > > image('/img/logos/pdficon_small.gif', > > array('class' => > > 'pdficon')); ?> > > > If it helps heres a url to the page im working on. > > >http://www.networkfitness.com/nf_dev/fitness_lab/forms/ > > > You can see that when you click on the download a form link that the > > url displays correctly but the page does not render the pdf file. > > > Thanks! > > > justclint > > > On Feb 8, 9:18 pm, brian wrote: > >> I guess the obvious questions are, what does your link URL look like, > >> and what's in this error.php file at line 25? > > >> Shouldn't that be app_error.php, btw? > > >> On Mon, Feb 9, 2009 at 12:01 AM, justclint wrote: > > >> > Everything I've seen doing a search on google and in this group seems > >> > to be based on converting files/views to pdf. > > >> > I have pdf files that I just need to link to. I keep getting this > >> > parse error when I click on the link to the pdf file: > > >> > Parse error: syntax error, unexpected ';', expecting T_FUNCTION in / > >> > data/15/1/101/96/1753748/user/1895223/htdocs/nf_dev/app/error.php on > >> > line 25 > > >> > Is there a way to just link to existing pdf files? > > >> > Thanks! > > >> > justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: view pdf files?
Thanks for replying Brian. Actually I had a wrong link in there but after fixing it I dont get the error message anymore. Now it just renders my index page while the url still end in .pdf. In my controller I got this: function forms() { $this->pageTitle = 'Fitness Lab : Forms'; $this->set('page', 'forms'); $this->set('pageName', 'Forms'); $this->render('/fitness_lab/forms/index'); }// end forms() function health_questionnaire() { $this->pageTitle = 'Fitness Lab : Forms : Health Questionnaire'; // set page info $this->set('page', 'forms'); $this->set('pageName', 'Health Questionnaire'); // set view file $this->render('/fitness_lab/forms/health_questionnaire.pdf'); }// end health_questionnaire() Im not using a mode since the content is static. In my views folder I have fitness_lab/forms. My link in fitness_lab/forms/index looks like this image('/img/logos/pdficon_small.gif', array('class' => 'pdficon')); ?> If it helps heres a url to the page im working on. http://www.networkfitness.com/nf_dev/fitness_lab/forms/ You can see that when you click on the download a form link that the url displays correctly but the page does not render the pdf file. Thanks! justclint On Feb 8, 9:18 pm, brian wrote: > I guess the obvious questions are, what does your link URL look like, > and what's in this error.php file at line 25? > > Shouldn't that be app_error.php, btw? > > On Mon, Feb 9, 2009 at 12:01 AM, justclint wrote: > > > Everything I've seen doing a search on google and in this group seems > > to be based on converting files/views to pdf. > > > I have pdf files that I just need to link to. I keep getting this > > parse error when I click on the link to the pdf file: > > > Parse error: syntax error, unexpected ';', expecting T_FUNCTION in / > > data/15/1/101/96/1753748/user/1895223/htdocs/nf_dev/app/error.php on > > line 25 > > > Is there a way to just link to existing pdf files? > > > Thanks! > > > justclint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
view pdf files?
Everything I've seen doing a search on google and in this group seems to be based on converting files/views to pdf. I have pdf files that I just need to link to. I keep getting this parse error when I click on the link to the pdf file: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in / data/15/1/101/96/1753748/user/1895223/htdocs/nf_dev/app/error.php on line 25 Is there a way to just link to existing pdf files? Thanks! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Browser Detection?
Thanks Schreck, I just ended up using a simple js script. justclint On Feb 8, 1:24 pm, schrec...@gmail.com wrote: > Its actually better to check for functionality then browser sniffing. If you > need xpath, then test for xpath capabilities. > > if you must sniff for a browser, I would do it in the javascript since the > user agent can be spoofed. > > Schreck > Schreck > > -Original Message- > From: justclint > > Date: Sun, 8 Feb 2009 13:20:23 > To: CakePHP > Subject: Browser Detection? > > I was hoping someone could tell me what the best solution is to do > browser detection in cake. Via js or php? Is there a helper for this? > > All I need to do is check the browser to see if it is ie 6 or older so > I can send them to an "update your browser" page. > > Ive googled this and Im not finding much. > > Thanks in advance! > > Clint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Browser Detection?
I was hoping someone could tell me what the best solution is to do browser detection in cake. Via js or php? Is there a helper for this? All I need to do is check the browser to see if it is ie 6 or older so I can send them to an "update your browser" page. Ive googled this and Im not finding much. Thanks in advance! Clint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Warning 512 error, I make the tmp dir writable and I get more errors
Hello, Ive just moved our cake app over to the production server and Im getting this error also. Ive tried setting the permissions just via the web directory but not working. Im guessing the solution above will work but Im not sure how to apply the chmod recursively. Do I do this in .htaccess? Thanks! justclint On Dec 8 2008, 1:28 am, xfhxfh wrote: > ... oh nw I got it ... somehow chmod -R didn't do it recursive ... so > I had to hand chmod the dirs ... nows workin, great > thx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: acl - book 10.3.7 -setting up permissions - baking error
I forgot to mention, Im running the new 1.2 stable version and running php5 and mysql 5. justclint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
acl - book 10.3.7 -setting up permissions - baking error
So I thought I got the acl up and running smoothly and it does work to some degree but now that Im testing with various users of different categories I noticed my permissions aren't working as suspected. I did have a problem with one of the steps in the acl tutorial (pg. 10.3.7: permissions) which I just kind of bypassed but I believe this might be why its not working properly. ** 1 ** So the first step here is to go to shell and type "cake acl grant $aroAlias $acoAlias [create|read|update|delete|'*']" but the console keeps throwing back an error saying that "read is not an internal or external function". If I delete read it gives me the same error for the next unit like "update is not an internal or external function". The directions say instead of using console you can use Acl component by adding "$this->Acl->allow($aroAlias, $acoAlias);" but Im not sure where to put it and im not sure if its something you would leave in the code permanently or is it just so you can run it that one time. ** 2 ** In the 2nd step your supposed to run the function initDB() which has allow/deny statements. After running you are supposed to see a bunch of "1's" and "0's" in the aros_acos table. After running this function and checking the table, the table has a bunch of "1's" and "-1's". Is this normal or is my table totally jacked? Your help is much appreciated! Thanks! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: acl public access
So I think I got this working as intended. I added the following to all my controllers to allow public access: function beforeFilter() { parent::beforeFilter(); $this->Auth->allowedActions = array('*'); }// end beforeFilter() Now I can just use the Auth component to show only certain things on a page. But I must admit, Im scratching my head and laughing at myself wondering if due to what Im trying to do, if creating an ACL was what I really needed in the first place. Good news is I definitely learned a crap load and a bunch of details about cake came clear while building this. Anyhow, since I got the ACL working I figure Ill keep it but can anyone please tell me if what Ive done above (adding the beforeFilter function to all controllers) is a good or at least reasonable solution for what Im trying to do or is this something I should not be doing since its, well kinda defeating the purpose of an ACL. Thanks! justclint On Dec 26, 2:42 pm, justclint wrote: > Well first off, I friggin love cake. I finally got my ACL up and > running last night. So now I'm implementing it over to my already > built site and everything is working well. I am having a little issue > though and I believe it has to do with this code in my app controller. > > function beforeFilter() { > //Configure AuthComponent > $this->Auth->actionPath = 'controllers/'; > $this->Auth->authorize = 'actions'; > $this->Auth->loginAction = array('controller' => 'users', > 'action' > => 'login'); > $this->Auth->logoutRedirect = array('controller' => 'users', > 'action' => 'login'); > $this->Auth->loginRedirect = array('controller' => 'posts', > 'action' > => 'add'); > $this->Auth->allowedActions = array('display', 'index'); > }// end beforeFilter > > I'm trying to figure out how I declare what is public. Per code above > the actionPath is all controllers so controllers are on lockdown and > we allow users based on actions and then by default any actions > "display or index" can be viewed. > > For my site the whole site is public. The ACL comes in based on > membership. So lets say you are a member you would still be accessing > public pages like products for example but since you are a logged in > member you would see a cheaper price for the product. The only section > per say that I can think of that I want to be totally on lockdown is > the users account page. In future I may add sections specifically for > them but I dont have dedicated areas just yet for members. > > So basically to refine my question, how do I seperate public and > private access without declaring every single public action in $this- > > >Auth->allowedActions = array('display', 'index'); > > Oh and one other question that Ive been trying to figure out. Is it > possible to put subfolders in the controllers forlders or is it > something you should not do or maybe can do based on certain > scenarios. > > Thanks!!! > > justclint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
acl public access
Well first off, I friggin love cake. I finally got my ACL up and running last night. So now I'm implementing it over to my already built site and everything is working well. I am having a little issue though and I believe it has to do with this code in my app controller. function beforeFilter() { //Configure AuthComponent $this->Auth->actionPath = 'controllers/'; $this->Auth->authorize = 'actions'; $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'posts', 'action' => 'add'); $this->Auth->allowedActions = array('display', 'index'); }// end beforeFilter I'm trying to figure out how I declare what is public. Per code above the actionPath is all controllers so controllers are on lockdown and we allow users based on actions and then by default any actions "display or index" can be viewed. For my site the whole site is public. The ACL comes in based on membership. So lets say you are a member you would still be accessing public pages like products for example but since you are a logged in member you would see a cheaper price for the product. The only section per say that I can think of that I want to be totally on lockdown is the users account page. In future I may add sections specifically for them but I dont have dedicated areas just yet for members. So basically to refine my question, how do I seperate public and private access without declaring every single public action in $this- >Auth->allowedActions = array('display', 'index'); Oh and one other question that Ive been trying to figure out. Is it possible to put subfolders in the controllers forlders or is it something you should not do or maybe can do based on certain scenarios. Thanks!!! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Simple ACL tutorial ?'s
Im setting up my first acl app. Ive tried a number of tutorials but all of them seem to have gaps in between instructions leaving me at a deadend. I figure Im just going to use the Simple ACL tutorial at: http://book.cakephp.org/view/641/Simple-Acl-controlled-Application But I run into the same problems. Ive installed a fresh copy of cake 1.2. Ive created my tables per the tutorial. Heres where I get stuck though. The tutorial like all others Ive dealt with skip steps here. The tutorial says at this point: "Use cake bake to quickly create your models, controllers, and views. Leave out admin routing for now, this is a complicated enough subject without them. Also be sure not to add either the Acl or Auth Components to any of your controllers as you are baking them. We'll be doing that soon enough. You should now have models, controllers, and baked views for your users, groups, posts and widgets." 1. My question here is, when I go into my console to build these mvc's for the users, groups, posts, and widgets there are many options that the console asks you. So where is the info on how exactly I should set up my mvc's for this tutorial? For the controller should I build controller interactively?, include class methods?, use scaffolding?, etcIn my models should I add validation fields? define model association: has many, belongs to, etc On the following page of the tutorial it states: "We now have a functioning CRUD application. Bake should have setup all the relations we need, if not add them in now. " 2. So here it says we now have a functioning CRUD application. So I guess that means in my 1st question I should of created my controllers with class methods? Anyway the part that says "Bake should have setup all the relations we need, if not add them in now." is stumping me. So what are these relations? is this referring to the has many, belongs to associations? If so, what are the relations this tutorial wants me to setup. Which tables belong to many and which ones are hbabt? After reading through this google group I had found some people saying they followed this tutorial and got it up and running with no problem. I do acknowledge that it is my level of cake experience (or lack of I should say) that makes this confusing for me. But any help on this would be extremely appreciated. Thank you so much! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Improved Captcha Component not validating
I forgot to add my code. my controller: the send() is for my email on contact form and the captcha() and add() are from the component. Obviously Im trying to get captcha to validate to allow email send. function send() { $this->Contact->set($this->data); $this->Email->template = 'email/contact'; // this will use contact_html.ctp $this->Email->from = $this->data['Contact']['Email']; $this->Email->fromName = 'Web Inquiry'; $this->Email->to = 'justcl...@gmail.com'; //$this->Email->cc = 'justcl...@gmail.com'; $this->Email->subject = 'Network Fintess - Contact Request'; $result = $this->Email->send(); $this->redirect('thankyou'); exit(); }// end send() function captcha() { $this->Captcha->show(); }// end captcha() function add() { if (!empty($this->data) && $this->Captcha->protect()) { $this->ModelName->save($this->data); } }// end add() - my form: the action is going to send. I believe this may be problem because as some point on submit it needs to check captcha but Im just not getting how to tie it all together. - create(array('class' => 'contact', 'type' => 'post', 'action' => 'send')); ?> Contact Info label('Name:'); ?> input('Name', array('div' => false, 'label' => false, 'class' => 'required')); ?> label('Email:'); ?> input('Email', array('div' => false, 'label' => false, 'class' => 'required email')); ?> label('Phone:'); ?> input('Phone', array('div' => false, 'label' => false)); ?> Message textarea ('details', array('class' => 'required')); ?> input(); ?> submit('Send Message'); ?> end(); ?> --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Improved Captcha Component not validating
Ive just gone throught the Improved Captcha Component and it was super easy to install. The only problem Im having is that it doesnt seem to be validating. If i hit submit on my form it gets submitted whether captcha input is correct or not. The directions state the following: "First in the controller you want to implement it into add the component then create a function called captcha and and in the following and on the form you want to protect where it checks if the data is empty just add "&& $this->Captcha->protect()". That will return a boolean back." Im a bit confused about this part: && $this->Captcha->protect() It seems to reside in the add() function (default code) and Ive tried putting it into the caption function as well as in my form as directions state above but just cant get it to work. Any ideas on this one? Thanks! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: exclude form helper markup?
Thanks guys!!! Yeah, just like you gearvOsh, I am working around a pre- css project. But ideally I do want to use the cakephp format as much as possible so I will definitely take your Adam on future projects. But this simple solution is a significant help to me so thanks again! justclint On Dec 21, 3:27 pm, gearvOsh wrote: > @Adam - Theres nothing wrong with it, but when you have fancy forms > and pre-cssed systems, cakes markup just gets in the way/breaks things. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
exclude form helper markup?
I notice when I use the form helper like: input('Email'); ?> it keeps resulting with an added div tag around it like so: Email Is there a way to prevent the form adding its own markup? Also, I notice cakephp automatically gives the input name the name of the label. But say I want my label and input name to be different. How do I accomplish this? For example, I would like my label to be Email: (with :) but I dont want the : in my input name. Thanks! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: basic email via contact form
Hi Alexander, well I just couldn't get away from the computer last night. It was driving me nuts. I found out what my problem was and it was being caused in my routes.php. Thanks! Clint On Dec 21, 3:12 am, Alexandru Ciobanu wrote: > http://www.google.com/search?q=cakephp+contact+form > > Check out first 2 hits. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
basic email via contact form
Hello all, I am building my first site with cakephp and Im now putting together a simple contact form for the site but Im running into problems. Ideally Id like to use phpmailer. But I cant find much info on setting this vendor up in the framework. Ive been to http://bakery.cakephp.org/articles/view/sending-email-with-phpmailer but didnt help much and I cant find any tutorials online on setting this up. What I have so far is the method explained in the link above. I guess I want to know how you tie it all together. On my contact form, how do I tell it to go and send the email? Every time I hit submit it tells me either it cant find the controller (because it keeps looking for plural name -which my controller is singular-static page) or if I change the action in the form then it cant find the view. Im running cake 1.2 and php5. My current code receiving this error is as follows: - ERROR - Missing View Error: The view for ContactController::display() was not found. Error: Confirm you have created the file: /nfs/c03/h03/mnt/53057/ domains/dzinewize.com/html/client_dev/network_fitness_cake/app/views/ contact/send.ctp Notice: If you want to customize this error message, create app/views/ errors/missing_view.ctp -- CODE -- Controller: (with no model associated) contact_controller.php @path: app/controllers/ set('site_section', 'sect-contact'); $this->set('sect_title', 'Contact : '); $this->layout = 'content'; $path = func_get_args(); if (!count($path)) { $this->redirect('/'); } $count = count($path); $page = $subpage = $title = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title')); $this->render(join('/', $path)); }// end display() function send() { $this->set('data', $data); $this->Email->to = 'justcl...@dzinewize.com'; $this->Email->subject = 'my test email'; $result = $this->Email->send(); }// end send() } ?> View: (the form) contact.php @path: app/views/contact/ create(array('Contact', 'type' => 'post', 'action' => 'send')); ?> Contact Info input('Name', array('type' => 'text', 'name' => 'name')); ?> input('Email'); ?> input('Phone'); ?> Message textArea ('message'); ?> submit('Send Message'); ?> end(); ?> And then I have the component email.php with the contents as described in the link above. Ive been trying to figure this out for about 3 days now and Im not finding any additional helpful info on the web so any help on getting this simple send mail function is greatly appreciated. If supplying a link to the contact form helps, then just let me know and Ill email it your way. Thanks guys! justclint --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: basic site concept
Man you guys are Awesome! Thanks so much for the support. And dr. Hannibal, I just saw the info on the CMS your working on, NeutrinoCMS. Once I finish up this site I would like to add a CMS to it so you'll probably hear more from me. Thanks again everyone! Clint On Nov 6, 8:37 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > Hi Clint, > > Of course you can have as many controllers as you need. Since you're > not familiar with Cake yet, maybe the best thing to do is to learn by > reading some code, just go through some of these applications: > > http://book.cakephp.org/view/511/Applicationshttp://cakeforge.org/top/mostactive.php > > and try to figure out how they work (with the assumption that you're > already familiar with regular PHP). > > Welcome to cake family! ;) > > On Nov 6, 4:30 pm, justclint <[EMAIL PROTECTED]> wrote: > > > Thank you so much Anja and dr. Hannibal. This helps me very much. As > > you described dr. Hannibal your not sure why I would want many apps > > for what Im doing and nor do I. So having you confirm that I can do > > all this in a single cake folder is a relief. > > > So I guess than its true to say that I can have one app folder and I > > can just keep adding as many controllers, models and views as I > > please. > > > I really do appreciate your help here. > > > Thanks again! > > > Clint > > > On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > > > > I'm not sure why would you want many apps for what you've described. > > > Your "products section" would actually be ProductsController and > > > Product model, your "search" and "download" functionality are just > > > SearchController and DownloadsController and their respective models > > > and views etc.. > > > > Normally, a single app is enough for all your needs. Even if it isn't, > > > you can still use cake plugins.. > > > > Hope that helps! > > > > On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote: > > > > > Hello all, thanks for having this group available for newbies like > > > > myself. I have a pretty basic question that Im having a very difficult > > > > time finding an answer on. I've done google searches, read the cakephp > > > > manual and I am also reading the book "Beginning CakePHP" by David > > > > Golding which is a great book by the way. > > > > > Any way I've never used a framework before and Im totally new to the > > > > MVC concept. Ive done a couple tutorials such as the blog and also a > > > > to-do list. I have a site I will be converting over to cakephp and > > > > want to make sure I am using best practices and that I understand the > > > > basic concept. > > > > > So my question is; if Im building a whole website, is the whole > > > > website a "cakephp app" or does my whole website have many "cakephp > > > > apps"? > > > > > Through my reading it seems every tutorial is based on just a piece of > > > > a website (ie: blog) and every tutorial required a new cake folder > > > > with the usual contents (app, controllers, views, webroot etc.). > > > > > I need to make a single typical website with the usual stuff like > > > > products section, support section with search/download functionality > > > > and contact/request forms. > > > > > Im not sure if each one of these things are supposed to be different > > > > apps or if the whole site is in one app. It seems a bit cumbersome to > > > > keep adding cake folders over and over on a single site but nothing > > > > Ive read says otherwise. Also, If you are supposed to keep adding cake > > > > folder after cake folder you would endup with multiple webroot folders > > > > which also kinda of boggles my mind. > > > > > Your help is greatly appreciated and I do apologize for having such a > > > > primitive question but I have no where else to go but here. > > > > > Thanks again! > > > > > Cheers, > > > > > Clint --~--~-~--~~~---~--~~ 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: basic site concept
Thank you so much Anja and dr. Hannibal. This helps me very much. As you described dr. Hannibal your not sure why I would want many apps for what Im doing and nor do I. So having you confirm that I can do all this in a single cake folder is a relief. So I guess than its true to say that I can have one app folder and I can just keep adding as many controllers, models and views as I please. I really do appreciate your help here. Thanks again! Clint On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > I'm not sure why would you want many apps for what you've described. > Your "products section" would actually be ProductsController and > Product model, your "search" and "download" functionality are just > SearchController and DownloadsController and their respective models > and views etc.. > > Normally, a single app is enough for all your needs. Even if it isn't, > you can still use cake plugins.. > > Hope that helps! > > On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote: > > > Hello all, thanks for having this group available for newbies like > > myself. I have a pretty basic question that Im having a very difficult > > time finding an answer on. I've done google searches, read the cakephp > > manual and I am also reading the book "Beginning CakePHP" by David > > Golding which is a great book by the way. > > > Any way I've never used a framework before and Im totally new to the > > MVC concept. Ive done a couple tutorials such as the blog and also a > > to-do list. I have a site I will be converting over to cakephp and > > want to make sure I am using best practices and that I understand the > > basic concept. > > > So my question is; if Im building a whole website, is the whole > > website a "cakephp app" or does my whole website have many "cakephp > > apps"? > > > Through my reading it seems every tutorial is based on just a piece of > > a website (ie: blog) and every tutorial required a new cake folder > > with the usual contents (app, controllers, views, webroot etc.). > > > I need to make a single typical website with the usual stuff like > > products section, support section with search/download functionality > > and contact/request forms. > > > Im not sure if each one of these things are supposed to be different > > apps or if the whole site is in one app. It seems a bit cumbersome to > > keep adding cake folders over and over on a single site but nothing > > Ive read says otherwise. Also, If you are supposed to keep adding cake > > folder after cake folder you would endup with multiple webroot folders > > which also kinda of boggles my mind. > > > Your help is greatly appreciated and I do apologize for having such a > > primitive question but I have no where else to go but here. > > > Thanks again! > > > Cheers, > > > Clint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
basic site concept
Hello all, thanks for having this group available for newbies like myself. I have a pretty basic question that Im having a very difficult time finding an answer on. I've done google searches, read the cakephp manual and I am also reading the book "Beginning CakePHP" by David Golding which is a great book by the way. Any way I've never used a framework before and Im totally new to the MVC concept. Ive done a couple tutorials such as the blog and also a to-do list. I have a site I will be converting over to cakephp and want to make sure I am using best practices and that I understand the basic concept. So my question is; if Im building a whole website, is the whole website a "cakephp app" or does my whole website have many "cakephp apps"? Through my reading it seems every tutorial is based on just a piece of a website (ie: blog) and every tutorial required a new cake folder with the usual contents (app, controllers, views, webroot etc.). I need to make a single typical website with the usual stuff like products section, support section with search/download functionality and contact/request forms. Im not sure if each one of these things are supposed to be different apps or if the whole site is in one app. It seems a bit cumbersome to keep adding cake folders over and over on a single site but nothing Ive read says otherwise. Also, If you are supposed to keep adding cake folder after cake folder you would endup with multiple webroot folders which also kinda of boggles my mind. Your help is greatly appreciated and I do apologize for having such a primitive question but I have no where else to go but here. Thanks again! Cheers, Clint --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---