Re: Scripts for layout and Html-meta confusion
remove 'inline' = false nothing is returned with that option set (script and css use that option to set to scripts_for_layout) On 17 September 2011 00:46, Santiago Basulto santiago.basu...@gmail.comwrote: ,'inline' = false -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Scripts for layout and Html-meta confusion
If setting this in the view then you need to set it to another layout variable which you echo out in the header of your layout. HTH, Paul @phpMagpie On Sep 17, 8:27 am, Sam Sherlock sam.sherl...@gmail.com wrote: remove 'inline' = false nothing is returned with that option set (script and css use that option to set to scripts_for_layout) On 17 September 2011 00:46, Santiago Basulto santiago.basu...@gmail.comwrote: ,'inline' = false -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Pagination Problem
If this is a simple pagination problem then I am confused what it has to do with the JsHelper? As the error is from a helper is has to be realted to something in your view/layout (unless your calling views in your controller). Have you checked the error stack to see what line in your code is creating the error? HTH, Paul @phpMagpie On Sep 16, 6:44 pm, Caio Landau c...@iai.art.br wrote: I'm trying to do simple pagination with cake and getting the following error: Warning (4096): Object of class JsHelper could not be converted to string [CORE/cake/libs/view/helpers/html.php, line 444] Here is my code: //controllers/orders_controller.php class OrdersController extends AppController { var $components = array(Security); var $helpers = array(Html, Form, Session, Number, Paginator); var $uses = array('Product', 'Order'); var $paginate = array('limit' = 10,'order' = array('Order.date' = 'asc'),'recursive' = 2); function view($id = null) { if ($id == NULL) { $this-set(orders, $this-paginate(Order)); $this-set(js, array(jquery-1.6.2.min, viewOrders)); //Set a JS variable to be put on the head } else { $orders[0] = $this-Order-getOrder($id); $this-set(orders, $orders); } } } The only place I'm calling the paginate function is here in the controller. Not calling anything (yet) on the view/model. If I comment the $this-set(orders, $this-paginate(Order)); line the error stops. Any idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: General question
Hi, great links, thanks! Well, in my case, I have to work with an exiting project which gets relaunched and gets done in cakephp - but keeps the old database, as the data for the websites gets uploaded my a desktop real estate software. So in this case I am not able to make any changes on the database. And this means, I need a own solution. So therefore I would need to learn, how to use helpers which can access a database table. Can you help me with this? Thanks! On 16 Sep., 18:49, Teddy Zeenny teddyzee...@gmail.com wrote: You can check out the cakephp i18n. Check out both these links maybe they can help you.http://book.cakephp.org/view/1228/Internationalization-Localizationhttp://book.cakephp.org/view/1328/Translate On Fri, Sep 16, 2011 at 7:20 PM, heohni heidi.anselstet...@consultingteam.de wrote: Thanks Ryan :-) Another question. All translations are coming from the database. I thought i would need a helper function, but I don't think it makes sense to place mysql statements in a helper? Should I create a own model/controller for the translations? With a controller function called getTranslation($id) and return the word string. But how do I call this controller function from the helper file? Thanks in advance!! On 16 Sep., 15:40, Ryan Schmidt google-2...@ryandesign.com wrote: On Sep 16, 2011, at 04:32, heohni wrote: I have a section in my web project where I have to load from the database the possible languages and their infos like flag image name, ID, shortcut, etc. Languages do not have flags. http://www.cs.tut.fi/~jkorpela/flags.html -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: JSON output from search results
Steve Don't worry I am a self-taught PHP hack and learned the hard way, but I must admit you're adventurous for tackling a RESTful app whilst at the bottom of your PHP and CakePHP learning curve. When it comes to passing variables/arrays from the controller to your view you can name them whatever you want, there are no conventions at that point as long as you use the same array name in your view as you set in the controller. If you're saying your controller action is stopping at function search() { if(empty($this-data)) { $this-render(); Then you're not passing your search term from a field with a name of data[Partner][q]. Cake will only place form data in the $this-data array if you post fields with a name format of data[ModelName] [field_name]; You can see if your search term is elsewhere in the request params by using echo debug($this-params); Past this point your code does the following: $partners=$this-Partner-find('all', array('conditions' = $conditions)); // sets a $partners array in the controller $this-set('partners', $this-paginate()); // sets a paginated $partners array in the view $this-set('partners', $partners); // overwrites the view's paginated $partners array with the array you set in the controller previously So with this code you should have a $partners array in the view containing the results of: $this-Partner-find('all', array('conditions' = $conditions)); What do you get if you echo debug($partners); in the view? HTH, Paul. @phpMagpie On Sep 16, 7:12 pm, steveo stevefis...@gmail.com wrote: Paul, Adding some more information - I just found the first part of the problem from the stack trace. When I invoke the /partners/search.json URL, the search() function is not getting any data, so it just runs to the first part of the IF statement and performs $this-render(); (which is why I get the undefined variable: partner (or partners)!! So, I guess my question now is how to get the search result data to output in JSON!!?? function search() { if(empty($this-data)) { $this-render(); } else { $search_term=$this-data['Partner']['q']; $conditions = array(partner_name LIKE = % {$search_term}%); $partners=$this-Partner-find('all', array('conditions' = $conditions)); //var_dump($partners); $this-Partner-recursive = -1; $this-set('partners', $this-paginate()); $this-set('partners', $partners); //$this-render(index); } } On Sep 16, 1:48 pm, steveo stevefis...@gmail.com wrote: Paul, First off, I'm *very* new to CakePHP and not much of a PHP programmer (more of a hack than anything!). I'm still grasping the whole MVC architecture paradigm, so the plural/singular thing is still settling in. Basically, I created a CRUD interface from the CakePHP console to a MySQL database, which worked perfectly! I then tried implementing the CakeDC search plugin, but was completely frustrated with it and could never get it to function (real-life examples are hard to find on it and the blog example just didn't have enough detail for customizing for my application). Anyhow, the main part of the app consists of a partners controller -http://mydomain.com/partners-which basically lists all partners in a paginated view (there are about 3000 partners). I wanted a search interface because paging through 3000 records to find the one you want to edit would just not be possible. I implemented the search, as described earlier in this thread, and it has worked fine (although probably not implemented completely cleanly). I wanted to just have the search post back to itself, which I couldn't figure out, so I created a search template which is pretty much a copy of the partners template. So,http://mydomain.com/partnerslistspartners fine. Performing a search posts tohttp://mydomain.com/partners/searchandshows an appropriate search result. All good. I need to implement ReST now and have some endpoints which return JSON (or XML) formatted results. Continuing on... http://mydomain.com/partners.json(and/partners.xml) both output expected results (although it is quite meaningless since it is just the first 10 records). My index.ctp for the JSON output has just one line of code: ?php echo json_encode($partners); ? (notice the plural, which works). My dilemma now is the search output: http://mydomain.com/search.jsongivesthe error Undefined variable: partners (/views\/partners\/json\/search.ctp). The line of code in this template is: ?php echo json_encode($partners); ? (which works just fine for /partners.json). If I change it to ?php echo json_encode($partner); ? (singular) is get the same error message, just Undefined variable: partner (now singular). So as you can see regardless of singular/plural in the search JSON
Re: sub query and union all function in cakephp
Duplicate thread: http://groups.google.com/group/cake-php/t/dbfef4ec4a77729 On Sep 16, 12:03 pm, Sivaramakrishnan S siva...@nasoindia.com wrote: hi, can we do subquery and union all functions of mysql in cakephp? i need to query that in my sample app, so any one help me, Thanks in advance Shiva -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
ajax observeField()
Hi guys, i have a problem using this ajax function, i'm new on cakephp and don't know if i'm making a mistake. I hace a observeFiel in my view as follows: ?php echo $this-Form-create('ArchivosSistema', array('action' = 'add1'));? fieldset legend?php __('Agregar un archivo al sistema'); ?/legend pPor favor llene los siguientes campos: br /Datos para crear archivo:/p ?php echo $this-Form-input('proveedore_id'); echo $this-Form-input('nombre_archivo'); echo $this-Form-input('token_separador'); echo $this-Form-input('Tabla_Correspondiente', array('options' = $campos, 'empty'='--Seleccionar--')); ? ?php echo $ajax-observeField( 'ArchivosSistemaTokenSeparador', array('url' = array( 'action' = 'myfunction' ), 'frequency' = 0.1,)); /fieldset ?php echo $this-Form-end(__('Aceptar', true));? and in my controller i have 'myFunction' just doing an echo as follows: class ArchivosSistemasController extends AppController { var $name = 'ArchivosSistemas'; var $helpers = array('Html','Ajax','Javascript'); var $components = array( 'RequestHandler' ); all other functions goes here. function myfunction(){ echo Llama la funcion; } } but it does anything when i change the value to the field token_separador, can anyone help -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Media plugin and user plugin
I didn't change register action at all. I just added the Media behaviors to user model $actsAs. Its working perfectly in other controllers. Anyway I found a solution: I needed the media plugin in order to upload the user profile image. I removed the 'Media.Coupler' from the user model $actsAs and add this code at user controller upload_image action: public function upload_image() { $this-User-Behaviors-attach('Media.Coupler'); ... ... $this-User-Behaviors-detach('Media.Coupler'); $this-redirect($this-referer()); } But it means that I can't add image_file field to registration form. After the user registered and verified his account he should enter his profile page and add an image. I should try using the media plugin on a clean solution to decide where is the problem On Fri, Sep 16, 2011 at 12:34 PM, WebbedIT p...@webbedit.co.uk wrote: More information required ... - have you echoed $this-data on submit to see what data there is - how are you calling save in the controller? - have you looked at the sql dump to see what Cake is trying? HTH, Paul @phpMagpie On Sep 15, 11:11 am, ZAky procsh...@gmail.com wrote: adding media plugin, 'Media.Coupler', behavior to users plugin model prevent creating new user. I want to save the profile image path in users table. Any suggestions? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: hi guys
See this http://planetcakephp.org/aggregator/items/2102-cakephp-ajax-country-region-select-box-combo-box On Fri, Sep 16, 2011 at 11:41 PM, aortizhi aorti...@gmail.com wrote: I have this problem, i create a form that will display select field here's my code: ?php echo $this-Form-input('proveedore_id'); echo $this-Form-input('nombre_archivo'); echo $this-Form-input('token_separador'); echo $this-Form-input('Tabla Correspondiente', array('options' = $campos,'id'='choose', 'onChange'='prueba()')); ? ?php But i would like to know from my controller when an option is selected to make query to my database, can someone help me? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Login to a CakePHP application from another site doesn't work
Try to change the security level, I think cakephp block acess from other domains, depending the level of security. 2011/9/16 WebbedIT p...@webbedit.co.uk There is a reason they are slightly more involved and in your eyes excessive, because they ensure a level of security! You should never accept POST data which did not originate from a form on your site (and never accept data that is not POSTed) unless that sites has been previously authenticated and has some sort of key/token in place (i.e. as part of an API/RESTful app). HTH, Paul @phpMagpie On Sep 15, 8:33 am, byqsri marco.rizze...@gmail.com wrote: For the thing that I must do I think that is excessive use OAuth or OpenID. Do a simple autologin with javascript I think that is the better solution. Do CakePHP forbid to do a login from a page that isn't the loginAction of Auth component ? On 15 Set, 08:04, Zaky Katalan-Ezra procsh...@gmail.com wrote: Use oauth http://oauth.net/, openid http://openid.net/ ... On Wed, Sep 14, 2011 at 7:56 PM, byqsri marco.rizze...@gmail.com wrote: Hi I have my web application in CakePHP . All works fine. Now I would do an autologin in my web application from another site . To do this I have done a identical login form in my site and with javascrpt I post it to my web application. But it doesn't work . With this method I can't login to my web application . I always redirect tio login page. I have verify that the session is lost between the login and the redirect to initial page of my web application. Can someone help me about this? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. 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 -- Regards, Zaky Katalan-Ezra QA Administratorwww.IGeneriX.com Sites.IGeneriX.com 054-7762312 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
cakephp screws up all other php work
system is MBP/OSX/MAMP all latest updates a customer wanted me to look at a CakePHP product he was evaluating. Once I installed CakePHP in the root of localhost, all I get for any other production in php on localhost is internal 500 errors. I can fix this by removing cake and mamp restarting and reinstalling mamp, but there has to be a way to coexist that I am just not getting. While I have your attention, I'm also getting a CakePHP error that I don't know how to fix Missing Controller Error: CoopController could not be found. Error: Create the class CoopController below in file: app/Controller/ CoopController.php ?php class CoopController extends AppController { } ? This file does not exist in the code at all. What am I missing? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: cakephp screws up all other php work
CakePHP did not screw it up, check for the .htaccess file you probably left behind when you deleted to code. The error message tells you exactly what you need to do and gives you the basic code you need to copy and paste it into the file that you are being told to create. -- Larry E. Masters On Sat, Sep 17, 2011 at 11:38 AM, rhkennerly rhkenne...@gmail.com wrote: system is MBP/OSX/MAMP all latest updates a customer wanted me to look at a CakePHP product he was evaluating. Once I installed CakePHP in the root of localhost, all I get for any other production in php on localhost is internal 500 errors. I can fix this by removing cake and mamp restarting and reinstalling mamp, but there has to be a way to coexist that I am just not getting. While I have your attention, I'm also getting a CakePHP error that I don't know how to fix Missing Controller Error: CoopController could not be found. Error: Create the class CoopController below in file: app/Controller/ CoopController.php ?php class CoopController extends AppController { } ? This file does not exist in the code at all. What am I missing? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Sessions Best Practice Question
I am trying to determine the best way to grab out the signed in user_id for adding items to another belongsto table. Is it ok to use the session data for this? I could easily use this as a hidden field in the form data. $session-read('Auth.User.id') ? But, does this belong in a controller? What is the best and most secure way to do this? I have a Users table with id, name and password I have a Authors table with id, user_id, address, city, state, zip Users won't be able to access each others account data. So after baking the app I would remove the User.name dropdown. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Editing data
Thanks ecsyle. its work!! On Sat, Sep 17, 2011 at 4:37 AM, ecsyle ecs...@gmail.com wrote: You need the id of A in your data set: echo $this-Form-input('A.id'); On Sep 16, 10:48 am, Mohd Hasnol hasnolm...@gmail.com wrote: Hi, If i use saveAll, it will add another A data. What happen? Thanks. On Thu, Sep 15, 2011 at 4:54 PM, WebbedIT p...@webbedit.co.uk wrote: As #2will advised, your problem is: $this-B-save($this-data) Should be: $this-B-saveAll($this-data) http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-ha. .. HTH, Paul @phpMagpie On Sep 15, 2:59 am, Mohd Hasnol hasnolm...@gmail.com wrote: edit.ctp ?php echo $this-Form-create('B', array('action'='edit'));? ?php echo $this-Form-input('A.first_name'); echo $this-Form-input('A.last_name'); echo $this-Form-input('A.contact_no'); echo $this-Form-input('A.email'); echo $this-Form-input('B.username'); echo $this-Form-input('B.password');? ?php echo $this-Form-end('Submit');? inside B controller function edit($id = NULL) { $this-B-id = $id; if (empty($this-data)){ $this-data = $this-B-read(); } else { if ($this-B-save($this-data)) { $this-Session-setFlash('Data updated'); } } } On Thu, Sep 15, 2011 at 5:05 AM, #2Will willjbar...@gmail.com wrote: Are you doing a saveAll rather than save in your controller? On Sep 14, 7:27 pm, Mohd Hasnol hasnolm...@gmail.com wrote: inside edit.ctp ?php echo $this-Form-create('Useradmin', array('action'='edit'));? ?php echo $this-Form-input('A.first_name'); echo $this-Form-input('A.last_name'); echo $this-Form-input('A.contact_no'); echo $this-Form-input('A.email'); echo $this-Form-input('B.username'); echo $this-Form-input('B.password');? i only can edit username and password. Thanks. On Wed, Sep 14, 2011 at 9:50 AM, euromark dereurom...@googlemail.com wrote: a less abstract code example would help you code post your real code. maybe this way we can figure out whats wrong with your code. On 14 Sep., 05:35, nOLL hasnolm...@gmail.com wrote: Hi, I have a form that use 2 models(A,B). For create and view function it was run perfectly, but there is a problem when editing the form. I use B controller for all the function(CRUD) and i only can edit the B table attributes but for A attributes the data remain the same. I follow thishttp:// book.cakephp.org/view/1650/hasMany-through-The-Join-Model for the form. Whats the problem actually? Thanks, nOLL -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to