Re: trouble reading data from array
trying this but still doesnt work: echo $html->link('Add Questions',"/ questions/add/$this->data[Survey][id]"); On Apr 30, 1:30 am, "b logica" <[EMAIL PROTECTED]> wrote: > You want $this->data[...] > > > > On Tue, Apr 29, 2008 at 5:21 AM, rtanz <[EMAIL PROTECTED]> wrote: > > > hi in my view i am trying this code: > > > echo $html->link('Add > > Questions',"/questions/add/$data[Survey][id]"); > > > in order to insert the id of the survey at the end of that link, > > however it is giving me > > Notice (8): Undefined variable: data [APP/views/surveys/edit.ctp, line > > 11] > > > In the controller dump i have > > [data] => Array > > ( > > [Survey] => Array > > ( > > [id] => 1 > > > what am i doing wrong? thnx- 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 -~--~~~~--~~--~--~---
trouble reading data from array
hi in my view i am trying this code: echo $html->link('Add Questions',"/questions/add/$data[Survey][id]"); in order to insert the id of the survey at the end of that link, however it is giving me Notice (8): Undefined variable: data [APP/views/surveys/edit.ctp, line 11] In the controller dump i have [data] => Array ( [Survey] => Array ( [id] => 1 what am i doing wrong? thnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
drop down question
hi i would like to enable users of my application to fill in a form to create a questionnaire. Now one of the fields enables them to choose the type of input, for example text, drop down etc. I would like that if they select drop down another field would open for them in which they could enter the options for the drop down box. Then in the actual questionnaire page the end users would see, cake would read the value and populate the drop down with those comma delimited values. How can i do this? 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 -~--~~~~--~~--~--~---
Trying to display survey information in add question page
Hi I am making a questionnaire application and I have a survey model and a questions model. I have set the survey as hasMany question and question belongsTo survey. Now what I need to do is that when a user creates a survey and clicks 'Add Questions' on that page, the browser will redirect to the add function for questions, but not only displays the form for adding questions but also the survey information above it and the other questions already entered. can someone guide me on how to make this? 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: problem making a select box
thanks alot guys everything clear now :) On Apr 25, 4:08 pm, seb <[EMAIL PROTECTED]> wrote: > rtanz wrote: > > cheers that worked perfectly, another thing while we're at it, i am > > noticing that the code works the same whether you use single or double > > quotes, is one or the other better? Sorry might be a php thing and > > nothing related to cake, im not an expert in php itself either. thanks > > Using single or double quotes does not change anything. Both are string > delimiters. > > *BUT* if you use double quotes you'll be able to escape some more sequences. > > Have a look at : > > http://us2.php.net/manual/en/language.types.string.php#language.types... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem making a select box
cheers that worked perfectly, another thing while we're at it, i am noticing that the code works the same whether you use single or double quotes, is one or the other better? Sorry might be a php thing and nothing related to cake, im not an expert in php itself either. thanks On Apr 25, 3:52 pm, seb <[EMAIL PROTECTED]> wrote: > rtanz wrote: > > tried that and got this error > > > Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/jpgalea/ > > public_html/survey/app/views/surveys/edit.ctp on line 9 > > Sorry for that, I should have done a cut & paste from my own code. Made > a typo by forgetting to enclose all things related to select field > inside an array. Hey, this is Friday, I'm a bit tired ! :D > > Here is the right syntax : > > echo > $form->input("my_field_name",array("type"=>"select","options"=>array("0"=>"NO","1"=>"YES"),"selected"=>"1")); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem making a select box
yes amit i used that syntax originally, but now i want to add those other options, i.e. I want Yes to be selected by default and I also dont want any blank fields. This is what I would like to achieve, so i need to add some more parameters... On Apr 25, 1:07 pm, "Amit Badkas" <[EMAIL PROTECTED]> wrote: > - You should use syntax like echo $form->select('active', array(0 => 'Yes', > 1 => 'No')); > > > > > > On Fri, Apr 25, 2008 at 3:56 PM, rtanz <[EMAIL PROTECTED]> wrote: > > > tried that and got this error > > > Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/jpgalea/ > > public_html/survey/app/views/surveys/edit.ctp on line 9 > > > On Apr 25, 12:08 pm, seb <[EMAIL PROTECTED]> wrote: > > > rtanz wrote: > > > > hi i would like to make a select box with a label and dropdown, > > > > default value 'Yes' and no empty value. I am trying this code but its > > > > not working as i want to, can you help me out? > > > > With Cake 1.2, you should try this : > > > > echo > > > $form->input("type"=>"select","options"=>array("0"=>"No","1"=>"Yes"),"selected"=>"1")); > > -- > Regards, > Amit > > http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas- > 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: problem making a select box
tried that and got this error Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/jpgalea/ public_html/survey/app/views/surveys/edit.ctp on line 9 On Apr 25, 12:08 pm, seb <[EMAIL PROTECTED]> wrote: > rtanz wrote: > > hi i would like to make a select box with a label and dropdown, > > default value 'Yes' and no empty value. I am trying this code but its > > not working as i want to, can you help me out? > > With Cake 1.2, you should try this : > > echo > $form->input("type"=>"select","options"=>array("0"=>"No","1"=>"Yes"),"selected"=>"1")); --~--~-~--~~~---~--~~ 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 making a select box
hi i would like to make a select box with a label and dropdown, default value 'Yes' and no empty value. I am trying this code but its not working as i want to, can you help me out? echo $form- >select('active',array('0'=>'Yes','1'=>'No','Yes',null,false)); shown here: http://jpgalea.com/survey/surveys/add 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 -~--~~~~--~~--~--~---
$id=null vs $id
hi i am reading the manual and have some doubts regarding the use of $id, for example sometimes in an edit function you have function edit($id=null) while in a delete function you get function delete($id). Where do I use null and where not? 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 -~--~~~~--~~--~--~---
difference between saving in add and edit
Hi why is it that in the add function you use $this->data when saving and in the edit function you use $this->data['Post']? function add() { if (!empty($this->data)) { if ($this->Post->save($this->data)) { $this->flash('Your post has been saved.','/posts'); } } } function edit($id = null) { $this->Post->id = $id; if (empty($this->data)) { $this->data = $this->Post->read(); } else { if ($this->Post->save($this->data['Post'])) { $this->flash('Your post has been updated.','/posts'); } } } --~--~-~--~~~---~--~~ 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: Creating forms
right i think i get it thanks alot, ill try it out and see how it goes On Apr 24, 10:20 am, Fran Iglesias <[EMAIL PROTECTED]> wrote: > El 24/04/2008, a las 10:05, rtanz escribió: > > > my problem is how to > > have cake then create the forms themselves based on the designer's > > selection. any hints? thanks > > You could create fields in the "Question" model to store the type and > options for response. > > Then, in the view, a switch structure could output a different form > element according to that info. > > hth > -- > Fran Iglesias > [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Creating forms
Hi I am designing a survey application that should enable users to create questionnaires for people. The questionnaire designer would like to have the option to write the question down and then choose whether to have a checkbox, textbox, radio buttons etc for the response. I have created the forms for questionnaire creation and then the user selects which one he wants from those, my problem is how to have cake then create the forms themselves based on the designer's selection. any hints? 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 -~--~~~~--~~--~--~---
problem using sampler program
hi i am trying to setup http://cakeforge.org/projects/sampler/ sampler system on my server and i get the following error: Warning: require(cake/bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/jpgalea/public_html/ cake/sampler/webroot/index.php on line 78 Warning: require(cake/bootstrap.php) [function.require]: failed to open stream: No such file or directory in /home/jpgalea/public_html/ cake/sampler/webroot/index.php on line 78 Fatal error: require() [function.require]: Failed opening required 'cake/bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/ home/jpgalea/public_html/cake/..:/home/jpgalea/public_html/cake/ sampler/') in /home/jpgalea/public_html/cake/sampler/webroot/index.php on line 78 how can i fix it? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Uniform Server Cakephp Forbidden error
any help on this? thanks On Apr 21, 4:02 pm, rtanz <[EMAIL PROTECTED]> wrote: > Hi Im trying to setup cakephp on my uniform server, however whenever I > try to access my cake folder i get the following error: > > Forbidden > > You don't have permission to access /cake on this server. > Apache/2.0.59 (Win32) DAV/2 PHP/5.2.3 Server at localhost Port 80 > > When I delete the htaccess in the cake folder everything works fine, > however I guess that is not a good thing for cake itself. What can i > do to fix this? 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 -~--~~~~--~~--~--~---
Uniform Server Cakephp Forbidden error
Hi Im trying to setup cakephp on my uniform server, however whenever I try to access my cake folder i get the following error: Forbidden You don't have permission to access /cake on this server. Apache/2.0.59 (Win32) DAV/2 PHP/5.2.3 Server at localhost Port 80 When I delete the htaccess in the cake folder everything works fine, however I guess that is not a good thing for cake itself. What can i do to fix this? 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 -~--~~~~--~~--~--~---
favicon not working
hi i have set a favicon but it is not being displayed, i jsut have the default browser icon displayed near the url. what can be the problem ? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
more info on Association Data Mapping
hi i would like to know if there are any resources from where i can understand what is meant bt Association Data Mapping thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
confused where to place functions
hi i have a module controller. the situation is that i want that whenever a new module is added i will also create a new review and a new membership. Now where should i place the 2 functions needed to create a review and membership? Should i place them in the module controller or in the review controller and membership controller, or in the models? Sorry but im a bit confused about this and need some guidance Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
back functionality
hi i would like to make a back button on some pages, how can i know the url of the previous page? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
using formhelper
how can i translate this into cake code? with the form helper Year im trying to use this but its not working labelTag('year', 'Year');?> input('year', array('size' => '60'));?> tagErrorMsg('year', 'Please enter the Year.');?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: formatting of log file
yes you are right i was opening with notepad thats why thanks sorted now --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: formatting of log file
is this thing possible or do i have to store the logs in a db in order to achieve this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help on this function
ok nevermind my mistake i had a return true missing thanks for your help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help on this function
hmm these did not work either, what i am trying to do is If membership id is not set, continue with function, else step over code in brackets --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: help on this function
sorry that's not what i meant, my explanation was a bit unclear, what i mean is that i dont want the code *within* the beforeSave function to execute if the membership id is set. So if it is set the beforeSave function is called as usual however it doesn't proceed past the if statement. However there seems to be something wrong with the if statement as it still proceeds past it if an id is set in the url. any help on that? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
link problem
link('View results PDF',$review['Review'] ['results_url'],array("target"=>"_blank"))?> hi i have this code, i store the url in $review['Review'] ['results_url'] so cake should be displaying the link corectly but instead it seems to us the first variable as the URL, thus the link points to http://localhost/wereview/reviews/View%20results%20PDF, any idea why? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
help on this function
hi i am trying to make a beforeSave function that is only invoked if there is no membership id set (i.e. add not edit), however even in my edit action where the id is set it is still being invoked, any idea why? thanks function beforeSave() { if (!isset($this->data['Membership']['id'])) { $role = $this->data['Membership']['role_id']; $module = $this->data['Membership']['module_id']; $user = $this->data['Membership']['user_id']; $conditions = array("Membership.role_id"=>"$role", "Membership.module_id"=>"$module","Membership.user_id"=>"$user"); if ($this->find($conditions)) { return false; } else return true; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
select tag formatting
hi i have a select tag formatted as follows: selectTag('User/user_level', $options = array('user'=>'user','admin'=>'admin'),'user', array(), array(), true); ?> now it displays 3 options in reality: 1 _ 2 user 3 admin I would like to eliminate the empty option, how can i do this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
changing directory
hi i would like to change my address to my cake site from http://localhost/cake to http://localhost/mysitename. how can i do this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
formatting of log file
hi i am using cake's log function to keep a log of users signing in and out of the system, is there a way to format the text file so that each logged action would start on a new line? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: omit id field in foreach
isnt this supposed to work then? it is still displaying the id Related Reviews $value): ?> 'id') ?> link('Edit Review', '/admin/reviews/edit/' . $module['Review']['id']);?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
omit id field in foreach
hi i have the following code which displays my reviews, is there any way to make it omit the id field from rendering? thanks Related Reviews $value): ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: rollovers
i also trying to use an alternative as seen below but still i cant get the rollover to work: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
rollovers
hi i am trying to change my normal html rollovers into cake code using the helpers, however i must be doing something wrong coz they are not working. this is what i am doing: original: using cake's helper: link(null,'users/logout', array("onmouseout"=>"MM_swapImgRestore()", "onmouseover"=>"MM_swapImage('logout','','logout-over.png',1)")); ?> image('logout.png', array('alt'=>"Logout from weReview", array("name"=>"logout", "width"=>"97", "height"=>"34", "border"=>"0", "class"=>"button_logout"))); ?> what am i doing wrong? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
refresh problem
hi i am having a problem with page refreshing i dont know if its due to some cake setting or server. Whenever i delete a record for example, and i am sent back to the list of records page, i can still see the deleted record, i have to refresh to see the new view without that record. anyone have any suggestions? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem with invalidate
I guess i managed to solve it using francky's advice. code is as follows: function admin_add() { if (empty($this->data)) { $this->render(); } else { $this->cleanUpFields(); $module = $this->data['Module']['code']; $conditions = array("Module.code"=>"$module"); if ($this->Module->find($conditions)) { $this->Module->invalidate('unique'); } else if ($this->Module->save($this->data)) { $this->admin_createReview($this->Module->getLastInsertId(), $this- >data['Module']['code'],$this->data['Module']['name'],$this- >data['Module']['year_delivered']); $this->Session->setFlash('The Module has been saved and an associated review created'); $this->redirect('/admin/modules/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
i have modified as you said( below) however a user can still access the index page of the admin area as before, so problem not solved yet. any other ideas? in routes: $Route->connect('/', array('controller' => 'users', 'action' => 'login', 'home')); $Route->connect('/admin', array('controller' => 'Pages', 'action' => 'display', 'admin')); in users controller: function beforeFilter() { $this->checkSession(); if ($this->params["url"] == "admin") { $this->params[CAKE_ADMIN] = true; } if (!empty($this->params[CAKE_ADMIN])){ //debug($this->params["url"]); $user = $this->Session->read('User'); $result = $this->User- >findByUsername($user['username']); if ($result['User']['user_level'] <> 'admin') { $this->Session->setFlash('Access Denied.'); $this->redirect('/'); } // set our layout based on admin routing vars $this->layout = "admin"; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
Well i changed as you suggested (see below) however i am getting an error when i access /admin: Missing Method in PagesController You are seeing this error because the action admin_display is not defined in controller PagesController If you want to customize this error message, create app\views/errors/ missing_action.thtml. Fatal: Confirm you have created the PagesController::admin_display() in file : app\controllers\pages_controller.php old //$Route->connect('/admin', array('controller' => 'Pages', 'action' => 'display', 'admin')); new $Route->connect('/admin', array('controller' => 'Pages', 'action' =>'display', CAKE_ADMIN => CAKE_ADMIN)); am i doing something wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem with invalidate
any help? tnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: changing from localhost to web server
this code in view is being output in browser as action="/users/cojg/cake/users/add"> for some reason the admin part is being omitted, any idea why? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: need some help in understanding error messages
i think there might have been some syntax errors so i fixed it as follows, however it is still not working. any help? function beforeValidate() { // for add -there is no id if (!isset($this->data['User']['id']) && !empty($this- >data['User']['name']) && $this->hasAny("User.name=$this->data['User']['name']")) { $this->invalidate('name_unique'); } // for edit - there is id if (isset($this->data['User']['id']) && !empty($this- >data['User']['name']) && $this->findCount("User.name = $this->data['User'] ['name']")) { $this->invalidate('name_unique'); } return true; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: changing from localhost to web server
i have also checked the server and settings are as needed Mod_rewrite on AllowOverride set to All --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problem with invalidate
im using cake 1.1 and i saw this in the manual, is it not the same as my code? data['User'])) { //See if a user with that username exists $user = $this->User->findByUsername($this->data['User'] ['username']); // Invalidate the field to trigger the HTML Helper's error messages if (!empty($user['User']['username'])) { $this->User->invalidate('username');//populates tagErrorMsg('User/username') } //Try to save as normal, shouldn't work if the field was invalidated. if($this->User->save($this->data)) { $this->redirect('/users/index/saved'); } else { $this->render(); } } } } ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: changing from localhost to web server
hmm bert that seems to be messing everything for me though, for example if i go to http://localhost/cake/admin/ then click a link dfined as 'Current Modules'=>'modules', that would work, however if i click another one then, for example 'Past Modules'=>'modules/ indexarchived', this would not work as i would be directed to http://localhost/cake/admin/admin/modules/indexarchived instead of http://localhost/cake/admin/modules/indexarchived. maybe that is not what you meant, could you explain if you had a different idea? thanks On Aug 24, 6:56 am, "Bert Van den Brande" <[EMAIL PROTECTED]> wrote: > If the link in your view looks something like '/myLink' , remove the '/' > > On 8/24/07, rtconner <[EMAIL PROTECTED]> wrote: > > > > > Mod_rewrite on? > > AllowOverride set to All? > > > On Aug 23, 4:57 pm, rtanz <[EMAIL PROTECTED]> wrote: > > > any help on this? thanks > > > > On Aug 23, 11:51 am, rtanz <[EMAIL PROTECTED]> wrote: > > > > > hi i have been developing my cake site on my localserver on my pc, now > > > > when i uploaded it to the server my links are not working. On my pc > > > > the address is > > > > >http://localhost/cake/ > > > > > and on my server it is > > > > >http://url/users/cojg/cake/ > > > > > so now what is happenning is that when i click a liink on my server it > > > > directs tohttp://url/cakeandomitsthe /users/cojg part. Is there a > > > > way i can solve this without having to change all the links manually? > > > > > thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
im afraid i didnt really understand what i should change. these are my routes $Route->connect('/', array('controller' => 'users', 'action' => 'login', 'home')); $Route->connect('/admin', array('controller' => 'Pages', 'action' => 'display', 'admin')); where should i make the changes? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
any more help on this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with invalidate
hi i have the following which my logic tells me should not save if a module with the same code is already saved in the database. Now when i test it i can see that it is finding a matching code and entering into the if ($this->Module->find($conditions) statement, and i assume therefore invalidating the code field. However it saves while as i was reading in the manual it is not supposed to save after i set the invalidate. so anyone knows what i might be doing wrong here? thanks function admin_add() { if (empty($this->data)) { $this->render(); } else { $this->cleanUpFields(); $module = $this->data['Module']['code']; $conditions = array("Module.code"=>"$module"); if ($this->Module->find($conditions)) { $this->Module->invalidate('code'); } if ($this->Module->save($this->data)) { $this->admin_createReview($this->Module- >getLastInsertId(), $this->data['Module']['code'],$this->data['Module'] ['name'],$this->data['Module']['year_delivered']); $this->Session->setFlash('The Module has been saved and an associated review created'); $this->redirect('/admin/modules/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with invalidate
hi i have the following which my logic tells me should not save if a module with the same code is already saved in the database. Now when i test it i can see that it is finding a matching code and entering into the if ($this->Module->find($conditions) statement, and i assume therefore invalidating the code field. However it saves while as i was reading in the manual it is not supposed to save after i set the invalidate. so anyone knows what i might be doing wrong here? thanks function admin_add() { if (empty($this->data)) { $this->render(); } else { $this->cleanUpFields(); $module = $this->data['Module']['code']; $conditions = array("Module.code"=>"$module"); if ($this->Module->find($conditions)) { $this->Module->invalidate('code'); } if ($this->Module->save($this->data)) { $this->admin_createReview($this->Module- >getLastInsertId(), $this->data['Module']['code'],$this->data['Module'] ['name'],$this->data['Module']['year_delivered']); $this->Session->setFlash('The Module has been saved and an associated review created'); $this->redirect('/admin/modules/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: changing from localhost to web server
any help on this? thanks On Aug 23, 11:51 am, rtanz <[EMAIL PROTECTED]> wrote: > hi i have been developing my cake site on my localserver on my pc, now > when i uploaded it to the server my links are not working. On my pc > the address is > > http://localhost/cake/ > > and on my server it is > > http://url/users/cojg/cake/ > > so now what is happenning is that when i click a liink on my server it > directs tohttp://url/cakeand omits the /users/cojg part. Is there a > way i can solve this without having to change all the links manually? > > thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: need some help in understanding error messages
but what if i have more than one error? am i correct in that you can have only one set flash message? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
need some help in understanding error messages
hi right now i have baked a model with an add and edit view as automatically generated by cake. So now if I make any errors when saving (as determined by the $validate conditions below) I will get the values of the tagErrorMsg as set in the view. Now I also made a beforeSave function that checks whether a user with that username exists already, and in that case I would like to output a different message saying that 'Username already exists' instead of 'Please enter the Username'. How can i do this? thanks class User extends AppModel { var $name = 'User'; var $hasMany = array('Membership'=>array('dependent'=>true)); var $validate = array( 'username' => '/[a-z0-9\_\-]{3,}$/i', 'password' => VALID_NOT_EMPTY, 'email' => VALID_EMAIL, ); function beforeSave() { $user = $this->data['User']['username']; $conditions = array("User.username"=>"$user"); if ($this->find($conditions)) { return false; } else return true; } } tagErrorMsg('User/username', 'Please enter the Username.');?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
ok so now i modified as follows but still this is not working, i checked using debug and url is indeed shown as admin however user is still allowed access to this page function beforeFilter() { $this->checkSession(); //debug($this->params['url']); if (!empty($this->params[CAKE_ADMIN]) || $this->params['url'] == "admin") { //if (!empty($this->params[CAKE_ADMIN])){ $user = $this->Session->read('User'); $result = $this->User->findByUsername($user['username']); //print_r($result['User']['user_level']); //$user = $this->Entry->User->read(null, $user['id']); //debug($result); if ($result['User']['user_level'] <> 'admin') { $this->Session->setFlash('Access Denied.'); $this->redirect('/'); //$this->layout = "default"; } // set our layout based on admin routing vars $this->layout = "admin"; } } any other ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
correct way to do this check
hi i would like to make a check in my memberships model so that before a save there will be a check to eliminate duplicate entries. i have managed to do this using the following code in the membership model: function beforeSave() { $role = $this->data['Membership']['role_id']; $module = $this->data['Membership']['module_id']; $user = $this->data['Membership']['user_id']; $conditions = array("Membership.role_id"=>"$role","Membership.module_id"=>"$module","Membership.user_id"=>"$user"); if ($this->find($conditions)) { return false; } else return true; } however i would like to know if there is a neater way to do this thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
changing from localhost to web server
hi i have been developing my cake site on my localserver on my pc, now when i uploaded it to the server my links are not working. On my pc the address is http://localhost/cake/ and on my server it is http://url/users/cojg/cake/ so now what is happenning is that when i click a liink on my server it directs to http://url/cake and omits the /users/cojg part. Is there a way i can solve this without having to change all the links manually? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
this is how im doing my check if (!empty($this->params[CAKE_ADMIN])){ $user = $this->Session->read('User'); $result = $this->User->findByUsername($user['username']); //print_r($result['User']['user_level']); //$user = $this->Entry->User->read(null, $user['id']); if ($result['User']['user_level'] <> 'admin') { $this->Session->setFlash('Access Denied.'); $this->redirect('/'); } // set our layout based on admin routing vars $this->layout = "admin"; as you said im using params, how can i modify to also trap the manual route? thnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
any help on this pls? thnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
database connection problems
hi i have uploaded cake on to my server however i am having problems connecting to the database, as shown by the error message: Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'co-project.lboro.ac.uk ' (1) in /disks/diskh/zco/cojg/ public_html/cake/cake/libs/model/dbo/dbo_mysql.php on line 100 any idea what could be wrong on my setup? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: access check not working for index page
any help?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
access check not working for index page
$Route->connect('/admin', array('controller' => 'Pages', 'action' => 'display', 'admin')); i have an access check in my appcontroller that stops non admin users from viewing admin actions however this doesnt work with the admin index page above, how should i do this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
function problem
hi i have this function to call the parent before filter according to what action is executing, however this is not working and all actions in my userscontroller are in fact calling this beforefilter. what is the problem with my code? thanks function beforeFilter() { //$myactions = array('login', 'logout'); if (!($this->action ) == 'login'|'logout') parent::beforeFilter(); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting an SQL error with this code
ok got it tnx On Aug 22, 12:43 pm, rtanz <[EMAIL PROTECTED]> wrote: > im afraid i didnt understand the problem, can you explain more? thnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: getting an SQL error with this code
im afraid i didnt understand the problem, can you explain more? thnx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problems with saving
ok solved On Aug 22, 12:03 am, rtanz <[EMAIL PROTECTED]> wrote: > hi i have the following code set up for my years model, however when i > try to use the edit function to edit my year it is not changing. any > idea why this is so? thanks > > http://bin.cakephp.org/view/1911162233 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
getting an SQL error with this code
hi anyone can help me figure out why im having this error Query: changestatus Warning: SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'changestatus' at line 1 in W:\www\cake\cake\libs \model\datasources\dbo_source.php on line 463 Warning: Cannot modify header information - headers already sent by (output started at W:\www\cake\cake\basics.php:696) in W:\www\cake\cake \libs\controller\controller.php on line 447 with this code: ($afterdata['Review'] ['int_exam_fback'])) { $conditions = array("TaskTemplate.review_field"=>"int_exam_fback"); $tasktemplateid = $this->TaskTemplate- >find($conditions,"TaskTemplate.id"); $tasktemplateid = $tasktemplateid['TaskTemplate']['id']; //print_r($tasktemplateid); $conditions2 = array("Task.task_template_id"=>"$tasktemplateid","Task.module_id"=>"$moduleid"); $this->changestatus($conditions2); } } function changestatus($conditions2) { if($this->data = $this->find($conditions2)) { $this->data['Task']['status']='Complete'; unset($this->data['Task']['modified']); $this->save($this->data); }} ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problems with saving
hi i have the following code set up for my years model, however when i try to use the edit function to edit my year it is not changing. any idea why this is so? thanks http://bin.cakephp.org/view/1911162233 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
detect updated fields in model after save
hi i would like to detect which fields have been changed after completion of my edit function. is there some cake automagic that helps in doing this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
detect updated fields in model after save
hi i would like to detect which fields have been changed after completion of my edit function. is there some cake automagic that helps in doing this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
cjs tutorial for cakephp
hi today i came across the cjs package, which from what I can gather after doing some reading on its rails counterpart rjs, is a really useful tool one can use to manipulate javascript from within cake's php file templates. Unfortunately there is little cake documentation or tutorials about this and I think it would be a good idea for someone with knowledge in using this package to write up a basic introduction so as to encourage adoption of this package and for new users to be able to use it correctly. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: php technologies
i suggest you do some reading in these sites to get up to speed on 'php technologies': www.php.net manual.cakephp.org http://en.wikipedia.org/wiki/PHP http://en.wikipedia.org/wiki/Web_application_framework hth --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
changing view to display name field instead of id
how should i change a model's view in order to display a link to another model's record name instead of the record id? given that the view's current model only stores the id of the other model and not the name, and the two models are not directly associated thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: css menu helper
nevermind, ctp seems to be for 1.2, so for anyone using 1.1 like me u have to use .thtml. regarding second problem, i had overriden the beforeFilter that's why the one in the AppController wasnt working. solution is to include parent::beforeFilter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: css menu helper
bdw do i need to add something to the admin actions themselves? coz right now this is not working when i just put that in the AppController class. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: css menu helper
thanks, is the .ctp for 1.1 or 1.2? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
admin section protection
hi i am using the tutorial for simple user authentication for general login to my site, now i am also using cake's admin routing for the admin part of the site, and i would like to make an additional check so that only the administrator can go into that part, any advice how to achieve this? I was thinking of adding a user level field when creating a new user, then storing that in the session on login, and finally checking for user level if there is an attempt to access an admin function. does this sound like a good method? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
css menu helper
hi i am trying to implement http://bakery.cakephp.org/articles/view/css-menu-helper into my project. I would like to have 2 versions of this menu, one available in the front end of the site and another version for admin use. I am using cake's admin routing for my admin section. I would like some help regarding how to go about achieving this solution thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: where to put independent functions
yep i understood perfectly, managed to implement it thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: where to put independent functions
in my case i wouldnt want to call any particular controller, but just the upload function directly, therefore i would need just the function and its view, and i would want to call it from mysite.com/uploadfile should i use the bootstrap to do this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
where to put independent functions
hi i am wondering where to put some functions which are independent from the models in my site. for example i have a file upload function which does not affect anything else but is just used to upload files into a folder on the server without saving anything to the database. thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
creating another model after saving a model
hi i would like to create a Review model following the manual creation of a Module model. The associations are Module hasMany Review and Review belongsTo Module. Therefore i made a function that is run after a Module is saved. However this doesnt seem to be working well, i would appreciate if you point out any errors in this code or method i am using to achieve my aims thanks function add() { if (empty($this->data)) { $this->render(); } else { $this->cleanUpFields(); if ($this->Module->save($this->data)) { $this->createReview($this->Module->getLastInsertId(), $this- >data['Module']['code']); $this->Session->setFlash('The Module has been saved'); $this->redirect('/modules/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } function createReview($id,$code) { $results_url = $this->webroot . 'uploads/results/' . $code . '.pdf'; $feedback_url = $this->webroot . 'uploads/feedback/' .$code . '.pdf'; $this->data['Review']['module_id']=$id; $this->data['Review']['feedback_url']=$feedback_url; $this->data['Review']['results_url']=$results_url; $this->Module->Review->save(); print($results_url); echo(""); print($feedback_url); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: query problems
pasted everything here http://bin.cakephp.org/view/1386155143 includeing query generated and models concerned On Aug 15, 9:05 am, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > No idea really, not without seeing all three models and the query that > is being generated. > > Regards, > Langdon > > rtanz wrote: > > thnx langdon, i took that relationship out however the query is still > > returning 0 results. I am using recursive 3 so it should be able to > > retrieve two levels down. any other ideas why this is not working? tnx > > > On Aug 15, 1:47 am, Langdon Stevenson <[EMAIL PROTECTED]> > > wrote: > >> Hi rtanz > > >> In your query you don't need to specify the relationship: > > >> AND Membership.role_id = TaskTemplate.role_id > > >> If you have this relation defined between the Membership, Role, and Task > >> models, then Cake will retrieve the related data for you (assuming you > >> allow it to retrieve related data two levels down). > > >> Just select the Membership that you want and Cake will do the rest. > > >> If for some reason this produces too many queries for your liking, > >> Google the "expects()" function to help unbind unneeded models, or as a > >> last resort run the query from MySQL using $this->ModelName->query(); > > >> Regards, > >> Langdon > > >> rtanz wrote: > >>> hi i am having problems obtaining results for a query through cakephp, > >>> i posted the relevant code in this link > >>>http://bin.cakephp.org/view/1874003220 > >>> note that the first part is the query as constructed through the mysql > >>> query builder which correctly returns the results, while the second > >>> part is what i did through cake, which is not returning any results. > >>> thanks for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: query problems
thnx langdon, i took that relationship out however the query is still returning 0 results. I am using recursive 3 so it should be able to retrieve two levels down. any other ideas why this is not working? tnx On Aug 15, 1:47 am, Langdon Stevenson <[EMAIL PROTECTED]> wrote: > Hi rtanz > > In your query you don't need to specify the relationship: > > AND Membership.role_id = TaskTemplate.role_id > > If you have this relation defined between the Membership, Role, and Task > models, then Cake will retrieve the related data for you (assuming you > allow it to retrieve related data two levels down). > > Just select the Membership that you want and Cake will do the rest. > > If for some reason this produces too many queries for your liking, > Google the "expects()" function to help unbind unneeded models, or as a > last resort run the query from MySQL using $this->ModelName->query(); > > Regards, > Langdon > > rtanz wrote: > > hi i am having problems obtaining results for a query through cakephp, > > i posted the relevant code in this link > >http://bin.cakephp.org/view/1874003220 > > > note that the first part is the query as constructed through the mysql > > query builder which correctly returns the results, while the second > > part is what i did through cake, which is not returning any results. > > > thanks for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
query problems
hi i am having problems obtaining results for a query through cakephp, i posted the relevant code in this link http://bin.cakephp.org/view/1874003220 note that the first part is the query as constructed through the mysql query builder which correctly returns the results, while the second part is what i did through cake, which is not returning any results. thanks for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
therefore i should be adding my uploads folder in www/cake/app/uploads since my /app folder is the main folder where im acessing the site i.e. i type localhost/cake/ am i right in that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
any help on this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
Ok fixed the PEAR problem, now it seems to work without problem, however the file is not being uploaded for some reason. Where should i be adding the upload folder? Am i correct in putting the folder as cake/app/uploads? thanks View: submit('Add');?> Controller: function addfile() { vendor('Upload'); $upload = new HTTP_Upload("en"); $file = $upload->getFiles("userfile"); if ($file->isValid()) { $moved = $file->moveTo("uploads/"); if (!PEAR::isError($moved)) { $this->flash("File was moved to uploads ", '/uploads/'); exit;} else if (PEAR::isError($moved)) { $this->flash("File not successful", null); exit; } } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
setting pear for cakephp
im trying to use pear with cakephp, i installed it using the uniserver installer so now pear is located at W:\home\admin\www\plugins\pear/ PEAR. my cakephp code on the other hand is failing to find it, so how can i set cake to included that pear file? thanks Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in W:\www\cake\app\vendors \Upload.php on line 42 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='W:\www\cake;W:\www\cake\app\;.;/ usr/ local/PHP/includes;/usr/local/PHP/pear') in W:\www\cake\app\vendors \Upload.php on line 42 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is CakePHP right for me?
Codeigniter and cake are said to be very similar, the choice between them probably boils down to specific implementation details, such as ACL which i think codeigniter does not have out of the box, and i also think that the cakephp user base is bigger. On Aug 2, 4:23 pm, walterbyrd <[EMAIL PROTECTED]> wrote: > I'm framework shopping. I need something for significant relational > database work, and probably some CRUD. > > I tried Django, made some progress, and might go back. The things that > I didn't care for with Django: > > 1) Hosting requirements. Few hosts really work well with Django. If > you doing work for a client who uses shared hosting - forget it. > > 2) Configuration and administrative overhead seems borderline > excessive. You have to sync you urls file to your views. You have to > create a configuration file for every application. You have to create > a database model file, and and edit that file, and sync that file with > your database everytime you make a change to your db. Everytime you > make any change to the code, you have to restart your web-server, or > touch all your files depending on whether you mod_python or fastcgi. > > I also tried CodeIgitor. I made much more progress with a few hours of > CodeIgnitor, than I made with weeks of Django. But, I'm not sure about > how well CodeIgnitor will work with CRUD and/or relational database > work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
ok i think the code should be like this: vendor('Upload'); $upload = new HTTP_Upload("en"); $file = $upload->getFiles("userfile"); if ($file->isValid()) { $moved = $file->moveTo("uploads/"); if (!PEAR::isError($moved)) { $this->flash("File was moved to uploads/", '/bad/'); exit; } } but still im getting an error for a missing file Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in W:\www\cake\app\vendors \Upload.php on line 42 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='W:\www\cake;W:\www\cake\app\;.;/usr/ local/PHP/includes;/usr/local/PHP/pear') in W:\www\cake\app\vendors \Upload.php on line 42 i seem to need that file pear.php, where can i get it from and should i just put it into the vendors directory? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: passing data from model to controller
very helpful geoff, as you can see this is clearly not the case as i have tried to do this myself and have spent alot of time trying to figure it out, all i need is to know the way that i should do this in cake, at least i will know in theory what i need to do and then just try to implement it. if you dont want to help in this way i wonder what you are doing here On Aug 2, 1:12 pm, Geoff Ford <[EMAIL PROTECTED]> wrote: > @francky I know what he is trying to achieve - rtanz is trying to get > us poor helpful bakers to write his entire application for him. :-P > > Geoff Ford > --http://lemoncake.wordpress.com > > On Aug 2, 7:58 pm, rtanz <[EMAIL PROTECTED]> wrote: > > > hi franck tnx what i am trying to achieve is that when a new > > membership record is created a new tasklist record must be created. > > That is why i used the aftersave, but as you pointed out this will run > > after an update too, so its not really ideal, how should i do this > > instead? handling the membership_id in the function where i save is a > > good idea but this ties in with the previous point i.e. im not sure > > how i should go about implementing this functionality. any futher help > > would be appreciated thnx > > > On Aug 2, 6:21 am, francky06l <[EMAIL PROTECTED]> wrote: > > > > well, I am a bit lost. I do not know what you want to achieve. Just > > > few comments : > > > > - in your finddata() you should try to use the Cake convention with > > > findAll > > > - afterSave() will be called also when you update data, it does not > > > seems to be the right place to handle the inserted Id. > > > - Why not handling the membership_id in the function where you > > > actually call save() ? > > > > Again, I do not know what you want to achieve, but the overall > > > approach seems weird regarding the code posted here. > > > > On Aug 2, 12:16 am, rtanz <[EMAIL PROTECTED]> wrote: > > > > > thanks so i reviewed my code, the remaining problems are: > > > > 1. $membership_id is not being passed correctly > > > > 2. im not sure how to save the returned arrays into tasklist records > > > > any help on this? thanks > > > > > > > > > class Membership extends AppModel > > > > { > > > > var $name = 'Membership'; > > > > var $belongsTo = array('Module','Role','User'); > > > > > function afterSave(){ > > > > $membership_id = $this->getLastInsertId(); > > > > //$membership_id = 1; //getlastid > > > > $this->requestAction('tasklists/add/$membership_id'); > > > > return true; > > > > } > > > > > } > > > > > ?> > > > > > Tasklist controller: > > > > > function add($membership_id) { > > > > $tasklists = $this->Tasklist->finddata($membership_id); > > > > $this->set('tasklists',$tasklists); > > > > > } > > > > > class Tasklist extends AppModel > > > > { > > > > var $name = 'Tasklist'; > > > > var $belongsTo = array('Module','Task','User'); > > > > > function finddata($membership_id) { > > > > > return $this->query("SELECT > > > > `memberships`.`module_id`,`memberships`.`user_id`, `tasks`.`id`as > > > > task_id > > > > FROM > > > > `memberships` , `tasks` > > > > WHERE > > > > `tasks`.`role_id` = `memberships`.`role_id` AND > > > > `memberships`.`id`=$membership_id"); > > > > // debug($ret); > > > > > return $ret; > > > > } > > > > > } > > > > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: progress report matrix
tarique actually the tasks are only a descriptive name. a review would be something like this Review feedback on attendance (task 1) -> _ feedback on marks (task 2) -> _ so the task 1, task 2 etc would be a representation of the fields in a review record. If a field has been filled in that means that the task has been completed. So basically i think i would have to do a sort of list of all reviews but instead of having cake show the actual contents of each field, it will show Pending if the field is null or Complete if there is some data in it. On Aug 2, 11:46 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote: > On 8/2/07, rtanz <[EMAIL PROTECTED]> wrote: > > > > > Task 1Task 2Task 3 > > Review 1Done Pending Done > > Review 2Pending Pending Pending > > presuming review hasMany tasks > > Do a findall on reviews > > Set the result in the view > > Now in your view you will have to have nested loops > > The outer one for reviews and the inner one for task > > I am also presuming that you will be able to figure out what html would the > outer and inner loops enclose other than the data > > HTH > > Tarique > > -- > = > Cheesecake-Photoblog:http://cheesecake-photoblog.org > PHP for E-Biz:http://sanisoft.com > = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
seems to be a good option housebolt, but im getting this error: Fatal error: Call to undefined function vendors() in W:\www\cake\app \controllers\cars_controller.php on line 81 do i have to change some setting before i cna use the vendors function? thanks On Aug 2, 9:01 am, housebolt <[EMAIL PROTECTED]> wrote: > PEAR has one of the easiest uploaders to use: > > http://pear.php.net/package/HTTP_Upload > > drop the file into your vendors folder, and then follow this: > > In your view: > - > form('/wherever/', 'POST', > array('enctype'=>'multipart/form-data')); ?> > > > > In your controller: > - > vendors('HTTP_Upload'); > > $upload = new HTTP_Upload("en"); > $file = $upload->getFiles("userfile"); > > if ($file->isValid()) { > $moved = $file->moveTo("uploads/"); > if (!PEAR::isError($moved)) { > $this->flash("File was moved to uploads/", '/wherever/'); > exit; > } > > } > > also google "Pear HTTP_Upload" for a bunch of different tutorials. > > rtanz wrote: > > hi i need a simple file upload function, basically the users would be > > filling in a form and have to upload two files in the form. I dont > > need anything fancy just the facility to specify the location of the > > file and then the files get uploaded on submitting the form. When they > > view the form they should see a link to the uploaded file. > > > is there some built in cake facility to do this or should i be looking > > at other solutions? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: passing data from model to controller
hi franck tnx what i am trying to achieve is that when a new membership record is created a new tasklist record must be created. That is why i used the aftersave, but as you pointed out this will run after an update too, so its not really ideal, how should i do this instead? handling the membership_id in the function where i save is a good idea but this ties in with the previous point i.e. im not sure how i should go about implementing this functionality. any futher help would be appreciated thnx On Aug 2, 6:21 am, francky06l <[EMAIL PROTECTED]> wrote: > well, I am a bit lost. I do not know what you want to achieve. Just > few comments : > > - in your finddata() you should try to use the Cake convention with > findAll > - afterSave() will be called also when you update data, it does not > seems to be the right place to handle the inserted Id. > - Why not handling the membership_id in the function where you > actually call save() ? > > Again, I do not know what you want to achieve, but the overall > approach seems weird regarding the code posted here. > > On Aug 2, 12:16 am, rtanz <[EMAIL PROTECTED]> wrote: > > > thanks so i reviewed my code, the remaining problems are: > > 1. $membership_id is not being passed correctly > > 2. im not sure how to save the returned arrays into tasklist records > > any help on this? thanks > > > > > class Membership extends AppModel > > { > > var $name = 'Membership'; > > var $belongsTo = array('Module','Role','User'); > > > function afterSave(){ > > $membership_id = $this->getLastInsertId(); > > //$membership_id = 1; //getlastid > > $this->requestAction('tasklists/add/$membership_id'); > > return true; > > } > > > } > > > ?> > > > Tasklist controller: > > > function add($membership_id) { > > $tasklists = $this->Tasklist->finddata($membership_id); > > $this->set('tasklists',$tasklists); > > > } > > > class Tasklist extends AppModel > > { > > var $name = 'Tasklist'; > > var $belongsTo = array('Module','Task','User'); > > > function finddata($membership_id) { > > > return $this->query("SELECT > > `memberships`.`module_id`,`memberships`.`user_id`, `tasks`.`id`as > > task_id > > FROM > > `memberships` , `tasks` > > WHERE > > `tasks`.`role_id` = `memberships`.`role_id` AND > > `memberships`.`id`=$membership_id"); > > // debug($ret); > > > return $ret; > > } > > > } > > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: uploading files
thnx i already searched those before, i was just wondering whether there is some simple in built functionality that i could use as my needs seem to be pretty simple to me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
progress report matrix
hi i would like to have a report page that shows which tasks have been completed or not. in my system the aim is to fill in reviews so i would like to read each record in the reviews table and build a sort of matrix to show if each field of the record has been filled in or not: Task 1Task 2Task 3 Review 1Done Pending Done Review 2Pending Pending Pending how should i go about doing this? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
uploading files
hi i need a simple file upload function, basically the users would be filling in a form and have to upload two files in the form. I dont need anything fancy just the facility to specify the location of the file and then the files get uploaded on submitting the form. When they view the form they should see a link to the uploaded file. is there some built in cake facility to do this or should i be looking at other solutions? thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: passing data from model to controller
thanks so i reviewed my code, the remaining problems are: 1. $membership_id is not being passed correctly 2. im not sure how to save the returned arrays into tasklist records any help on this? thanks getLastInsertId(); //$membership_id = 1; //getlastid $this->requestAction('tasklists/add/$membership_id'); return true; } } ?> Tasklist controller: function add($membership_id) { $tasklists = $this->Tasklist->finddata($membership_id); $this->set('tasklists',$tasklists); } class Tasklist extends AppModel { var $name = 'Tasklist'; var $belongsTo = array('Module','Task','User'); function finddata($membership_id) { return $this->query("SELECT `memberships`.`module_id`,`memberships`.`user_id`, `tasks`.`id`as task_id FROM `memberships` , `tasks` WHERE `tasks`.`role_id` = `memberships`.`role_id` AND `memberships`.`id`=$membership_id"); // debug($ret); return $ret; } } ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: passing data from model to controller
Bdw i was planning to do the save code in the controller as follows: foreach ($tasklists as $tasklist) { $this->Tasklist->save($this->data)) } again i dont know if this is the correct way to do it and would like some help on how to do the whole thing thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
passing data from model to controller
hi i have the following class Tasklist extends AppModel { var $name = 'Tasklist'; var $belongsTo = array('Module','Task','User'); function finddata() { return $this->query("SELECT `memberships`.`module_id`, `memberships`.`user_id`, `tasks`.`id`as task_id FROM `memberships` , `tasks` WHERE `tasks`.`role_id` = `memberships`.`role_id`"); } } and in Tasklist controller: function add() { $this->set('tasklists',$this->Tasklist->finddata()); debug($tasklists); } The problem is this: Notice: Undefined variable: tasklists in W:\www\cake\app\controllers \tasklists_controller.php on line 23 Warning: Cannot modify header information - headers already sent by (output started at W:\www\cake\app\controllers \tasklists_controller.php:23) in W:\www\cake\cake\libs\controller \controller.php on line 447 I am guessing that i am not passing the data from the model to the controller in the correct way, so i would like some help on how to do that correctly. I would like to call the save method from the controller then, so as to insert the data retrieved by the query plus some additional fields. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to perform this query
ah ok tnx fixed that, any help on my last post for inserting the $ret data returned from the tasklist model into the tasklist controller's $this->data ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---