Right way to handle 'errant' attempts to browse my content when it changes?
I suspect I am making google very angry. I have a general content management application. In my actions I validate all the input to make sure all is cpoacetic. However what is the 'proper' action I should take when ggogle for example comes along and requests a page that has been deleted? For example www.mysite.com/myapp/action/view/134 might be fine and dandy on Monday, but on Wednesday the user deletes something and now record 134 no longer exists. I detect in the view action (for example) that the requested id is no longer around but what should I throw up there for the entity that requested the web page? Right now I do the following when I detect these requests for deleted data pages: $this->cakeError('error404',array(array('url'=> 'http://' . MY_SERVER_NAME . $_SERVER['REDIRECT_URL']))); $this->Session->setFlash($this->action . ': Invalid ID.'); $this->redirect(array('action'=>'index'), null, true); // GO TO A KNOWN GOOD PAGE Is there a better approach? --~--~-~--~~~---~--~~ 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: where is my post
Hi Gwoo, good to see my message as well as your reply.i think i got to see my message becz u reply it. but still my previous message was not appeared. the message u replied was my 3rd time post. On Sep 18, 6:27 pm, Gwoo <[EMAIL PROTECTED]> wrote: > Maybe you forgot to read the part about this group where it says "The > group is moderated to prevent spam, so please be patient if you are > new member."http://groups.google.com/group/cake-php/about --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Completely Dynamic Reporting
Hi All, My client is requiring some reports, their site is built using 1.1, but they would ideally like the ability to completely customise the report, so for example, they choose the tables included in the report, and the fields etc. I think that maybe it isn't possible due to the amount of combinations that there could be, but I was wondering if there is already a module that achieves this, and if not, if anyone has any thoughts on how I could achieve this, if it is even possible. Thanks Patrick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP + Flash
Hi, Im interested in your results about flash, now thats be ok or not, can yo tell me some suggest o comments about cakephp + flash thanks On 18 ago, 13:24, Pettor <[EMAIL PROTECTED]> wrote: > Ohh thanks for the tips! > > I will test them tomorrow. The way of fetching variables through the > tag looks nice! > > Thanks! I reply if i get into trouble :). --~--~-~--~~~---~--~~ 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: Caching doesnt work for some actions
Thanks was searching for this answer :) On 15 sep, 20:10, Kenchu <[EMAIL PROTECTED]> wrote: > Okay found the problem. Apparently you have to include both the > actiond AND the controller, for example > > var $cacheAction = array > ( > 'index' => '5 sec', > 'view' => '5 sec', > ); > > should be > > var $cacheAction = array > ( > 'posts/index' => '5 sec', > 'posts/view' => '5 sec', > ); > > if youre in the posts controller. > > On Sep 14, 2:07 pm, Kenchu <[EMAIL PROTECTED]> wrote: > > > Okay, this is REALLY weird. I tried copying the index action and its > > view to another name. It seems like unless the name of the action is > > 'index', the caching will not work. Again, the actions I have are > > IDENTICAL. The only thing that is different is the name. > > > HOWEVER. If you change the $cacheAction to a string instead (so it is > > the same for all actions, i.e. $cacheAction = '1 hour' for example), > > then it DOES work. wtf? > > > On Sep 13, 12:48 pm, Kenchu <[EMAIL PROTECTED]> wrote: > > > > I've got this code: > > > > var $helpers = array('Cache'); > > > var $cacheAction = array > > > ( > > > 'index' => '+1 hour', > > > 'view' => '+1 hour' > > > ); > > > > [...] > > > > function view($id = null) { > > > if (!$id) { > > > $this->Session->setFlash(__('Invalid Post.', > > > true)); > > > $this->redirect(array('action'=>'index')); > > > } > > > $this->set('post', $this->Post->read(null, $id)); > > > } > > > > function index() { > > > $data = $this->Post->findAll(); > > > $this->set('posts', $data); > > > } > > > > Caching for the index works, but the queries for the view action will > > > always be makde. Why? I've tried changing $cacheAction to view slash > > > (/) instead, but that didnt do any difference. Fact is, if I did it > > > for the index, index caching wouldnt work either at all. > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Apress Beginning CakePHP Model Function Error
I am going through the Apress book, and I ran across an issue that I had to use the Cake API to resolve. (For Reference in book.. this is on page 106) The function it gave me to put into the Post model for the blog application is as follows: function findByYear($year=null) { $date = $year.'-01-01 00:00:00'; $end_date = $year.'-12-31 23:59:59'; return $this- >find('all',array('conditions'=>array('DATE(Post.date)'=>'>'. $date,'DATE(Post.date)'=>'<'.$end_date))); } Basically I was getting nothing returned... So I turned to the API and found the findAll and find model functions and I changed my code for the return to: return $this->findAll("Post.date > '".$date."' AND Post.date < '". $end_date."'"); Now it works... Did I just stumble on some bad code in the book? Or should the syntax given in the book supposed to have worked? Thanks, Jason Hardy www.loudcreative.com --~--~-~--~~~---~--~~ 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: Got Error when try the tutorial of "The CakePHP Blog Tutorial with SMARTY"
Do you anywhere where it is explained how to use the View class. That would be helpful in figuring this out. You probably specified a $this->view = ''; in the controller class. On Sep 16, 2:09 pm, Steven <[EMAIL PROTECTED]> wrote: > Hi, > > I just got an error when try the tutorial of "The CakePHP Blog > Tutorial with SMARTY". > Tutorial > link:http://bakery.cakephp.org/articles/view/the-cakephp-blog-tutorial-wit... > > I think I have followed the instructions exactly as what the tutorial > said, but still comes up with the following error message "Fatal > error: Class 'SmartyView' not found in C:\Site\phpCake\cake\libs > \controller\controller.php on line 709". > > I have tried to do research to resolve this but not succeed. If anyone > have similiar experience, could you help me out? > > Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination of search results
Hi all, I know there's a lot of info around on this already but I haven't been able to solve this issue myself. I'm just setting up a simple search which will trawl through the titles and bodies of news items. I borrowed some code from the bakery here: http://bakery.cakephp.org/articles/view/paginating-with-fulltext-searches I made a few minor changes but it's more or less the same in my news controller: function admin_search() { $this->News->recursive = 1; $conditions = array(); if (isset($this->params['url']['q'])) { $input = $this->params['url']['q']; App::import('Sanitize'); $q = Sanitize::escape($input); $options['conditions'] = array("MATCH(News.title,News.body) AGAINST('$q' IN BOOLEAN MODE)"); } $this->set(array('results' => $this->paginate('News', $options['conditions']))); } In the bakery article they just had: $this->set(array('results' => $this->paginate('News', $options))); But that wouldn't work for me? So according to the manual to pass the query string to the paginator I just put this line of code at the top of my view: options(array('url' => $this->passedArgs)); ?> So it works as in it returns the first page of results (via /admin/ news/search?q=test) but when I hover over the next/back/page number/ filter links it doesn't pass on the search query string it just looks like: /admin/news/search/page:2 If I manually enter a query string it works perfectly i.e. /admin/news/ search/page:2?q=test Any ideas why the querystring isn't being used by the paginator? TIA. -Brett. --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
pr($this->validationErrors) in your view will show you the errors. --- Brett Wilton http://wiltonsoftware.com On Fri, Sep 19, 2008 at 12:31 PM, David C. Zentgraf <[EMAIL PROTECTED]> wrote: > > On 18 Sep 2008, at 23:53, 703designs wrote: > >> So a rendered view will automatically receive validation messages? In >> which variable? > > Yes. When a model is validated in the controller, invalid fields will > be noted in a variable. Don't know of the top of my head in which one, > do a debug($this) in the view and you'll find it. You don't need to > worry about it though. The FormHelper automatically picks up on this > variable and prints corresponding error messages. It also picks up on > data in $this->data to fill in form fields, that's how data is "handed > back" to the form. The important thing for this to work is that the > Model.field names are correct, but if it returns to the same form > (read: renders the same view) the data came from this shouldn't be a > problem. > > You can manually invalidate fields in the controller if you want to > test this procedure. > --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
On 18 Sep 2008, at 23:53, 703designs wrote: > So a rendered view will automatically receive validation messages? In > which variable? Yes. When a model is validated in the controller, invalid fields will be noted in a variable. Don't know of the top of my head in which one, do a debug($this) in the view and you'll find it. You don't need to worry about it though. The FormHelper automatically picks up on this variable and prints corresponding error messages. It also picks up on data in $this->data to fill in form fields, that's how data is "handed back" to the form. The important thing for this to work is that the Model.field names are correct, but if it returns to the same form (read: renders the same view) the data came from this shouldn't be a problem. You can manually invalidate fields in the controller if you want to test this procedure. > If I need to set a var, what should my target be > ($this->set('errors', /* what here? */))? I tried substituting a > minLength 1 rule yesterday and if it worked, I would not have changed > it, although I can't with certainty say whether validation simply > never happened or if I got these same errors. > > I think that if I render index, that will do the job, as long as I can > get error messages to present. Isn't there a resource about this > (practical form validation)? The blog application, if I recall > correctly, just saves data but doesn't address any fields on an > individual basis, which I need for my template. I know that I'm > missing something, and the Model, View, and Controller sections of the > Cookbook aren't doing much to find the answer (same goes for the > FormHelper and EmailComponent API docs, the latter of which is > definitely a work in progress)? > > On Sep 18, 10:36 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> I'm not 100% sure, but I think older versions of Cake required you to >> specify a rule. If you're only interested in the 'required' field, >> specify a rule that'll always validate, like '/.*/' . What version of >> Cake are you using? >> >> Structure your app the way you see fit. It's not good form to use >> index() to add data to the database, but that's up to you to decide. >> Either you make sure that the form submits to the right action (see >> $form->create() options), or that the action renders the appropriate >> view when it's done. What works better for you I don't know. >> >> On 18 Sep 2008, at 23:18, 703designs wrote: >> >>> Right, that was a typo, not a paste. I think that you'll be able to >>> better help me if you understand how I've designed my contact form: >> >>> Model: Contact[name, email, city, subject, message, and a couple >>> others] >>> Model['validate']: Name, email, and message have 'required' => true >>> Views: index (just passes in a pageTitle from the controller and >>> renders a form from the model using $this->form->create('Contact') >>> or >>> equivalent -- works fine. This form automatically mapped to >>> ContactsController::add(), so I created that method and put all of >>> the >>> relevant mail logic in there. >> >>> So should I move this logic into index() and force the form to use >>> that method? Or force a render of the index view and find some way >>> to >>> pass in the validation errors? >> >>> Thanks for the help! >> >>> On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: On 18 Sep 2008, at 21:50, 703designs wrote: >> > I got funny preg_match errors >> Show us your $validate rules then or go through them with a fine comb. >> > $this->Contact->set('$this->data); >> I hope this is not copy&pasted as it's invalid PHP. >> > This controller's 'add' method just sends out emails > and flashes a message to the homepage. What do I need to do for > the > form to point to this method, but for validation errors to show up > on > the form (repopulating fields)? >> What view is your form in then? The add action will automatically try to render the add view, naturally. If this is not where your form is, override it with $this->render(); >> > This is not very well-documented, or > if it is, I had difficulty finding an answer. >> http://book.cakephp.org/view/428/render >> >> > > --~--~-~--~~~---~--~~ 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: Populating a selectTag using jQuery AJAX
First, thank you both, teknoid and hydra12, for your contributions. They got me headed in the right direction. BTW, this version of the JavaScript only displays the xml text in an alert for testing purposes. Second, this is working for me: - In the JavaScript: function display_select_event() { // Get the selected campaign ID. var select_obj = document.getElementById( 'select_campaign' ); var selected_campaign_id = select_obj.options[select_obj.selectedIndex].value; // Get the events for this campaign. $.get( 'get_events/' + selected_campaign_id, { }, function( xml ) { alert( xml ); }, 'XML' ); // Make the select event opject visible. document.getElementById( 'select_event_A' ).style.visibility = 'visible'; } - In the controller: function get_events( $campaign_id ) { $this->layout = 'ajax'; $conditions = array( 'CampaignID' => $campaign_id ); $fields = array( 'CEventID', 'Name' ); $result = $this->Event->findAll( $conditions, $fields, null, null, 1, null ); if( count( $result ) ) { $xml = ''; foreach( $result as $key => $value ) { foreach( $value as $id => $name ) $xml .= ''; $xml .= '' . $value['Event']['CEventID'] . ''; $xml .= '' . $value['Event']['Name'] . ''; $xml .= ''; } } else { // What if there are no events for this campaign. } $this->set( 'xml', $xml ); } - In the view ( get_events.thtml ): - In the layout ( ajax.thtml ): - Many thanks, Peter - --~--~-~--~~~---~--~~ 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: Image resizing --> point in right direction please :)
Well, phpThumb is an amazing tool, and there are some Cake wrappers available on the bakery... On Sep 18, 12:22 pm, Daniel Hofstetter <[EMAIL PROTECTED]> wrote: > Hi Alex, > > > we are coming across the problem of users insisting on uploading 2000 > > x 2000px images onto our system and regardless of how amuzing it is to > > see your computer screen being eaten by a oversized product image, it > > is very annoying. > > > We need to create a way of automatically resize (both dimensions and > > file size) the files on upload before saving them. > > > Could anyone point us in the right direction to do this within cake? > > Have a look at the bakery,http://bakery.cakephp.org, there are some > solutions described (search with "resize" in the "code" section"). > > Hope that helps! > > -- > Daniel Hofstetterhttp://cakebaker.42dh.com --~--~-~--~~~---~--~~ 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: Generate Excel from database problem (rendering layout)
have you tried using $this->log() and double check that App::import is calling the right file 2008/9/18 mario <[EMAIL PROTECTED]> > > Thanks majna. But I can't set the debug mode to 1 since the script > will no longer run in 1.2 > if I do that. > > > On Sep 18, 12:23 pm, majna <[EMAIL PROTECTED]> wrote: > > set debug mode to 1. maybe you get "missingAction" error form cake. > > > > On Sep 18, 7:07 pm, mario <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello guys, > > > > > I want to generate and excel spreadsheets based from my > > > database query and I've come across this tutorialhttp:// > bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f > > > > > I've followed every instructions but I can't get it working. > > > > > I have a "reservations" contoller and it has a view called "report" > > > and two layouts "default.ctp" and "excel.ctp" > > > My default.ctp contains my main layout for html display and excel.ctp > > > contains the layout for rendering the excel file. > > > > > Everytime i visit the > linkhttp://localhost/{myproject}/reservations/report, > > > I get this error > > > > > Error: The requested address '/reservations/report' was not found on > > > this server. > > > > > I've tried things commenting out the line > > > $this->render('action','excel'); > > > in my reservations controller (report function) > > > > > and renaming excel.ctp to default.ctp and everything works fine. > > > > > I think the problem has to do with rendering my layout and I just > > > can't find the solution for it. > > > Please help me since I'm already beyond my deadline in my project. > > > > > Thanks, > > > > > Mario > > > --~--~-~--~~~---~--~~ 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: Generate Excel from database problem (rendering layout)
Thanks majna. But I can't set the debug mode to 1 since the script will no longer run in 1.2 if I do that. On Sep 18, 12:23 pm, majna <[EMAIL PROTECTED]> wrote: > set debug mode to 1. maybe you get "missingAction" error form cake. > > On Sep 18, 7:07 pm, mario <[EMAIL PROTECTED]> wrote: > > > > > Hello guys, > > > I want to generate and excel spreadsheets based from my > > database query and I've come across this > > tutorialhttp://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f > > > I've followed every instructions but I can't get it working. > > > I have a "reservations" contoller and it has a view called "report" > > and two layouts "default.ctp" and "excel.ctp" > > My default.ctp contains my main layout for html display and excel.ctp > > contains the layout for rendering the excel file. > > > Everytime i visit the linkhttp://localhost/{myproject}/reservations/report, > > I get this error > > > Error: The requested address '/reservations/report' was not found on > > this server. > > > I've tried things commenting out the line > > $this->render('action','excel'); > > in my reservations controller (report function) > > > and renaming excel.ctp to default.ctp and everything works fine. > > > I think the problem has to do with rendering my layout and I just > > can't find the solution for it. > > Please help me since I'm already beyond my deadline in my project. > > > Thanks, > > > Mario --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth Redirect Problems
> Sometimes it redirects to my intended target. Other times it > redirects to the page (or action/view) that I visited prior to > visiting the login page. Same problem for me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problem with shells and app::import
I was wondering if anyone could help me with this. I have some shells that I have in my vendor folder for my app but when I try to run them from the command line they all come up saying that class 'app' could not be found. This is coming from the app::import command but I can't figure out what is wrong. I have the lastest version of cake so I know thats not the problem. Any help would be great thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Generate Excel from database problem (rendering layout)
set debug mode to 1. maybe you get "missingAction" error form cake. On Sep 18, 7:07 pm, mario <[EMAIL PROTECTED]> wrote: > Hello guys, > > I want to generate and excel spreadsheets based from my > database query and I've come across this > tutorialhttp://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f > > I've followed every instructions but I can't get it working. > > I have a "reservations" contoller and it has a view called "report" > and two layouts "default.ctp" and "excel.ctp" > My default.ctp contains my main layout for html display and excel.ctp > contains the layout for rendering the excel file. > > Everytime i visit the linkhttp://localhost/{myproject}/reservations/report, > I get this error > > Error: The requested address '/reservations/report' was not found on > this server. > > I've tried things commenting out the line > $this->render('action','excel'); > in my reservations controller (report function) > > and renaming excel.ctp to default.ctp and everything works fine. > > I think the problem has to do with rendering my layout and I just > can't find the solution for it. > Please help me since I'm already beyond my deadline in my project. > > Thanks, > > Mario --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I change the path of webroot/js and webroot/css?
thank you On Thu, Sep 18, 2008 at 7:30 PM, hydra12 <[EMAIL PROTECTED]> wrote: > > This is configured in /cake/cake/config/paths.php. I don't know if > there is a way to configure this on a per app basis or not. You'll > have to be careful, though. It's configured in 2 different places - > once for the absolute path, and once for the web path. > > On Sep 18, 9:27 am, MarcS <[EMAIL PROTECTED]> wrote: >> I've been trying to locate this in the cookbook but I couldn't find >> it. >> >> Is there a way to configure cake to change the default paths for the >> js and css directories inside the webroot dir? >> >> thanks, >> Marc > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How can I change the path of webroot/js and webroot/css?
This is configured in /cake/cake/config/paths.php. I don't know if there is a way to configure this on a per app basis or not. You'll have to be careful, though. It's configured in 2 different places - once for the absolute path, and once for the web path. On Sep 18, 9:27 am, MarcS <[EMAIL PROTECTED]> wrote: > I've been trying to locate this in the cookbook but I couldn't find > it. > > Is there a way to configure cake to change the default paths for the > js and css directories inside the webroot dir? > > thanks, > Marc --~--~-~--~~~---~--~~ 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: Form data from a view element
Just to add more information: It seems that beforeFilter() is called in my comments controller but something goes wrong before afterFilter() is called... I'm trying to spelunk my way through the cakePHP code to see if I can find a reason for this - Dan On Sep 18, 11:39 am, Daniel <[EMAIL PROTECTED]> wrote: > Hi Luenyar, > > I changed the form create line to: > > create('Comment', array('action' => 'add', 'url' => > array('controller' => 'comments', 'action' => 'add'))); ?> > > And when I submit the element form it _does_ send me to the right > url, that is /comments/add which is the right controller, but it still > says "0 query took ms" and doesn't spew any of the debugging info that > I put in the add() function of the Comments controller. > > I'm beginning to think the problem is handing the data off to the > controller. With the debug for cake set in core.php to FULL debug > (i.e. with controller info). I get NO controller information spewed. > > Any more ideas? II've been working at this since before the > original post with no progress to a solution :( > > - Dan > > On Sep 17, 10:12 pm, Luenyar <[EMAIL PROTECTED]> wrote: > > > $form->create('Comment') associates the form with the 'Comment' model, > > but not a controller. Presumably because the 'Comments' model could > > be used in many or all of your controllers with $uses. The 'action' > > option assumes the current controller, so if you render your element > > in the Posts controller, the action is assumed /posts/add. url is the > > option you are looking for. > > >http://manual.cakephp.org/view/183/Creating-Forms#options-url-186 > > > Hope that helps, > > Milton > > > On Sep 16, 11:31 am, Daniel <[EMAIL PROTECTED]> wrote: > > > > I created the form using the line: > > > > $form->create('Comment', array('action' => 'add')); > > > > Doesn't this specify that it should use the controller associated with > > > the "Comment" model, i.e. the Comments controller? This is how I've > > > done it with all of my other forms... > > > > And yes, I realize the table based layout is terrible, I'm just > > > mocking things at the moment and didn't want to write a stylesheet to > > > position things yet. > > > > Thanks! > > > > - Dan > > > > On Sep 16, 11:23 am, mark_story <[EMAIL PROTECTED]> wrote: > > > > > On Sep 16, 9:11 am, Daniel <[EMAIL PROTECTED]> wrote: > > > > > > Hello, > > > > > > I currently have a "comment box" view element that I plan to > > > > > embed in various places in my CakePHP application to allow users to > > > > > leave comments on various aspects of the site. > > > > > > I'm using the form helper inside of the element to generate the > > > > > form to be used to submit the data, however when I submit the data I > > > > > receive only a blank screen that says "0 query took ms". I've even > > > > > added debugging echoes to the controller to print the data array and > > > > > I'm still just receiving a blank page with "0 query took ms". > > > > > > Attached below is the comment "add" method and the respective > > > > > element code. > > > > > > Any help anyone can provide would be greatly appreciated, I seem > > > > > to be pretty stuck! > > > > > > Controller code: > > > > > > function add() > > > > > { > > > > > echo ""; > > > > > $mrClean = new Sanitize(); > > > > > > echo "Data ". $this->data; > > > > > > if(!empty($this->data)) > > > > > { > > > > > $mrClean->clean($this->data); > > > > > > $currUser = $this->get_current_user(); > > > > > $this->data['Comment']['user_id'] = $currUser['id']; > > > > > $this->data['Comment']['isDeleted'] = 0; > > > > > > $targetEvent = $this->Event->find("first", > > > > > array('conditions' => array('Event.id' => > > > > > $this->data['Comment'] > > > > > ['event_id']), > > > > > 'recursive' => 1)); > > > > > > print_r($targetEvent); > > > > > > if(empty($targetEvent) || is_null($targetEvent)) > > > > > { > > > > > $this->Comment->invalidate('event_id', 'You have > > > > > selected an > > > > > invalid event.'); > > > > > return; > > > > > } > > > > > > if($this->Comment->save($this->data)) > > > > > { > > > > > $this->flash('Your comment has been added', > > > > > '/events/view/'. > > > > > $this->data['Comment']['event_id']); > > > > > } else { > > > > > $this->flash('An error has occured adding > > > > > your comment.', '/ > > > > > events'); > > > > > } > > > > > } > > > > > > } > > > > > > Element code: > > > > > > create('Comment', array('action' => 'add')); ?> > > > > > > > > > > > > > > > > > > > >
Generate Excel from database problem (rendering layout)
Hello guys, I want to generate and excel spreadsheets based from my database query and I've come across this tutorial http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database. I've followed every instructions but I can't get it working. I have a "reservations" contoller and it has a view called "report" and two layouts "default.ctp" and "excel.ctp" My default.ctp contains my main layout for html display and excel.ctp contains the layout for rendering the excel file. Everytime i visit the link http://localhost/{myproject}/reservations/report, I get this error Error: The requested address '/reservations/report' was not found on this server. I've tried things commenting out the line $this->render('action','excel'); in my reservations controller (report function) and renaming excel.ctp to default.ctp and everything works fine. I think the problem has to do with rendering my layout and I just can't find the solution for it. Please help me since I'm already beyond my deadline in my project. Thanks, Mario --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Plugin Database Config
Is it possible to set $useDbConfig in a plugin model? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
trying to make othAuth login process work
Hi, I have carefully followed the othAuth doc http://bakery.cakephp.org/articles/view/othauth-0-5-documentation, trying to get it to work, bur when I go to http://127.0.0.1/testsite/users/login, I get the following errors.. Username Warning (512): Method HtmlHelper::input does not exist [CORE\cake\libs \view\helper.php, line (512): Method HtmlHelper::tagErrorMsg does Warning (512): Method HtmlHelper::checkbox does not exist [CORE\cake \libs\view\helper.php, line 148] Any ideas.. here is the login.ctp view.. Log In: Username input('User/username', array('id' => 'user_username', 'size' => '50')) ?> tagErrorMsg('User/username', 'Please enter your username') ?> Password input('User/passwd', array('id' => 'user_passwd', 'size' => '32', 'type'=>"password")) ?> tagErrorMsg('User/passwd', 'Please enter your password!') ?> checkbox("User/cookie");?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Urls
Nevermind, I solved the issue. It can be resolved by calling $Dispatcher->base = $yourbaseuri On Sep 18, 11:24 am, rmarrs <[EMAIL PROTECTED]> wrote: > I'm creating a module for implementing CakePHP applications as nodes > inside of Drupal (Drake does not have what I'm looking for). I'm 95% > there, I just need to fix some routing issues, and that's where I'm > not sure about Cake's ability to handle this. > > I need to prefix URLs generated by cake. For example, when > $this->redirect('controller'=>'mycontroller', 'action'=>'myaction'); is > > called, I need to prefix that url with /node/##/mycontroller/ > myaction/ . > > I do not want to have to add this code into every controller. I'd > prefer it be in the CakePHP config files, or better yet, in my custom > Drupal module. > > Is there any way using routing or something else I'm missing to prefix > every generated url with a path? > > Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: table associations issues
I added a leader (int) field to the group table to act as the foreign key and modified that model class as follows. class Group extends AppModel{ var $name = 'Group'; var $hasAndBelongsToMany = 'Student'; var $belongsTo = array ('Leader' => array('className' => 'Student', 'foreignKey' => 'leader')); } Using hasOne cakephp complains but with the code above it's happy and having the group belong to the leader makes logical sense to me so I am happy too. Thanks for pointing me in the right direction. On Thu, Sep 18, 2008 at 10:16 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > > You need another associaton where a Group hasOne (or belongsTo) a > Student "aliased" as the leader. > > For example: > var $hasOne = array( >'Leader' => array( >'className'=> 'Student' >) > ); > > Sometimes I prefer to think in terms of a Group having a leader but > the database design may be more smooth using belongsTo relationship > because of where the foreign key goes. In this case hasOne results in > a Student only ever being able to be the leader of one group. Some > very driven Student may want to be the leader of two or three groups, > right? Putting the fk in Group and using belongsTo you would avoid > this problem but possible create some new ones. > > > > > > On Sep 18, 3:34 pm, "silk.odyssey" <[EMAIL PROTECTED]> wrote: > > I am trying to get the table associations right for an application but > > I am not sure how to make it happen with cakephp. I have a "students" > > table that has a many to many relationship with the table groups. This > > is straightforward to do but the problem is each group also has to > > have a leader. The leader of each group is a student also. How do I > > define the relevant models to make this setup work? This is what I > > have so far. > > > > > class Group extends AppModel{ > > var $name = 'Group'; > > var $hasAndBelongsToMany = 'Student';} > > > > ?> > > > > > class Student extends AppModel{ > > var $name = 'Student'; > > var $hasAndBelongsToMany = 'Group'; > > } > > ?> > > > --~--~-~--~~~---~--~~ 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: Model Baker Beta
I don't imagine it would be all that difficult to create a front-end in Adobe Air (able to be run on any OS supporting Air) with a slightly modified (or perhaps unmodified) version of CakePHP running the backend to mimic what they're doing here. I simply chose Adobe Air since it's easy to create a desktop application using what most people here are familiar with - web programming methodologies: Flash, Flex, HTML, JS. On Sep 17, 4:15 pm, villas <[EMAIL PROTECTED]> wrote: > It's Mac only - shame. > > On Sep 17, 2:32 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 17, 10:12 am, andruu <[EMAIL PROTECTED]> wrote: > > > > Where can this be downloaded? I saw the video on Youtube. > > >http://www.widgetpress.com/ > > > It's a private beta at the moment though, a message on the home page > > says... > > > Interested Beta Users? Contact [EMAIL PROTECTED] Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ 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: Form data from a view element
Hi Luenyar, I changed the form create line to: create('Comment', array('action' => 'add', 'url' => array('controller' => 'comments', 'action' => 'add'))); ?> And when I submit the element form it _does_ send me to the right url, that is /comments/add which is the right controller, but it still says "0 query took ms" and doesn't spew any of the debugging info that I put in the add() function of the Comments controller. I'm beginning to think the problem is handing the data off to the controller. With the debug for cake set in core.php to FULL debug (i.e. with controller info). I get NO controller information spewed. Any more ideas? II've been working at this since before the original post with no progress to a solution :( - Dan On Sep 17, 10:12 pm, Luenyar <[EMAIL PROTECTED]> wrote: > $form->create('Comment') associates the form with the 'Comment' model, > but not a controller. Presumably because the 'Comments' model could > be used in many or all of your controllers with $uses. The 'action' > option assumes the current controller, so if you render your element > in the Posts controller, the action is assumed /posts/add. url is the > option you are looking for. > > http://manual.cakephp.org/view/183/Creating-Forms#options-url-186 > > Hope that helps, > Milton > > On Sep 16, 11:31 am, Daniel <[EMAIL PROTECTED]> wrote: > > > I created the form using the line: > > > $form->create('Comment', array('action' => 'add')); > > > Doesn't this specify that it should use the controller associated with > > the "Comment" model, i.e. the Comments controller? This is how I've > > done it with all of my other forms... > > > And yes, I realize the table based layout is terrible, I'm just > > mocking things at the moment and didn't want to write a stylesheet to > > position things yet. > > > Thanks! > > > - Dan > > > On Sep 16, 11:23 am, mark_story <[EMAIL PROTECTED]> wrote: > > > > On Sep 16, 9:11 am, Daniel <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > I currently have a "comment box" view element that I plan to > > > > embed in various places in my CakePHP application to allow users to > > > > leave comments on various aspects of the site. > > > > > I'm using the form helper inside of the element to generate the > > > > form to be used to submit the data, however when I submit the data I > > > > receive only a blank screen that says "0 query took ms". I've even > > > > added debugging echoes to the controller to print the data array and > > > > I'm still just receiving a blank page with "0 query took ms". > > > > > Attached below is the comment "add" method and the respective > > > > element code. > > > > > Any help anyone can provide would be greatly appreciated, I seem > > > > to be pretty stuck! > > > > > Controller code: > > > > > function add() > > > > { > > > > echo ""; > > > > $mrClean = new Sanitize(); > > > > > echo "Data ". $this->data; > > > > > if(!empty($this->data)) > > > > { > > > > $mrClean->clean($this->data); > > > > > $currUser = $this->get_current_user(); > > > > $this->data['Comment']['user_id'] = $currUser['id']; > > > > $this->data['Comment']['isDeleted'] = 0; > > > > > $targetEvent = $this->Event->find("first", > > > > array('conditions' => array('Event.id' => > > > > $this->data['Comment'] > > > > ['event_id']), > > > > 'recursive' => 1)); > > > > > print_r($targetEvent); > > > > > if(empty($targetEvent) || is_null($targetEvent)) > > > > { > > > > $this->Comment->invalidate('event_id', 'You have > > > > selected an > > > > invalid event.'); > > > > return; > > > > } > > > > > if($this->Comment->save($this->data)) > > > > { > > > > $this->flash('Your comment has been added', > > > > '/events/view/'. > > > > $this->data['Comment']['event_id']); > > > > } else { > > > > $this->flash('An error has occured adding your > > > > comment.', '/ > > > > events'); > > > > } > > > > } > > > > > } > > > > > Element code: > > > > > create('Comment', array('action' => 'add')); ?> > > > > > > > > > > > > > > > > Subject: > > > $form->input('subject', array( 'label' => > > > > false )); ?> > > > > > > > > > > > > > > > > > > > > > > > > textarea('body', > > > > array( 'label' => false, > > > > 'rows' => 7, > > > > 'cols' => 80 )); ?> > > > > > > > > > > > >
CakePHP Urls
I'm creating a module for implementing CakePHP applications as nodes inside of Drupal (Drake does not have what I'm looking for). I'm 95% there, I just need to fix some routing issues, and that's where I'm not sure about Cake's ability to handle this. I need to prefix URLs generated by cake. For example, when $this- >redirect('controller'=>'mycontroller', 'action'=>'myaction'); is called, I need to prefix that url with /node/##/mycontroller/ myaction/ . I do not want to have to add this code into every controller. I'd prefer it be in the CakePHP config files, or better yet, in my custom Drupal module. Is there any way using routing or something else I'm missing to prefix every generated url with a path? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: a complex data model- a cakephp breakthrough?
Sounds like something that could be easily handled with EAV modeling. I wrote about it awhile ago. http://blog.joebeeson.com/?p=30 There are plenty of other sources of good information on the topic. With EAV you keep the number of tables small and it's still pretty fast with smart indexing while allowing you to keep your schema dynamic. On Sep 17, 8:49 pm, bMilesp <[EMAIL PROTECTED]> wrote: > This is an interesting problem that i believe can have a reasonable > solution using cakephp. i'm not going to get into the background, but > it stems from this idea: > > http://fornicode.com/2008/03/18/cakephp-a-has-either-association/ > > now for the business. > > my current company has a custom built CMS and i've convinced them to > start implementing cakephp for it. It's not going to be a complete > overhaul, but a slow migration. The CMS manages multiple products with > tons of different attributes for an online store. so the data model > consists of multiple product tables and a product category table. > > Over time, product pricing became an issue since there were multiple > price mechanisms involved for different products, so we came up with a > solution to create a pricing system that was separate from the product > tables. This could allow for different pricing for time based events > as well as flat priced items. to match the pricing model with the > specific product, one simply needs to pass the product_id and the > product_category_id, then all relevant pricing can be retrieved. Now, > this method worked so well, we started creating other general > separations, like an image table and a google_maps table, each having > a product_id and product_category_id field to relate the data. > > following this pattern, we now have multiple "attribute" tables, and > will probably add more, like videos, artices,etc. > > Now for the Cake > > so we have over 50 product categories and associated tables. I've > created models in cakephp for a bunch of these products and came > across... "The Issue": I need to add a new "attribute" table to all > these models. So instead of going through each of these 50 model files > and adding the hasMany association i could do... well... i'm not sure. > > luckily i'm just foreseeing this problem, which is very likely to > happen, and would like to ask for a solution. > > Here's the mechanics: > > each of these attribute tables requires a product_category_id. So i > pass that in, say, the Shoe model, which has a product_category_id = > 12. The Shoe model has all the attribute tables, but i will only show > the Image, and Video association examples for brevity: > > var $hasMany = array( > 'Image' => array( > 'className' => 'Image', > 'conditions' => 'product_category_id = 12', //12 is the shoe product > category > ) > ); > > var $hasMany = array( > 'Video' => array( > 'className' => 'Video', > 'conditions' => 'product_category_id = 12', > ) > ); > > etc. > > as you can see, the product_category_id must be passed in each product > model, so if i have over 50 products besides shoes, adding a new > attribute table would be cumbersome to say the least. > > 1) I've thought of using an include file, but you cannot pass a > variable when defining class vars, so replacing the '12' with a > $variable is not possible. > > 2) I've thought of having a dummy table to relate to all the > "attribute" tables, and maybe simply including the dummy table in my > product models. But this doesn't seem to be a possible solution to my > knowledge. > > 3) so could some kind of model behavior be a solution? Not sure how to > go about this option. > > If anyone could point me in a good direction, i think this would be a > great advantage to use cakephp over our custom built CMS. Thanks to > all! --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
So a rendered view will automatically receive validation messages? In which variable? If I need to set a var, what should my target be ($this->set('errors', /* what here? */))? I tried substituting a minLength 1 rule yesterday and if it worked, I would not have changed it, although I can't with certainty say whether validation simply never happened or if I got these same errors. I think that if I render index, that will do the job, as long as I can get error messages to present. Isn't there a resource about this (practical form validation)? The blog application, if I recall correctly, just saves data but doesn't address any fields on an individual basis, which I need for my template. I know that I'm missing something, and the Model, View, and Controller sections of the Cookbook aren't doing much to find the answer (same goes for the FormHelper and EmailComponent API docs, the latter of which is definitely a work in progress)? On Sep 18, 10:36 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > I'm not 100% sure, but I think older versions of Cake required you to > specify a rule. If you're only interested in the 'required' field, > specify a rule that'll always validate, like '/.*/' . What version of > Cake are you using? > > Structure your app the way you see fit. It's not good form to use > index() to add data to the database, but that's up to you to decide. > Either you make sure that the form submits to the right action (see > $form->create() options), or that the action renders the appropriate > view when it's done. What works better for you I don't know. > > On 18 Sep 2008, at 23:18, 703designs wrote: > > > Right, that was a typo, not a paste. I think that you'll be able to > > better help me if you understand how I've designed my contact form: > > > Model: Contact[name, email, city, subject, message, and a couple > > others] > > Model['validate']: Name, email, and message have 'required' => true > > Views: index (just passes in a pageTitle from the controller and > > renders a form from the model using $this->form->create('Contact') or > > equivalent -- works fine. This form automatically mapped to > > ContactsController::add(), so I created that method and put all of the > > relevant mail logic in there. > > > So should I move this logic into index() and force the form to use > > that method? Or force a render of the index view and find some way to > > pass in the validation errors? > > > Thanks for the help! > > > On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > >> On 18 Sep 2008, at 21:50, 703designs wrote: > > >>> I got funny preg_match errors > > >> Show us your $validate rules then or go through them with a fine > >> comb. > > >>> $this->Contact->set('$this->data); > > >> I hope this is not copy&pasted as it's invalid PHP. > > >>> This controller's 'add' method just sends out emails > >>> and flashes a message to the homepage. What do I need to do for the > >>> form to point to this method, but for validation errors to show up > >>> on > >>> the form (repopulating fields)? > > >> What view is your form in then? The add action will automatically try > >> to render the add view, naturally. If this is not where your form is, > >> override it with $this->render(); > > >>> This is not very well-documented, or > >>> if it is, I had difficulty finding an answer. > > >>http://book.cakephp.org/view/428/render > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Composite Primary Keys
I work in a company with a legacy database designed using relations with composite primary keys and change the database is not an option... Cake does not support an array of keys by default to set model`s $primaryKey. Is there any plugin or update in sight?? --~--~-~--~~~---~--~~ 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: $htmlHelper and layouts for a cake noob
Thank you very much Lance! I will examine your answer and in the meantime I am calling a class to refer to absolute URL's in my code. Much to learn! On Sep 18, 12:40 am, Lance Willett <[EMAIL PROTECTED]> wrote: > > I need to have pretty URL's and cannot also figure out how to get rid > > of index.php in my URL. > > When "index.php" appear in the URL, it's usually an issue with > htaccess rules or your server setup not supporting mod_rewrite. See > the Cookbook page on mod_rewrite for > more:http://book.cakephp.org/view/333/A-Note-on-mod_rewrite. > > But, from your example URL, the index is at the end, and doesn't have > the .php extension – so maybe it's an issue with how you named your > view file or with how the controller actions are working together. --~--~-~--~~~---~--~~ 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: Acl and Auth at record level with crud mode
Hi, I made my modifications on auth.php: function action($action) { $actionModifier = null; if( isset($this->params['pass'][0] ) ){ $id = $this->params['pass'][0]; $model = Inflector::camelize(Inflector::singularize($this- >params['controller'])); return array('model' => $model, 'foreign_key' => $id); } else { return Inflector::camelize($this->params['controller']); } } It now checks permissions at record level by model and foreign_key instead of alias, so there are no alias naming conventions etc. You dont have to deny all users on acos. I think now its working as it should. The only rule is that you have to pass id first in the url when calling an action. How's that working for you? Any more improvement suggestions? Zoltan Balint --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
I'm not 100% sure, but I think older versions of Cake required you to specify a rule. If you're only interested in the 'required' field, specify a rule that'll always validate, like '/.*/' . What version of Cake are you using? Structure your app the way you see fit. It's not good form to use index() to add data to the database, but that's up to you to decide. Either you make sure that the form submits to the right action (see $form->create() options), or that the action renders the appropriate view when it's done. What works better for you I don't know. On 18 Sep 2008, at 23:18, 703designs wrote: > Right, that was a typo, not a paste. I think that you'll be able to > better help me if you understand how I've designed my contact form: > > Model: Contact[name, email, city, subject, message, and a couple > others] > Model['validate']: Name, email, and message have 'required' => true > Views: index (just passes in a pageTitle from the controller and > renders a form from the model using $this->form->create('Contact') or > equivalent -- works fine. This form automatically mapped to > ContactsController::add(), so I created that method and put all of the > relevant mail logic in there. > > So should I move this logic into index() and force the form to use > that method? Or force a render of the index view and find some way to > pass in the validation errors? > > Thanks for the help! > > On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> On 18 Sep 2008, at 21:50, 703designs wrote: >> >>> I got funny preg_match errors >> >> Show us your $validate rules then or go through them with a fine >> comb. >> >>> $this->Contact->set('$this->data); >> >> I hope this is not copy&pasted as it's invalid PHP. >> >>> This controller's 'add' method just sends out emails >>> and flashes a message to the homepage. What do I need to do for the >>> form to point to this method, but for validation errors to show up >>> on >>> the form (repopulating fields)? >> >> What view is your form in then? The add action will automatically try >> to render the add view, naturally. If this is not where your form is, >> override it with $this->render(); >> >>> This is not very well-documented, or >>> if it is, I had difficulty finding an answer. >> >> http://book.cakephp.org/view/428/render > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How can I change the path of webroot/js and webroot/css?
I've been trying to locate this in the cookbook but I couldn't find it. Is there a way to configure cake to change the default paths for the js and css directories inside the webroot dir? thanks, Marc --~--~-~--~~~---~--~~ 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: table associations issues
You need another associaton where a Group hasOne (or belongsTo) a Student "aliased" as the leader. For example: var $hasOne = array( 'Leader' => array( 'className'=> 'Student' ) ); Sometimes I prefer to think in terms of a Group having a leader but the database design may be more smooth using belongsTo relationship because of where the foreign key goes. In this case hasOne results in a Student only ever being able to be the leader of one group. Some very driven Student may want to be the leader of two or three groups, right? Putting the fk in Group and using belongsTo you would avoid this problem but possible create some new ones. On Sep 18, 3:34 pm, "silk.odyssey" <[EMAIL PROTECTED]> wrote: > I am trying to get the table associations right for an application but > I am not sure how to make it happen with cakephp. I have a "students" > table that has a many to many relationship with the table groups. This > is straightforward to do but the problem is each group also has to > have a leader. The leader of each group is a student also. How do I > define the relevant models to make this setup work? This is what I > have so far. > > class Group extends AppModel{ > var $name = 'Group'; > var $hasAndBelongsToMany = 'Student';} > > ?> > > class Student extends AppModel{ > var $name = 'Student'; > var $hasAndBelongsToMany = 'Group'; > } > ?> --~--~-~--~~~---~--~~ 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: from database to excel (Missing files in the bakery)
Thanks a lot Martin. On Sep 18, 7:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I zipped my files and put them up on my > dev-server.http://dev.eimermusic.com/cake_excel_writer/ > They are all for 1.2 and work on my setup. Can't remember if I tweaked > the helper or not... > > They will stay there for a while but not forever. > > /Martin > > On Sep 18, 3:57 pm, mario <[EMAIL PROTECTED]> wrote: > > > > > Hello everyone, > > > I wanted to generate an excel report from my database query > > and I've come acroos this tutorial in the bakery. > > >http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f... > > > However, it seems like the download links are already broken. > > >http://webdesign.janenanneriet.nl/excel_writer.ziphttp://webdesign.ja... > > > Does anyone of you have these files? (would be better if working in > > cakephp 1.2) > > > Please share it. I really need them in my project. > > > Thanks, > > > Mario --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
Note that each ['validate'] key also has a normal ['message'] defined, saying that the field in question is required. On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > On 18 Sep 2008, at 21:50, 703designs wrote: > > > I got funny preg_match errors > > Show us your $validate rules then or go through them with a fine comb. > > > $this->Contact->set('$this->data); > > I hope this is not copy&pasted as it's invalid PHP. > > > This controller's 'add' method just sends out emails > > and flashes a message to the homepage. What do I need to do for the > > form to point to this method, but for validation errors to show up on > > the form (repopulating fields)? > > What view is your form in then? The add action will automatically try > to render the add view, naturally. If this is not where your form is, > override it with $this->render(); > > > This is not very well-documented, or > > if it is, I had difficulty finding an answer. > > http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
Right, that was a typo, not a paste. I think that you'll be able to better help me if you understand how I've designed my contact form: Model: Contact[name, email, city, subject, message, and a couple others] Model['validate']: Name, email, and message have 'required' => true Views: index (just passes in a pageTitle from the controller and renders a form from the model using $this->form->create('Contact') or equivalent -- works fine. This form automatically mapped to ContactsController::add(), so I created that method and put all of the relevant mail logic in there. So should I move this logic into index() and force the form to use that method? Or force a render of the index view and find some way to pass in the validation errors? Thanks for the help! On Sep 18, 9:29 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > On 18 Sep 2008, at 21:50, 703designs wrote: > > > I got funny preg_match errors > > Show us your $validate rules then or go through them with a fine comb. > > > $this->Contact->set('$this->data); > > I hope this is not copy&pasted as it's invalid PHP. > > > This controller's 'add' method just sends out emails > > and flashes a message to the homepage. What do I need to do for the > > form to point to this method, but for validation errors to show up on > > the form (repopulating fields)? > > What view is your form in then? The add action will automatically try > to render the add view, naturally. If this is not where your form is, > override it with $this->render(); > > > This is not very well-documented, or > > if it is, I had difficulty finding an answer. > > http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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: from database to excel (Missing files in the bakery)
I zipped my files and put them up on my dev-server. http://dev.eimermusic.com/cake_excel_writer/ They are all for 1.2 and work on my setup. Can't remember if I tweaked the helper or not... They will stay there for a while but not forever. /Martin On Sep 18, 3:57 pm, mario <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I wanted to generate an excel report from my database query > and I've come acroos this tutorial in the bakery. > > http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f... > > However, it seems like the download links are already broken. > > http://webdesign.janenanneriet.nl/excel_writer.ziphttp://webdesign.janenanneriet.nl/ole.zip > > Does anyone of you have these files? (would be better if working in > cakephp 1.2) > > Please share it. I really need them in my project. > > Thanks, > > Mario --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
table associations issues
I am trying to get the table associations right for an application but I am not sure how to make it happen with cakephp. I have a "students" table that has a many to many relationship with the table groups. This is straightforward to do but the problem is each group also has to have a leader. The leader of each group is a student also. How do I define the relevant models to make this setup work? This is what I have so far. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
from database to excel (Missing files in the bakery)
Hello everyone, I wanted to generate an excel report from my database query and I've come acroos this tutorial in the bakery. http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database However, it seems like the download links are already broken. http://webdesign.janenanneriet.nl/excel_writer.zip http://webdesign.janenanneriet.nl/ole.zip Does anyone of you have these files? (would be better if working in cakephp 1.2) Please share it. I really need them in my project. Thanks, Mario --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Apache segmentation fault on r7597
I'm experiencing a segmentation fault on Apache2 (LAMP) for r7597, but only if debug is set to 0. r7596 is fine. I've checked all file permissions that I can think of. I /think/ it's something to do with the require'd (rather than uses(...)) files being require'd more than once but I can't see anything in the changeset that would be altered by debug = 0... Any one else experiencing this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
hasMany association with oracle DB - missing "ANY" statement
Hi dudes, I'm running into problems when trying to establish a hasMany relation between two models using an orcale DB. My models: --- class MenuStructure extends AppModel { var $primaryKey = 'file_name'; var $useTable = 'menu_structure'; var $hasMany = array( 'PageAttribute' => array( 'className' => 'PageAttribute', 'foreignKey'=> 'filename', 'conditions' => 'PageAttribute.nav_show = 1' )); } class PageAttribute extends AppModel { var $primaryKey = 'filename'; } My Controller: class PageAttributesController extends AppController { var $helpers = array('Javascript'); function index() { $this->loadModel('MenuStructure'); $res = $this->MenuStructure->findAll(); debug ($res); } } - The produced SQL: SELECT PageAttribute.id, PageAttribute.filename, PageAttribute.title, [...many others, all fine...] FROM page_attributes PageAttribute WHERE PageAttribute.nav_show = 1 AND PageAttribute.filename = ('home.html', 'profile.html', [...many others, all fine...]) The resulting SQL-Error: Warning (512): SQL Error: ORA-01797: this operator must be followed by ANY or ALL [CORE/cake/libs/model/datasources/dbo_source.php, line 512] I guess there is missing an ANY after "PageAttribute.filename = " Any non-complete-dirty workarounds for this? --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
On 18 Sep 2008, at 21:50, 703designs wrote: > I got funny preg_match errors Show us your $validate rules then or go through them with a fine comb. > $this->Contact->set('$this->data); I hope this is not copy&pasted as it's invalid PHP. > This controller's 'add' method just sends out emails > and flashes a message to the homepage. What do I need to do for the > form to point to this method, but for validation errors to show up on > the form (repopulating fields)? What view is your form in then? The add action will automatically try to render the add view, naturally. If this is not where your form is, override it with $this->render(); > This is not very well-documented, or > if it is, I had difficulty finding an answer. http://book.cakephp.org/view/428/render --~--~-~--~~~---~--~~ 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: paid support for cake-php
http://cakedc.com --~--~-~--~~~---~--~~ 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: where is my post
Maybe you forgot to read the part about this group where it says "The group is moderated to prevent spam, so please be patient if you are new member." http://groups.google.com/group/cake-php/about --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
where is my post
Hey posted the same message twice but its not appearing why damn its not working properly what to do? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
don't see row after executing query
Good day/night to everyone! When I execute this query: SELECT * from articles where (published='yes' AND category='news') ORDER BY id desc; not all rows that are published and belong to 'news' category are shown as a result. What can be wrong?? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Warning 512 - cache problem
Hi!, I hava a serious problem with recent 1.2 RC-2 - I use svn to control my projects - at som,e point I decided to try out a new cake - when I uploaded my app (from a windows machine) and checked it out on a linux (debian+apache) machine it showed me an error saying that fiel engine is not configured properly Warning 512 - I searched the forum and found out that it is beacuse of cake's problem with urls - I commented out one line in core.php and it dissapeared but since then none of the urls works - it displays this url can not be found on the server - I wqould like to use cake 1.2 as I consider it being more advanced than 1.1 but it is now a pain for me? Why is that happening? Anyone knows? Regards, Gabriel --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
paid support for cake-php
Government agency asking us for support for their public purchasing application developed in cake-php. Will need remote support. Please send proposals. -- Saludos/Greetings Quiliro Ordóñez 593(02)340 1517 / 593(09)821 8696 Quito, Ecuador, South America http://quiliro.wordpress.com Artículos recientes: - Análisis del aborto y otras cosillas en la Constitución - Crea tu propia distro GNU o Cómo escoger una distro - Requisistos para ser miembro de las cabezas de gobierno --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Model with varying fields? can Cake help in some way?
Hi, I thought I'd ask for any advice in this direction. I am not looking for a quick fix. More like gotchas and good ideas when going in this direction. If anyone recognizes what I am rambling about, please nudge me in the right direction, or show me a rubberized room if that is more appropriate. I think I will need a model that ideally should work much like a normal model but the available fields will change and be very "dynamic". That is the data will be imported Excel files (or other structured data) where one may have different "fields" from the second. I would still like to be able to somehow search and sort these "records". Man, this is hard to explain in english. It could be explained as a kind of database for storing a database in @:) OK, try this: If I have a normal table called users (id, uname, pass, email), Cake can give me the schema and I can "scaffold" a form containing these fields. If I change the schema in the database I can get the new fields automatically. Now take that one step further and say each user may have different properties. So thought (not really complete tables): I will create a table called users (id) AND a table called fields (id, name, type, user_id) AND a table called records (id, data, field_id, user_id) Maybe not exactly like that but you get the idea. Tables modeling the structure of a "virtual" table. So when I do a find on my User model I want to try to query for in the records table and return the users that have records that match some criteria. Complex searches are not the first priority. That would be actually safely storing this kind of imported data in a good way. OK, still with me? Sound at all similar? Sounds crazy? Got any ideas? Please let me know . Martin --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
I saw that last night before posting, and wrapping the send sequence in this conditional didn't work: I got funny preg_match errors (also noted here: http://ryan.ifupdown.com/2008/08/24/delimiter-must-not-be-alphanumeric-or-backslash-corecakelibsmodelmodelphp-line-2202/ , although his fix didn't work for me): function add() { if(!empty($this->data)) { $this->Contact->set('$this->data); if($this->Contact->validates()) { // Start sending messages, then flash a success message if successful. Redirect to site root } } } I also got an error about a missing 'add' view which is probably easier to fix. This controller's 'add' method just sends out emails and flashes a message to the homepage. What do I need to do for the form to point to this method, but for validation errors to show up on the form (repopulating fields)? This is not very well-documented, or if it is, I had difficulty finding an answer. On Sep 18, 4:44 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Are you looking for > this?http://book.cakephp.org/view/410/Validating-Data-from-the-Controller > > On 18 Sep 2008, at 13:51, 703designs wrote: > > > > > How can I check if the data is valid before trying to send the mail > > out? Validation errors are falling into the "email failed" condition, > > and validation errors aren't reported to the user. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ok dont bother answering that
ok i can know y...message will appear momentarily it says --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
where is my post appearing
hey where is my post appearing ?...i dont see it on the discussion list --~--~-~--~~~---~--~~ 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: Image resizing --> point in right direction please :)
Hi Alex, > we are coming across the problem of users insisting on uploading 2000 > x 2000px images onto our system and regardless of how amuzing it is to > see your computer screen being eaten by a oversized product image, it > is very annoying. > > We need to create a way of automatically resize (both dimensions and > file size) the files on upload before saving them. > > Could anyone point us in the right direction to do this within cake? Have a look at the bakery, http://bakery.cakephp.org, there are some solutions described (search with "resize" in the "code" section"). Hope that helps! -- Daniel Hofstetter http://cakebaker.42dh.com --~--~-~--~~~---~--~~ 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: Image resizing --> point in right direction please :)
I'm using this component: http://labs.iamkoa.net/2007/10/23/image-upload-component-cakephp/ It's not exactly the best code, but once you set it up it does the job. On 18 Sep 2008, at 18:53, bartez wrote: > > hey guys, > > we are coming across the problem of users insisting on uploading 2000 > x 2000px images onto our system and regardless of how amuzing it is to > see your computer screen being eaten by a oversized product image, it > is very annoying. > > We need to create a way of automatically resize (both dimensions and > file size) the files on upload before saving them. > > Could anyone point us in the right direction to do this within cake? > > Thanks in advance. > > Alex > > --~--~-~--~~~---~--~~ 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: Saving to multiple tables from one form
tbudzins, Have a look at this section here: http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo If for example, if the address belongs to username and password then save the parent first. good luck a --~--~-~--~~~---~--~~ 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: a complex data model- a cakephp breakthrough?
Hi bMilesp, If I understood your requirement correctly, it sounds like a good starting point would be for you to search on 'polymorphic'. On Sep 18, 3:49 am, bMilesp <[EMAIL PROTECTED]> wrote: > This is an interesting problem that i believe can have a reasonable > solution using cakephp. i'm not going to get into the background, but > it stems from this idea: > > http://fornicode.com/2008/03/18/cakephp-a-has-either-association/ > > now for the business. > > my current company has a custom built CMS and i've convinced them to > start implementing cakephp for it. It's not going to be a complete > overhaul, but a slow migration. The CMS manages multiple products with > tons of different attributes for an online store. so the data model > consists of multiple product tables and a product category table. > > Over time, product pricing became an issue since there were multiple > price mechanisms involved for different products, so we came up with a > solution to create a pricing system that was separate from the product > tables. This could allow for different pricing for time based events > as well as flat priced items. to match the pricing model with the > specific product, one simply needs to pass the product_id and the > product_category_id, then all relevant pricing can be retrieved. Now, > this method worked so well, we started creating other general > separations, like an image table and a google_maps table, each having > a product_id and product_category_id field to relate the data. > > following this pattern, we now have multiple "attribute" tables, and > will probably add more, like videos, artices,etc. > > Now for the Cake > > so we have over 50 product categories and associated tables. I've > created models in cakephp for a bunch of these products and came > across... "The Issue": I need to add a new "attribute" table to all > these models. So instead of going through each of these 50 model files > and adding the hasMany association i could do... well... i'm not sure. > > luckily i'm just foreseeing this problem, which is very likely to > happen, and would like to ask for a solution. > > Here's the mechanics: > > each of these attribute tables requires a product_category_id. So i > pass that in, say, the Shoe model, which has a product_category_id = > 12. The Shoe model has all the attribute tables, but i will only show > the Image, and Video association examples for brevity: > > var $hasMany = array( > 'Image' => array( > 'className' => 'Image', > 'conditions' => 'product_category_id = 12', //12 is the shoe product > category > ) > ); > > var $hasMany = array( > 'Video' => array( > 'className' => 'Video', > 'conditions' => 'product_category_id = 12', > ) > ); > > etc. > > as you can see, the product_category_id must be passed in each product > model, so if i have over 50 products besides shoes, adding a new > attribute table would be cumbersome to say the least. > > 1) I've thought of using an include file, but you cannot pass a > variable when defining class vars, so replacing the '12' with a > $variable is not possible. > > 2) I've thought of having a dummy table to relate to all the > "attribute" tables, and maybe simply including the dummy table in my > product models. But this doesn't seem to be a possible solution to my > knowledge. > > 3) so could some kind of model behavior be a solution? Not sure how to > go about this option. > > If anyone could point me in a good direction, i think this would be a > great advantage to use cakephp over our custom built CMS. Thanks to > all! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Image resizing --> point in right direction please :)
hey guys, we are coming across the problem of users insisting on uploading 2000 x 2000px images onto our system and regardless of how amuzing it is to see your computer screen being eaten by a oversized product image, it is very annoying. We need to create a way of automatically resize (both dimensions and file size) the files on upload before saving them. Could anyone point us in the right direction to do this within cake? Thanks in advance. Alex --~--~-~--~~~---~--~~ 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: Forms not validating while using EmailComponent?
Are you looking for this? http://book.cakephp.org/view/410/Validating-Data-from-the-Controller On 18 Sep 2008, at 13:51, 703designs wrote: > > How can I check if the data is valid before trying to send the mail > out? Validation errors are falling into the "email failed" condition, > and validation errors aren't reported to the user. > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using Views in database over a legacy database
Hi We currently have a data model with table names that don't follow CakePHP conventions. As we do with Rails, one technique to use (when application is read- only, and that's our case) is to create views in database over this legacy tables. First i did this. Then i wanted to unit test my new renamed data model. - i've recreated my models using renamed keys in my views. - i've recreated my test cases. After first test launched, what i see for the first model, is that the Testing framework create my test tables with the keys of the table, mapped by my view. And fixtures couldn't be loaded, and test is not run. here my legacy table : SL01 : N_NUME_CLIE varchar(6) L_CONN_NOM varchar(40) L_CONN_PASS varchar(40) Here my view Users Create view Users as select n_nume_clie id, l_conn_nom, l_conn_pass from sl01; Here the trace in my test case (creation of the table for testing): CREATE TABLE `test_utilisateur_tests` ( `N_NUME_CLIE` varchar(6) NOT NULL, `L_CONN_NOM` varchar(40) NOT NULL, `L_CONN_PASS` varchar(40) NOT NULL ); It seems to be a problem with the SimpleTest framework Does CakePHP support Models mapping database Views? Thanks Laurent --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---