working with subdomains using a custum route class
Hi everyone i have just read this post; http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp The post give me hopes that the custom route class with helps with the subdomains issues, so i write a SubdomainRouter its having some problems with the link building… Could anyone take a look to the code? #config/routes.php App::import(‘Lib’, ‘SubdomainRoute’); define(‘MYDOMAIN’, ‘domain.com.ar’); $ops=array(‘routeClass’ => ‘SubdomainRoute’); Router::connect(’/:subdomain/’, array(‘controller’=>‘pages’,‘action’ => ‘display’,‘home’),$ops); Router::connect(’/:subdomain/:controller’, array(‘action’ => ‘index’), $ops); Router::connect(’/:subdomain/:controller/:action/*’,array(),$ops); 1. libs/subdomain_route.php class SubdomainRoute extends CakeRoute { function parse($url) { if(defined(‘MYDOMAIN’)){ $subdomain = substr( env(“HTTP_HOST”), 0, strpos(env(“HTTP_HOST”), “.”.MYDOMAIN) ); $url=’/’.$subdomain.$url; } return parent::parse($url); } function _writeUrl($params) { $params[‘subdomain’]=isset($params[‘subdomain’])? strtolower($params[‘subdomain’]):‘www’; $out=parent::_writeUrl($params); if(!defined(‘MYDOMAIN’)) return $out; $out=substr($out,strpos($out, ‘/’)+1); $out=substr($out,strpos($out, ‘/’)); return ‘http://’.$params[‘subdomain’].’.’.MYDOMAIN.$out; } } when i access to some url like; http://sub.domain.com/ or http://sub.domain.com/pages/display/test everything its okey but when i build a link using; echo $this->Html- >link(‘test’,array(‘controller’=>‘pages’,‘action’=>‘display’,‘home’,‘subdomain’=>‘www’)); it outputs this url; /app_path/http:/www.domain.com any ideas? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CakePHP 1.3.x Plugin (Working Form Wizard)
Hello. I was actually able to make it work on 1.3. From $this->Wizard->steps = array('account', 'address', 'billing', 'review'); Up to "review", but, I got stuck on the review. When I click submit. It won't complete the wizard form and won't redirect to $this->Wizard->completeUrl = '/signup/confirm'; I actually tried both, 1.3 and 1.2. On 1.2, it does redirect properly. But on 1.3, I am still trying to figure it out. Regards, -- Louie Miranda - Email: lmira...@gmail.com - Web: http://www.louiemiranda.com On Tue, Aug 10, 2010 at 4:17 PM, Louie Miranda wrote: > I am actually trying to make the wizard component work on 1.2, but > can't seem to figure it out. > > On Jun 22, 9:01 pm, kirara wrote: > > Hi guys, > > > > Do you know a form wizard plugin/component who works on the latest > > version of cakephp? I've been google-ing and just foundhttp:// > bakery.cakephp.org/articles/view/wizard-component-1-2-1for > > version 1.2.1 and found some problems with the component. > > Do you know any wizard form plugin /component that works on the the > > latest version of CakePHP? > > > > Thanks, > > kirara > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Contador en cake
Please write to this list in english! Ops sorry i responsed thinking that was the spanish list! On Tue, Aug 10, 2010 at 10:21 PM, Arnold Roa wrote: > para contar registros puedes usar Model->find('count'); > > Pero creo que no es lo que quiere hacer? > > > On Mon, Aug 9, 2010 at 3:26 PM, Jonathan Calderon Roa > wrote: > >> Buenas, cake tiene algun contador para los campos de la db ? >> >> -- >> Jonathan Andrés Calderón Roa >> >> Check out the new CakePHP Questions site http://cakeqs.org and help >> others with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To post to this group, send email to cake-php@googlegroups.com >> To unsubscribe from this group, send email to >> cake-php+unsubscr...@googlegroups.comFor >> more options, visit this group at >> http://groups.google.com/group/cake-php?hl=en >> > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Contador en cake
para contar registros puedes usar Model->find('count'); Pero creo que no es lo que quiere hacer? On Mon, Aug 9, 2010 at 3:26 PM, Jonathan Calderon Roa wrote: > Buenas, cake tiene algun contador para los campos de la db ? > > -- > Jonathan Andrés Calderón Roa > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Limiting Data Read
On Tue, Aug 10, 2010 at 8:28 PM, Olwen Williams wrote: > I'm working on a survey app: > Models Survey, Question, ResponseOption, Response, QuestionResponse > One side is that Survey has several Questions, and Question may have several > ResponseOptions (these are multichoice or a number of check boxes) > These other side is that a Survey has many Responses, and a Response has > many QuestionResponses (which are for a question, and optionally for a > ResponseOption). > In my Survey Controller I'm doing the following to only read the Survey > Side: > $this->Survey->recursive = 2; > $this->Survey->unbindModel(array('hasMany' => array('Response'))); > $this->Survey->Question->unbindModel(array('belongsTo' => array('Survey'))); > $this->Survey->Question->unbindModel(array('hasMany' => > array('QuestionResponse'))); > $this->Survey->Question->ResponseOption->unbindModel(array('hasMany' => > array('QuestionResponse'))); > $survey = $this->Survey->read(null, $id); > Is there a better way to do this? > If I want to also (in the same method) read the one response and it's > associated QuestionResponses should I just unbind the associations from > $this->Survey->Response? > Use ContainableBehavior, which will take care of unbinding your models, as well as the recursive value. class Survey extends AppModel { public $actsAs = array('Containable'); ... controller: $data = $this->Survey->find( 'first', array( 'conditions' => array(...), 'contain' => array( 'Question' => array( 'fields' => array(...), 'ResponseOption' => array( 'fields' => array(...) ) ) ) ) ); Notice that ResponseOption is inside the array for Question, as it's associated with that model, not Survey. Use debug($data) to see how the array is returned. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Limiting Data Read
I'm working on a survey app: Models Survey, Question, ResponseOption, Response, QuestionResponse One side is that Survey has several Questions, and Question may have several ResponseOptions (these are multichoice or a number of check boxes) These other side is that a Survey has many Responses, and a Response has many QuestionResponses (which are for a question, and optionally for a ResponseOption). In my Survey Controller I'm doing the following to only read the Survey Side: $this->Survey->recursive = 2; $this->Survey->unbindModel(array('hasMany' => array('Response'))); $this->Survey->Question->unbindModel(array('belongsTo' => array('Survey'))); $this->Survey->Question->unbindModel(array('hasMany' => array('QuestionResponse'))); $this->Survey->Question->ResponseOption->unbindModel(array('hasMany' => array('QuestionResponse'))); $survey = $this->Survey->read(null, $id); Is there a better way to do this? If I want to also (in the same method) read the one response and it's associated QuestionResponses should I just unbind the associations from $this->Survey->Response? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Problem with captcha form example
i did write a captcha behavior http://www.dereuromark.de/2010/08/09/how-to-implement-captchas-properly/ in case you want to give it a try its quite basic but already helpful for 98% of all bot attacks On 10 Aug., 15:55, Juliano Bordignon wrote: > hello everyone > > i am begginer in cakephp.. i follow this tutorial but i have some > questions: > > http://bakery.cakephp.org/articles/view/captcha-component-with-phpcap... > > 1- i can show the image but i not understand the check() method, here > i call then? > > 2- someone can show me the view code, and the controller?? > > thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding special characters to link text
The reason that it prints it out as the HTML is because you don't escape it. Like Vivi Vivi said, if you look at the manual you'll see you need array('escape' => false) in your options. echo $html->link('Copyright ©', '/',array('escape'=>false)); On Aug 10, 11:54 am, WhyNotSmile wrote: > Hi there, > > I have a link on my page, generated by $html->link('Company Name', > '/'); > > I want to add a copyright symbol to the Company name - is there any > way to do this? I've changed it to the raw HTML for the time being, > so I can use Company Name ©, but I'm curious as > to whether it can be done via the html helper. > > If I insert © in the link text part, it prints it out as that! > > Thanks. > > Sharon Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How can I test controllers with Auth component?
I wrote a replacement for testAction that does it the Mark Story way. You can find info here: http://42pixels.com/blog/testing-controllers-the-slightly-less-hard-way It uses what I learned from Mark and Matt and kind of combines that information into something a little more DRY. It also allows you to use Mocks and read directly from the models after testing the action. hth, jeremy On Aug 10, 12:37 pm, Hugo M wrote: > I found a pseudo-nice way in this > page:http://www.scribd.com/doc/19344870/Super-Awesome-Advanced-CakePHP-Tips > > 2010/8/10 Hugo M > > > > > I've seen tutorials about using mock objects but I want to use the function > > testAction, and the tutorials I've seen don't use that funcion. > > > They create its own functions and instanciate controllers and I think > > that's not the cakephp way. (sorry for my bad english) > > > 2010/8/10 Hugo M > > > How can I set Auth->user object in a controller when I'm testing it? > >> Because I need logged in user id { $this->Auth->user('id') } in some > >> functions :S Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding special characters to link text
On Aug 10, 8:54 pm, WhyNotSmile wrote: > Hi there, > > I have a link on my page, generated by $html->link('Company Name', > '/'); > > I want to add a copyright symbol to the Company name - is there any > way to do this? I've changed it to the raw HTML for the time being, > so I can use Company Name ©, but I'm curious as > to whether it can be done via the html helper. > > If I insert © in the link text part, it prints it out as that! why don't you just type it. http://www.copypastecharacter.com AD Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How can I test controllers with Auth component?
I found a pseudo-nice way in this page: http://www.scribd.com/doc/19344870/Super-Awesome-Advanced-CakePHP-Tips 2010/8/10 Hugo M > I've seen tutorials about using mock objects but I want to use the function > testAction, and the tutorials I've seen don't use that funcion. > > They create its own functions and instanciate controllers and I think > that's not the cakephp way. (sorry for my bad english) > > 2010/8/10 Hugo M > > How can I set Auth->user object in a controller when I'm testing it? >> Because I need logged in user id { $this->Auth->user('id') } in some >> functions :S >> > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding special characters to link text
Take a look on http://book.cakephp.org/view/1442/link On Tue, Aug 10, 2010 at 9:54 PM, WhyNotSmile wrote: > Hi there, > > I have a link on my page, generated by $html->link('Company Name', > '/'); > > I want to add a copyright symbol to the Company name - is there any > way to do this? I've changed it to the raw HTML for the time being, > so I can use Company Name ©, but I'm curious as > to whether it can be done via the html helper. > > If I insert © in the link text part, it prints it out as that! > > Thanks. > > Sharon > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- Vivi http://photos.vr-3d.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Adding special characters to link text
Hi there, I have a link on my page, generated by $html->link('Company Name', '/'); I want to add a copyright symbol to the Company name - is there any way to do this? I've changed it to the raw HTML for the time being, so I can use Company Name ©, but I'm curious as to whether it can be done via the html helper. If I insert © in the link text part, it prints it out as that! Thanks. Sharon Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to resolve this? One table per type of object, many users, user can access only his objects
Can you more explain your idea? thank you W dniu 2010-08-09 18:15, cricket pisze: On Sun, Aug 8, 2010 at 11:16 AM, Mariaczi.PL wrote: Hi! I have a problem. I need to create card indexes. Group has Files(e.g. Families), Group has many users, and users from one group have to have access only for records which have correct group_id. Families is one table, and family have memberships :) like parents, childrens. Security is very important. Users from other groups shouldnt can see or edit files which is property of another group. How to resolve this... ? It's difficult to say without a better idea of your models. Your explanation is a bit confusing. But something like: 'conditions' => array( 'Model.group_id' => $this->Auth->user('group_id') ) That'll work in the controller but, if your find() code is in the model, you'll need to pass the group_id to the model method: $data = "" function fetchStuff($group_id = null) { Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- z poważaniem Marek Wojciech Urbanowicz Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How can I test controllers with Auth component?
I've seen tutorials about using mock objects but I want to use the function testAction, and the tutorials I've seen don't use that funcion. They create its own functions and instanciate controllers and I think that's not the cakephp way. (sorry for my bad english) 2010/8/10 Hugo M > How can I set Auth->user object in a controller when I'm testing it? > Because I need logged in user id { $this->Auth->user('id') } in some > functions :S > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Loop through array, output checkboxes in a table using the form helper?
I'm not sure to be honest because i once had this problem and i ended up in writing plain html, but maybe it had something to do with a tricky s thing (it could also be, that i didnt liked it how cake arranges checkboxes and normal inputs differently). but i do remember that i got it to work at some point, using cakes helper basically it should be possible if you always use the same name for the input and provide an $options-array with only one element each time you call it... be sure to add an 'id' attribute because otherwise you would get wrong html because of repeated ids (because cake generates the id from the input-name and due to having only one options-element per call all checkboxes would have an id like 'FormField0') in every case where the form helper is not enough, you could extend it and implement your own helper-methods using the basic-form-helper methods.. For example you could implement a create_checkboxes($default, $input, $args) method which would store all the needed checkboxes in an internal array and then another method get_checkbox($value) which would output the checkbox which represents $value..but this is just a quick'n'dirty idea about how to extend the formhelper On 9 Aug., 18:44, xndx wrote: > Hey guys, > > Not sure if this is possible so apologies for a silly question, but I > currently have this code that does a nice checkbox list of options: > > echo $form->input('whatever', array('multiple' => 'checkbox', 'label' > => false, 'options' => array($whatever))); > > This works great, but I need to place each item into it's own table > row along some other data and apply some Javascript to it. Is there > anyway to nicely do this using the form helper or am I going to have > to use some messy code and hack around it? > > Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How can I test controllers with Auth component?
How can I set Auth->user object in a controller when I'm testing it? Because I need logged in user id { $this->Auth->user('id') } in some functions :S Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CSS placement problem/question
On Mon, Aug 9, 2010 at 1:35 PM, barnux wrote: > I'm a little confused on placement of css files within the Cakephp > framework. From the docuementation > > This method of CSS inclusion assumes that the CSS file specified > resides inside the /app/webroot/css directory. > > ?php echo $html->css('forms'); ?> Will output: type="text/css" href="/css/forms.css" /> > > When I run my application, it cannot find this css file. If I create > a css folder in the root and add forms.css to it, it works. How do I > get Cakephp to recognize the css folder in the /app/webroot/css > directory? The /app/webroot/css directory should already exist. Are you talking about a subdirectory? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: passing values from javascript to cakes controller function
On Tue, Aug 10, 2010 at 7:54 AM, Tomfox Wiranata wrote: > hi everyone, > > sth is bugging me. > > i have a div "title". is a user clicks on that div, a css popup opens > with a textarea for entering information. after the user entered the > information it is passed to a function in my controller "processtitle" > so it can be rendered in the div "title" with ajax. > > so the information will be shown without loading the whole page. but i > am having problem passing the entered information to my function: this > is my code > > my view: > > this is the css popup with the textarea: > > > charset="utf-8"> > > Titel > > style="width: > 105%" > > > type="button">OK > echo $form->end(); > ?> > > > > > > so i iam calling the JS function refreshtitle() > > function refreshtitle(){ > > $ > ('#title_content').fadeOut('slow').load('processtitle').fadeIn('slow'); > $('#fade , .popup_block').fadeOut(function() { > $('#fade, a.close').remove(); //fade them both out > }); > > } > > and i am calling my controller funtion processtitle > > > function processtitle() > { > $input_title = $this->data['abc']['notes']; > $this->Session->write('abc.title', $input_title); > $this->set('abc_title', strip_tags($this->Session- >>read('abc.title'))); > $this->render('render_title','ajax'); > } > > > now i am thinking the problem is, that $input_title has no data in > here, since "data['Linkable']['notes']" is not passed. > > if i simply put an echo "test" in the rendered view "render_title" > this string is shown. so that tells me the process is working. but its > not showing echo $abc_title, the variable i set. > > so how can I pass the value from my textarea over javascipt to my > controller? > > thx so much :) > You're not submitting anything to the server. You need to submit the form in the refreshtitle() function. Include the correct form action attribute and (it looks to me like you're using JQuery) have the JS submit the form using AJAX. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: coding a loop in cake?
wow your goodi'll give it a shot thx. i appreciate it :) On 10 Aug., 18:39, cricket wrote: > On Tue, Aug 10, 2010 at 12:30 PM, Tomfox Wiranata > > wrote: > > thx to both.. > > :) > > > @cricket: > > > am i getting it right? you are writing all numers from the database > > into an array and compare both? is it possible that at a certain point > > it will get to big or too much data? cause my range starts at > > 1 and ends at 9 > > > if there are 50million in the table they all get saved in an array > > Yes, that's correct. I should have pointed that out. You could cache > the results, of course, but perhaps a better way would be to pass > $new_number to a protected method (that does a find() and comparison) > inside the while section. You'd have to have the separate method > because while() isn't a block, where you can have several lines of > code. Something like: > > public function getNewNumber() > { > do > { > $new_number = rand(10,10); > } > while ($this->_testNewNumber($new_number)); > > return $new_number; > > } > > protected function _testNewNumber($x) > { > // return $x exists in DB > > } Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP 1.3.3 and postgresql 8.2.14 Bug
CakePHP 1.3.3 was unable to connect to postgres 8.2.14 server (on CentOS 5.5 ) even though all the configuration was correct. I fixed this editing this file: /cake/libs/model/datasources/dbo/ dbo_postgres.php inside the function connect() remove host and port parameters within $conn variable. I'm not sure why this error happened but this is how to fix it. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Problem with captcha form example
hello everyone i am begginer in cakephp.. i follow this tutorial but i have some questions: http://bakery.cakephp.org/articles/view/captcha-component-with-phpcaptcha 1- i can show the image but i not understand the check() method, here i call then? 2- someone can show me the view code, and the controller?? thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: coding a loop in cake?
On Tue, Aug 10, 2010 at 12:30 PM, Tomfox Wiranata wrote: > thx to both.. > :) > > @cricket: > > am i getting it right? you are writing all numers from the database > into an array and compare both? is it possible that at a certain point > it will get to big or too much data? cause my range starts at > 1 and ends at 9 > > if there are 50million in the table they all get saved in an array Yes, that's correct. I should have pointed that out. You could cache the results, of course, but perhaps a better way would be to pass $new_number to a protected method (that does a find() and comparison) inside the while section. You'd have to have the separate method because while() isn't a block, where you can have several lines of code. Something like: public function getNewNumber() { do { $new_number = rand(10,10); } while ($this->_testNewNumber($new_number)); return $new_number; } protected function _testNewNumber($x) { // return $x exists in DB } Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: I have created my default layout and now no flash message
Include this: Session->flash(); ?> in default.ctp Regards Román Mussi On 10 ago, 08:36, "Mariano C." wrote: > I have created a new default view putting default.ctp in layouts > folder but now I can't see message flashed. Why? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
meioupload sql error
Hi, I am new to this group and to cake so I appologise if I asked already asked question. I have cake 1.3.3 and meio_upload isn't working for me. I get an error when I try to upload files : Notice (8): Array to string conversion [CORE\cake\libs\model \datasources\dbo_source.php, line 746] Warning (512): SQL Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs\model\datasources\dbo_source.php, line 681] Query: INSERT INTO `modelgs` (`image`, `modified`, `created`) VALUES (Array, '2010-08-10 10:16:23', '2010-08-10 10:16:23') I tried evrything, and after some examination, I realizes that even if I delete the update_meio.php from my behavior folder, that I still get the same message, as if I never included it in my acts_as variable. Can someone please help ? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to create user management
How to create user management in cake php Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Contador en cake
Buenas, cake tiene algun contador para los campos de la db ? -- Jonathan Andrés Calderón Roa Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CSS placement problem/question
I'm a little confused on placement of css files within the Cakephp framework. From the docuementation This method of CSS inclusion assumes that the CSS file specified resides inside the /app/webroot/css directory. ?php echo $html->css('forms'); ?> Will output: When I run my application, it cannot find this css file. If I create a css folder in the root and add forms.css to it, it works. How do I get Cakephp to recognize the css folder in the /app/webroot/css directory? Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
validação de formulario com captcha
Boa tarde pessoal.. sou novo com cakePHP, então tenho muitas duvidas Tenho um form que faz validação com captcha, mas não estou conseguindo validar Esse form, esta mostrando a captcha e quardando ela na session.. O form esta com action para o add do scafold.. Ai vem a minha duvida, tem como eu editar esse add para fazer a validação (onde ele se encontra)? Tem uma forma melhor de fazer isso? Obrigado (se a pergunta for muito boba, dão um desconto pois sou noob no assunto) Juliano Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Loop through array, output checkboxes in a table using the form helper?
Hey guys, Not sure if this is possible so apologies for a silly question, but I currently have this code that does a nice checkbox list of options: echo $form->input('whatever', array('multiple' => 'checkbox', 'label' => false, 'options' => array($whatever))); This works great, but I need to place each item into it's own table row along some other data and apply some Javascript to it. Is there anyway to nicely do this using the form helper or am I going to have to use some messy code and hack around it? Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP without mod_rewrite
Hello everyone, Unfortunately, I'm stuck with a web host that does not provide mod_rewrite support. Having found a few resources that provide some of the answers regarding how to setup CakePHP without mod_rewrite, I've unzipped cake into the document root and followed the instructions provided. As such, I can view URLs with the following format. http://www.domain.com/index.php/controler/view However, these resources do not explain the role (if any) of the app/ webroot folder when used in this scenario. Do I just assume it does not exist and move the CSS and JS files found there into the actual document root of the site. Would this require an additional config file change. Also, it would appear there are security problems with the fact that the app/config folder is present the document root. In other words, are there any resources that go beyond uncommenting define ('BASE_URL', env('SCRIPT_NAME')) in /app/config/ core.php and removing the .htaccess file? Thanks in advance, - Scott Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to set separate admin
Hi All, I have worked in cakephp in the past but I am new to the latest version and working after so much of time in cakephp. I am working on a site with an administration panel. What I want is to keep all the admin files as separate. So my URL should look someting like this: domain.com (frontend) domain.com/admin (administrator) Can someone please let me know how can I achieve this? I have checked the Routing.preferences line in core.php. I have read the following post related to similar thing: http://groups.google.com/group/cake-php/browse_thread/thread/cacf9896aba211b0/e7b8838b840c872b I also know there is a concept of Multiple app folders. But somehow I am not being able to sum up the things. I will really appreciate if someone can let me know the steps or point me to some page explaining this. Regards Manish Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Session Destroy behaviour help
hi. having an issue, hoping someone can point me in the right direction. On my local machine, $this->Session->destroy() works as expected. I call it in my logout action, and it destroys the session data, which logs me out of my app. However, I've deployed to my live server, and $this->Session- >destroy() doesn't seem to have any effect. It regenerates the session id, but all the old data persists, so my logout doesn't work. I've set it to use the folder in /tmp/sessions but that hasn't changed anything. Any ideas what can be the cause/ what I should be looking at? In the meantime, in my logout function, i call $this->Session- >delete('keyName') to explicitly delete the info, but would like to understand why I am seeing 2 different behaviours. Using cake 1.3.3 thanks m Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: coding a loop in cake?
thx to both.. :) @cricket: am i getting it right? you are writing all numers from the database into an array and compare both? is it possible that at a certain point it will get to big or too much data? cause my range starts at 1 and ends at 9 if there are 50million in the table they all get saved in an array thx On 10 Aug., 18:17, cricket wrote: > On Tue, Aug 10, 2010 at 10:18 AM, Tomfox Wiranata > > > > wrote: > > hi, > > > i need to check if a specific, randomly generated number already > > exists in the database. when it does exist, a new number needs to be > > created and checked too. until there is a number, that doesn't exist > > already.. > > > the check in my model for existance: > > > function validatenumber($data) > > { > > $test = $this->find(array('number' => $data), array('user_id')); > > > if(empty('test') == true) > > return true; > > return false; > > } > > > now i can make a working check, but only once in my controller: > > > $x=rand(10,10); > > > if($test=$this->Linkable->validatenumber($x) == true) > > { > > return $x: > > }else{ > > > > } > > > but how can i make a loop to create numbers as long as one is not > > already taken? is there sth like a for loop? havent seen anything like > > that yet > > Use the do {} while() construct. > > public function getNewNumber() > { > /* fetch all existing numbers > */ > $numbers = $this->find( > 'list', > array( > 'fields' => array( > 'Linkable.number' > ) > ) > ); > > /* create new number; check exists; repeat if necessary > */ > do > { > $new_number = rand(10,10); > } > while (in_array($new_number, array_values($numbers)); > > return $new_number; > > } > > So, in the controller, you could assign the number with a single call > to $this->Linkable->getNewNumber() and be done with it. > > I didn't quite understand your find() code. I think what I have above > should maybe work, though. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: I have created my default layout and now no flash message
On Tue, Aug 10, 2010 at 7:36 AM, Mariano C. wrote: > I have created a new default view putting default.ctp in layouts > folder but now I can't see message flashed. Why? That's a pretty vague query. Do you have $session->flash() in there somewhere? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: coding a loop in cake?
On Tue, Aug 10, 2010 at 10:18 AM, Tomfox Wiranata wrote: > hi, > > i need to check if a specific, randomly generated number already > exists in the database. when it does exist, a new number needs to be > created and checked too. until there is a number, that doesn't exist > already.. > > the check in my model for existance: > > function validatenumber($data) > { > $test = $this->find(array('number' => $data), array('user_id')); > > if(empty('test') == true) > return true; > return false; > } > > now i can make a working check, but only once in my controller: > > $x=rand(10,10); > > if($test=$this->Linkable->validatenumber($x) == true) > { > return $x: > }else{ > > } > > > but how can i make a loop to create numbers as long as one is not > already taken? is there sth like a for loop? havent seen anything like > that yet Use the do {} while() construct. public function getNewNumber() { /* fetch all existing numbers */ $numbers = $this->find( 'list', array( 'fields' => array( 'Linkable.number' ) ) ); /* create new number; check exists; repeat if necessary */ do { $new_number = rand(10,10); } while (in_array($new_number, array_values($numbers)); return $new_number; } So, in the controller, you could assign the number with a single call to $this->Linkable->getNewNumber() and be done with it. I didn't quite understand your find() code. I think what I have above should maybe work, though. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: coding a loop in cake?
You need to set the number before you validate the data... so you could add that loop to the beforeValidate callback to set the proper number. The downside to that is validating a model will actually change it's state too, which might no be expected. On Tue, Aug 10, 2010 at 9:18 AM, Tomfox Wiranata wrote: > hi, > > i need to check if a specific, randomly generated number already > exists in the database. when it does exist, a new number needs to be > created and checked too. until there is a number, that doesn't exist > already.. > > the check in my model for existance: > > function validatenumber($data) > { > $test = $this->find(array('number' => $data), array('user_id')); > > if(empty('test') == true) > return true; > return false; > } > > now i can make a working check, but only once in my controller: > > $x=rand(10,10); > > if($test=$this->Linkable->validatenumber($x) == true) > { > return $x: > }else{ > > } > > > but how can i make a loop to create numbers as long as one is not > already taken? is there sth like a for loop? havent seen anything like > that yet > > thank you so much :) > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: how do i preset a value for an input field?
http://www.dereuromark.de/2010/06/23/working-with-forms/ 2nd paragraph On 10 Aug., 15:52, Jeremy Burns | Class Outfit wrote: > Use the 'default' option: > > echo $this->Form->input('fieldName', array('default' => 'your default')); > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.comhttp://www.classoutfit.com > > On 10 Aug 2010, at 14:47, james wrote: > > > > > I'm passing some variables from a view to an add and I would like > > those variables to be preset in some of the input fields. > > > So for in lead->view.ctp i get the variable $leads['Lead'] > > ['business_name']; > > > and pass it to appointment->add.ctp. > > > in this second view the field business name (still an input) would > > then have that data already in the field. > > > Thanks! > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > You received this message because you are subscribed to the Google Groups > > "CakePHP" group. > > To post to this group, send email to cake-php@googlegroups.com > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
coding a loop in cake?
hi, i need to check if a specific, randomly generated number already exists in the database. when it does exist, a new number needs to be created and checked too. until there is a number, that doesn't exist already.. the check in my model for existance: function validatenumber($data) { $test = $this->find(array('number' => $data), array('user_id')); if(empty('test') == true) return true; return false; } now i can make a working check, but only once in my controller: $x=rand(10,10); if($test=$this->Linkable->validatenumber($x) == true) { return $x: }else{ } but how can i make a loop to create numbers as long as one is not already taken? is there sth like a for loop? havent seen anything like that yet thank you so much :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: how do i preset a value for an input field?
Use the 'default' option: echo $this->Form->input('fieldName', array('default' => 'your default')); Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 10 Aug 2010, at 14:47, james wrote: > I'm passing some variables from a view to an add and I would like > those variables to be preset in some of the input fields. > > So for in lead->view.ctp i get the variable $leads['Lead'] > ['business_name']; > > and pass it to appointment->add.ctp. > > in this second view the field business name (still an input) would > then have that data already in the field. > > Thanks! > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
how do i preset a value for an input field?
I'm passing some variables from a view to an add and I would like those variables to be preset in some of the input fields. So for in lead->view.ctp i get the variable $leads['Lead'] ['business_name']; and pass it to appointment->add.ctp. in this second view the field business name (still an input) would then have that data already in the field. Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: how can i tell cake to delete directories automatically after a specific time
Cron would work if you wanted something deleted in a batch at a given interval but if you want to ensure the file is removed exactly 24h later you want to use crons little brother, the 'at' command. On Aug 6, 1:35 pm, Miles J wrote: > Just setup a cron job that runs every 1/24 hour(s) that cleans up the > tmp directory. > > Why not just put all uploads into the same tmp directory? Very slim > chance anything will ever overwrite each other. > > On Aug 6, 6:03 am, Tomfox Wiranata wrote: > > > hi, > > > lets say a user uploads an image. then i create a temp-folder to save > > it temporarily. once the user is finished i delete this temp directory > > and copy the image to the actual path. > > > now lets say, he uploads it, cake puts it to the temp directory and > > the user cancels the process by shutting down the browser or just > > leaving the website. if that happens, i want to delete the temp-dir. > > so is it possible to check if the user left the site or shut down the > > browser? > > > if not, then i'd like to check what temp directories have been created > > 24hrs ago and still exist, so i can delete them. is that possible? > > > thank you so far. as usual :) > > > btw: i love this forum Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How save data HABTM?
This format? $state = $this->Order->OrdersPart->save($partsList); $partsList= Array ( [Order] => Array ( [id] => 1 ) [Part] => Array ( [Part] => Array ( [0] => Array ( [item_id] => 20 [name] => BOLT,FLANGED,9X90 [code] => 92153-1610 [price] => 43647.00 [count] => 3 ) [1] => Array ( [item_id] => 3 [name] => BOLT-SOCKET [code] => 120CD0630 [price] => 15373.00 [count] => 1 ) [2] => Array ( [item_id] => 14 [name] => BOLT,6X14 [code] => 92153-0406 [price] => 44197.00 [count] => 1 ) [3] => Array ( [item_id] => 19 [name] => BOLT,6X45 [code] => 92153-0656 [price] => 40391.00 [count] => 2 ) ) ) ) This dont work. Wher cookbook i can find it, there it doesnt? http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo http://book.cakephp.org/view/85/Saving-Related-Model-Data-HABTM On 10 srp, 13:42, Marek Wojciech Urbanowicz wrote: > You have to add index like Part.0.name etc. .. see in the cookbook > W dniu 2010-08-10 13:38, Petr Vytlačil pisze:Hi I need save data to order and > orders_items and orders_parts, i try use: $this->Order->OrdersPart->save() or > $this->Order->saveAll() this array: Array ( [0] => Array ( [Order] => Array ( > [id] => 1 ) [Part] => Array ( [Part] => Array ( [item_id] => 20 [name] => > BOLT,FLANGED,9X90 [code] => 92153-1610 [price] => 43647.00 [count] => 3 ) ) ) > ) --- But this dont save data THX Model tables: orders HABTM items or parts > CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, > `mailingaddress_id` int(11) DEFAULT NULL, `billingaddress_id` int(11) NOT > NULL, `created` datetime DEFAULT NULL, `state` int(11) DEFAULT NULL, `note` > varchar(255) COLLATE utf8_czech_ci DEFAULT NULL, `user_id` int(11) NOT NULL, > PRIMARY KEY (`id`), KEY `fk_orders_users1` (`user_id`) ) ENGINE=MyISAM > DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF > NOT EXISTS `orders_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item_id` > int(11) NOT NULL, `order_id` int(11) NOT NULL, `name` varchar(255) COLLATE > utf8_czech_ci NOT NULL, `code` varchar(60) COLLATE utf8_czech_ci DEFAULT > NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, PRIMARY KEY > (`id`,`item_id`,`order_id`), KEY `fk_items_has_orders_items1` (`item_id`), > KEY `fk_items_has_orders_orders1` (`order_id`) ) ENGINE=MyISAM DEFAULT > CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT > EXISTS `orders_parts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_id` > int(11) NOT NULL, `part_id` int(11) NOT NULL, `name` varchar(100) COLLATE > utf8_czech_ci NOT NULL, `code` varchar(100) COLLATE utf8_czech_ci NOT NULL, > `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, `type` int(11) NOT > NULL, PRIMARY KEY (`id`,`order_id`,`part_id`), KEY > `fk_orders_has_parts_orders1` (`order_id`), KEY `fk_orders_has_parts_parts1` > (`part_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci > AUTO_INCREMENT=1 ; Check out the new CakePHP Questions > sitehttp://cakeqs.organd help others with their CakePHP related questions. > You received this message because you are subscribed to the Google Groups > "CakePHP" group. To post to this group, send email > tocake-...@googlegroups.comto unsubscribe from this group, send email > tocake-php+unsubscr...@googlegroups.comfor more options, visit this group > athttp://groups.google.com/group/cake-php?hl=en--z poważaniemMarek Wojciech > Urbanowicz Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
passing values from javascript to cakes controller function
hi everyone, sth is bugging me. i have a div "title". is a user clicks on that div, a css popup opens with a textarea for entering information. after the user entered the information it is passed to a function in my controller "processtitle" so it can be rendered in the div "title" with ajax. so the information will be shown without loading the whole page. but i am having problem passing the entered information to my function: this is my code my view: this is the css popup with the textarea: Titel OK end(); ?> so i iam calling the JS function refreshtitle() function refreshtitle(){ $ ('#title_content').fadeOut('slow').load('processtitle').fadeIn('slow'); $('#fade , .popup_block').fadeOut(function() { $('#fade, a.close').remove(); //fade them both out }); } and i am calling my controller funtion processtitle function processtitle() { $input_title = $this->data['abc']['notes']; $this->Session->write('abc.title', $input_title); $this->set('abc_title', strip_tags($this->Session- >read('abc.title'))); $this->render('render_title','ajax'); } now i am thinking the problem is, that $input_title has no data in here, since "data['Linkable']['notes']" is not passed. if i simply put an echo "test" in the rendered view "render_title" this string is shown. so that tells me the process is working. but its not showing echo $abc_title, the variable i set. so how can I pass the value from my textarea over javascipt to my controller? thx so much :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How save data HABTM?
You have to add index like Part.0.name etc. .. see in the cookbook W dniu 2010-08-10 13:38, Petr Vytlačil pisze: Hi I need save data to order and orders_items and orders_parts, i try use: $this->Order->OrdersPart->save() or $this->Order->saveAll() this array: Array ( [0] => Array ( [Order] => Array ( [id] => 1 ) [Part] => Array ( [Part] => Array ( [item_id] => 20 [name] => BOLT,FLANGED,9X90 [code] => 92153-1610 [price] => 43647.00 [count] => 3 ) ) ) ) --- But this dont save data THX Model tables: orders HABTM items or parts CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mailingaddress_id` int(11) DEFAULT NULL, `billingaddress_id` int(11) NOT NULL, `created` datetime DEFAULT NULL, `state` int(11) DEFAULT NULL, `note` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fk_orders_users1` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `orders_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_czech_ci NOT NULL, `code` varchar(60) COLLATE utf8_czech_ci DEFAULT NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, PRIMARY KEY (`id`,`item_id`,`order_id`), KEY `fk_items_has_orders_items1` (`item_id`), KEY `fk_items_has_orders_orders1` (`order_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `orders_parts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `part_id` int(11) NOT NULL, `name` varchar(100) COLLATE utf8_czech_ci NOT NULL, `code` varchar(100) COLLATE utf8_czech_ci NOT NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, `type` int(11) NOT NULL, PRIMARY KEY (`id`,`order_id`,`part_id`), KEY `fk_orders_has_parts_orders1` (`order_id`), KEY `fk_orders_has_parts_parts1` (`part_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- z poważaniem Marek Wojciech Urbanowicz Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How save data HABTM?
Hi I need save data to order and orders_items and orders_parts, i try use: $this->Order->OrdersPart->save() or $this->Order->saveAll() this array: Array ( [0] => Array ( [Order] => Array ( [id] => 1 ) [Part] => Array ( [Part] => Array ( [item_id] => 20 [name] => BOLT,FLANGED,9X90 [code] => 92153-1610 [price] => 43647.00 [count] => 3 ) ) ) ) --- But this dont save data THX Model tables: orders HABTM items or parts CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `mailingaddress_id` int(11) DEFAULT NULL, `billingaddress_id` int(11) NOT NULL, `created` datetime DEFAULT NULL, `state` int(11) DEFAULT NULL, `note` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fk_orders_users1` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `orders_items` ( `id` int(11) NOT NULL AUTO_INCREMENT, `item_id` int(11) NOT NULL, `order_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_czech_ci NOT NULL, `code` varchar(60) COLLATE utf8_czech_ci DEFAULT NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, PRIMARY KEY (`id`,`item_id`,`order_id`), KEY `fk_items_has_orders_items1` (`item_id`), KEY `fk_items_has_orders_orders1` (`order_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `orders_parts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `part_id` int(11) NOT NULL, `name` varchar(100) COLLATE utf8_czech_ci NOT NULL, `code` varchar(100) COLLATE utf8_czech_ci NOT NULL, `price` decimal(6,2) NOT NULL, `count` int(11) NOT NULL, `type` int(11) NOT NULL, PRIMARY KEY (`id`,`order_id`,`part_id`), KEY `fk_orders_has_parts_orders1` (`order_id`), KEY `fk_orders_has_parts_parts1` (`part_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci AUTO_INCREMENT=1 ; Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
I have created my default layout and now no flash message
I have created a new default view putting default.ctp in layouts folder but now I can't see message flashed. Why? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: relationship advice
That sounds like one table too many to me. You can get what you want by doing simple finds, made even easier by using the containable behaviour, IMO. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 10 Aug 2010, at 11:26, Felix wrote: > Thanks, Jeremy, Andras - I think I've worked it out now, > > I wanted to keep the HABTM relationship so I could easily list all the > products in an order and find all the orders a particular product is > listed in, the HABTM seems the easiest way to do it so I'll leave that > as it is. I've added an additional table to store the quantity and > other info. > > Thanks for your quick replies, > > Felix > > On Aug 9, 6:59 pm, Andras Kende wrote: >> Felix, >> >> for a simple cart not sure if habtm is needed... >> >> could be: >> >> products >> id | name | description | image | price | qty >> >> orders >> id | name | address | grandtotal | tracking | status | >> >> order hasmany orderi_tems >> >> order_items >> id | order_id | product_id | qty | price |etc... >> >> order_items belongsto order , product >> >> Andras Kendehttp://www.kende.com >> >> On Aug 9, 2010, at 12:27 PM, Felix wrote: >> >> >> >>> Hi, I was wondering if anyone can help with a problem I'm having. >> >>> I'm building a simple shopping cart system for which I have two >>> objects >> >>> 1. Product (stores product details - name, cost, SKU, etc.) >> >>> 2. Order (Stores order details - customer address, shipping type, >>> etc.) >> >>> In the database these are joined using the table, orders_products. >> >>> Cake correctly recognises the HABTM relationship between the two, so >>> far so good. >> >>> What I'm now stuck at is how to incorporate a quantity variable. >> >>> Each product in an order must have a quantity but I don't know where >>> to put it, >> >>> I don't think it belongs in the products table or the order table, so >>> the only place I can think of is in the join table (orders_products). >> >>> If I add this field in how would I then set or read its value, seeing >>> as it has no model I don;t know how to address it. >> >>> The join table does show up when baking so I could add one, but I >>> don't know if this would mess up the HABTM between the product and >>> order models, and if it does what relationships I need to define in >>> the relevant models to resolve such issues. >> >>> I may of course be missing something or asking a very stupid question, >>> in which case sorry but could you point out my idiocy! >> >>> Thanks, Felix >> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others >>> with their CakePHP related questions. >> >>> You received this message because you are subscribed to the Google Groups >>> "CakePHP" group. >>> To post to this group, send email to cake-php@googlegroups.com >>> To unsubscribe from this group, send email to >>> cake-php+unsubscr...@googlegroups.com For more options, visit this group >>> athttp://groups.google.com/group/cake-php?hl=en > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: relationship advice
Thanks, Jeremy, Andras - I think I've worked it out now, I wanted to keep the HABTM relationship so I could easily list all the products in an order and find all the orders a particular product is listed in, the HABTM seems the easiest way to do it so I'll leave that as it is. I've added an additional table to store the quantity and other info. Thanks for your quick replies, Felix On Aug 9, 6:59 pm, Andras Kende wrote: > Felix, > > for a simple cart not sure if habtm is needed... > > could be: > > products > id | name | description | image | price | qty > > orders > id | name | address | grandtotal | tracking | status | > > order hasmany orderi_tems > > order_items > id | order_id | product_id | qty | price |etc... > > order_items belongsto order , product > > Andras Kendehttp://www.kende.com > > On Aug 9, 2010, at 12:27 PM, Felix wrote: > > > > > Hi, I was wondering if anyone can help with a problem I'm having. > > > I'm building a simple shopping cart system for which I have two > > objects > > > 1. Product (stores product details - name, cost, SKU, etc.) > > > 2. Order (Stores order details - customer address, shipping type, > > etc.) > > > In the database these are joined using the table, orders_products. > > > Cake correctly recognises the HABTM relationship between the two, so > > far so good. > > > What I'm now stuck at is how to incorporate a quantity variable. > > > Each product in an order must have a quantity but I don't know where > > to put it, > > > I don't think it belongs in the products table or the order table, so > > the only place I can think of is in the join table (orders_products). > > > If I add this field in how would I then set or read its value, seeing > > as it has no model I don;t know how to address it. > > > The join table does show up when baking so I could add one, but I > > don't know if this would mess up the HABTM between the product and > > order models, and if it does what relationships I need to define in > > the relevant models to resolve such issues. > > > I may of course be missing something or asking a very stupid question, > > in which case sorry but could you point out my idiocy! > > > Thanks, Felix > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > You received this message because you are subscribed to the Google Groups > > "CakePHP" group. > > To post to this group, send email to cake-php@googlegroups.com > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CakePHP 1.3.x Plugin (Working Form Wizard)
I am actually trying to make the wizard component work on 1.2, but can't seem to figure it out. On Jun 22, 9:01 pm, kirara wrote: > Hi guys, > > Do you know a form wizard plugin/component who works on the latest > version of cakephp? I've been google-ing and just > foundhttp://bakery.cakephp.org/articles/view/wizard-component-1-2-1for > version 1.2.1 and found some problems with the component. > Do you know any wizard form plugin /component that works on the the > latest version of CakePHP? > > Thanks, > kirara Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en