Re: display last 5 inserted image
Hi, I need to create the multitab tab using css in cakephp, How to create that in cakephp 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
Re: Haml and sass in CakePHP
CakePHP isn't modeled after Ruby (Or Ruby on Rails). It is simply a PHP framework that follows the MVC architecture, and Ruby on Rails is a Ruby framework that also follows the MVC architecture. That is pretty much their only simularity. Perhaps you could be better helped if you actually added what warnings and notices you get. People can't guess them out of the blue. Also, remember that quite a bit has changed in CakePHP 2.0, so unless that plugin has been specifically modified for CakePHP 2.0, you are going to need to follow the migration guide to change it to work with 2.0. On Sep 16, 3:56 am, Chris Cinelli chris.cine...@formativelearning.com wrote: I forgot to mention that I tried to follow the instruction here :https://github.com/goncaloesteves/phamlp/blob/master/Cake/Installatio... And I even substitute var $view = 'Haml'; = var $viewClass = 'Haml'; But cake give warning and notice later. On Thu, Sep 15, 2011 at 6:28 PM, Chris Cinelli chris.cine...@formativelearning.com wrote: I think almost everybody familiar with Ruby knows: http://haml-lang.com/ and http://sass-lang.com/ Since CakePHP is modeled after Ruby and in the spirit of having to write less code with more syntactic juice it would be great to have them in cake. Fortunately someone already though to that. So here is this great piece of code that has CakePHP extension: https://github.com/goncaloesteves/phamlp But following the instruction in the Cake folder does not make it work in Cake 2.0. Someone know how to solve the problem? On a side node, I think that it would be great to add it to Cake as a default plugin. Ruby 3.1 added sass with compass ( http://compass-style.org/) as default. Best, Chris -- 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: filtering model result bases on user rights
Can you give us an overview of how you have declared the relationships of those 4 tables? I.e. r u using HABTM or hasMany - belongsTo? On Sep 16, 4:28 am, Zaky Katalan-Ezra procsh...@gmail.com wrote: For the list result you join docs and docs token and check that the user tokens are IN the join result. To prevent url changes I suggest 1. use uuid as document id. 2. Create a function in the database that take user_id and doc_id and return true/false Call this function in documents/view or edit. On Thu, Sep 15, 2011 at 5:59 PM, Timmay tim.smi...@gmail.com wrote: the example I gave is a simplified version of the real situation. The real situation is that a user has two sets of tokens (lets say A and B). These properties are stored in another table, named user_tokens. A document also has two sets of tokens (lets also call them A and B). These properties are stored in a table 'document_tokens'. A user is allowed to see the document if: the user and the document have at least one token in set A in common and the user and the document have at least one token in set B in common. On Sep 15, 10:42 am, Zaky Katalan-Ezra procsh...@gmail.com wrote: How do you save the permissions in the database? On Thu, Sep 15, 2011 at 10:53 AM, Timmay tim.smi...@gmail.com wrote: Hi all, I'm working on a multi user website with a collection of documents. Every user is only allowed to see a subset of the documents. I want the Documents model to only return the documents that a user is allowed to see. If a users requests one particular document, and he doesn't have rights to see the document (e.g. he modified the url), I want the model to return nothing. Is there an easy way to achieve 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 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 -- 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
Re: CakeFest 2011
Octavian, I spoke with Larry the other day. He has something like 44 videos to transcode, edit and upload. It is going to take a while, but it will be done. On Sep 15, 10:47 pm, Octavian octaviansus...@gmail.com wrote: Any news? Are you still planning to put vids on Cake TV? Thanks On 8 sep, 04:55, Brett Wilton bdwil...@gmail.com wrote: Brilliant, look forward to watching a few. On 7/09/2011, at 11:56 PM, Larry E. Masters wrote: I will be compressing and uploading the recordings now that I am back in the states. -- Larry E. Masters -- 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: Very strange behaviour of CAKEPHP on login
hi, I added [newly added book] tab for my app, still i need to display one more tab below this tab, that tab name is [Most popular book].i used the same css for this tab also, but it's not working for me.it's tab is overlap to the previous one, any one can help me to fix this 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
tab display in layout in problem
hi, I added [newly added book] tab for my app, still i need to display one more tab below this tab, that tab name is [Most popular book].i used the same css for this tab also, but it's not working for me.it's tab is overlap to the previous one, any one can help me to fix this 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
Re: Manual entry for habtm linking table.
If using Cakes HABTM automagic the table should be named classes_teachers and have the following fields id (primary_key, auto_inc) class_id teacher_id After that it's a case of INSERT INTO classes_teachers (class_id, teacher_id) SELECT class_id, teacher_id FROM import_table HTH, Paul @phpMagpie On Sep 15, 9:24 pm, porangi.chris porangi.ch...@gmail.com wrote: hi, First time user of cake with CI background, I have two tables teachers and classes that share a many to many relationship e.g. Teacher-Classes. I'm having to import the data from CSV files that have been exported from another system that we have limited access to. I've got the classes working - I can scan through the file and add the class if it doesn't already exist but I need to add the links between class and teacher. I have an associative array with the two ids (tclass_id and teacher_id) ready but what query call would I make to insert this as a row in the teacher_class table? Thanks in advance for any help. Chris -- 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: Haml and sass in CakePHP
I think Sass won't be a problem as you could set it to compile to webroot/css/ On 16 Sep., 08:59, Walther waltherl...@gmail.com wrote: CakePHP isn't modeled after Ruby (Or Ruby on Rails). It is simply a PHP framework that follows the MVC architecture, and Ruby on Rails is a Ruby framework that also follows the MVC architecture. That is pretty much their only simularity. Perhaps you could be better helped if you actually added what warnings and notices you get. People can't guess them out of the blue. Also, remember that quite a bit has changed in CakePHP 2.0, so unless that plugin has been specifically modified for CakePHP 2.0, you are going to need to follow the migration guide to change it to work with 2.0. On Sep 16, 3:56 am, Chris Cinelli chris.cine...@formativelearning.com wrote: I forgot to mention that I tried to follow the instruction here :https://github.com/goncaloesteves/phamlp/blob/master/Cake/Installatio... And I even substitute var $view = 'Haml'; = var $viewClass = 'Haml'; But cake give warning and notice later. On Thu, Sep 15, 2011 at 6:28 PM, Chris Cinelli chris.cine...@formativelearning.com wrote: I think almost everybody familiar with Ruby knows: http://haml-lang.com/ and http://sass-lang.com/ Since CakePHP is modeled after Ruby and in the spirit of having to write less code with more syntactic juice it would be great to have them in cake. Fortunately someone already though to that. So here is this great piece of code that has CakePHP extension: https://github.com/goncaloesteves/phamlp But following the instruction in the Cake folder does not make it work in Cake 2.0. Someone know how to solve the problem? On a side node, I think that it would be great to add it to Cake as a default plugin. Ruby 3.1 added sass with compass ( http://compass-style.org/) as default. Best, Chris -- 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
requestAction and named parameters size (in Cake 1.3)
Hello, I have a simple doubt. I know that parameters passed on the url have length limitations (because the browser or server limitations, usually for security purposes)... but: there are limitations to parameters size when we are using the requestAction method? Thanks in advance! :) -- - Per la llibertat del coneixement - - Per la llibertat de la ment... - -- 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: Making a Complex search
I've solved it making two searches :p , I think there is no way to make complex nested SELECT queries in Cake (and direct SQL is not much better, it's possible, but it's too tricky, ugly and slow). 2011/9/13 WebbedIT p...@webbedit.co.uk Show us what you have tried so far ... it will be easier to make sense of your SQL or Cake conditions -- - Per la llibertat del coneixement - - Per la llibertat de la ment... - -- 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: Very strange behaviour of CAKEPHP on login
On Sep 16, 9:03 am, Sivaramakrishnan S siva...@nasoindia.com wrote: hi, I added [newly added book] tab for my app, still i need to display one more tab below this tab, that tab name is [Most popular book].i used the same css for this tab also, but it's not working for me.it's tab is overlap to the previous one, any one can help me to fix this Thanks in advance, Shiva @Shiva: How is this linked to the OP? If you have a new question ask it in a new thread otherwise it gets very confusing. @byqsri: Debug is always your friend. echo debug($this-data); will show you if the password is hashed, but Teddy is right that you're not passing $this-data to the login command. By turning your debug setting to 2 and echoing your $sql_dump you could have seen something was wrong with the sql call to try and authenticate the user. If you were logging in as normal rather than creating a strange action to do it on your behalf you would have had a form where you were echoing the Auth error and it would have informed you there was no username or password. I reccomend you also install the excellent DebugKit plugin as it beings the SQL, Request, Session and other useful data into one handy neat panel so you can debug such issues yourself. HTH, Paul @phpMagpie -- 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
Take JSON out of the equation and simply check to see if the model- find() call is returning anything echo debug($this-paginate()); Although from your post above it seems the problem is that you passing partners (plural) to the view and echoing partner (singlular) in the view. Why are you linking what happens with index and view to what happens in search? They should all be different actions with different views? HTH, Paul @phpMagpie P.S. I can highly reccomend CakeDC's search plugin On Sep 15, 2:51 pm, steveo stevefis...@gmail.com wrote: Hey folks! I'm fairly new to CakePHP, but so far I love it! I had some troubles getting a search interface to work against my database, but after googling around I was finally able to put the pieces together and get it to work. I am not in the process of enabling REST interfaces and outputting in JSON/XML. I have everything working just fine in my index and view templates (where I can just add .json or .xml to the end of the URL and get the correct output. However, I am not able to get JSON/XML output from a search! It looks like my array is empty and I'm not sure how to pass the data over. I have the following code in my main controller: 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); } } Like I said, it works perfectly fine for the index and view, but not for search. Instead, I get the following error: Undefined variable: partner [APP/views/layouts/json/default.ctp, line 1]null Now, the tricky part. The json/default.ctp works for index and view, so if I change the variable to partners, it will no longer work for index and view (in addition, changing to partners will not work for the json/xml output either). Since I am seeing null in the error message, I'm assuming that the partners variable is not getting passed to the search (or default) template. Anyone think they can help me? Thanks!!! -- 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: Very strange behaviour of CAKEPHP on login
It's also a CSS problem, not a Cake problem! Jeremy Burns Class Outfit http://www.classoutfit.com On 16 Sep 2011, at 10:13, WebbedIT wrote: On Sep 16, 9:03 am, Sivaramakrishnan S siva...@nasoindia.com wrote: hi, I added [newly added book] tab for my app, still i need to display one more tab below this tab, that tab name is [Most popular book].i used the same css for this tab also, but it's not working for me.it's tab is overlap to the previous one, any one can help me to fix this Thanks in advance, Shiva @Shiva: How is this linked to the OP? If you have a new question ask it in a new thread otherwise it gets very confusing. @byqsri: Debug is always your friend. echo debug($this-data); will show you if the password is hashed, but Teddy is right that you're not passing $this-data to the login command. By turning your debug setting to 2 and echoing your $sql_dump you could have seen something was wrong with the sql call to try and authenticate the user. If you were logging in as normal rather than creating a strange action to do it on your behalf you would have had a form where you were echoing the Auth error and it would have informed you there was no username or password. I reccomend you also install the excellent DebugKit plugin as it beings the SQL, Request, Session and other useful data into one handy neat panel so you can debug such issues yourself. HTH, Paul @phpMagpie -- 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: display last 5 inserted image
@Zaky It's not a good idea to change the images size in the html. Change the image to the desired size when uploading. Media plugin can assist you with this issue. I used to subscribe to the 'crop/resize before adding into the database/uploading' principle but then I often fell foul of the client changing what size they wanted their images to be shown at. How do you then go back through all uploaded images and change them? I am now using the excellent SLIR2.0 http://code.google.com/p/smart-lencioni-image-resizer/ With this handy little script I upload the image once at full size and within my img tag src I can pass in what dimensions and crop options I want to apply. The image returned is cached so when next requested it does not use unneccessary resources. BRILLIANT! HTH, Paul @phpMagpie -- 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: display last 5 inserted image
@Shiva: You really need to start helping us to help you, your two line posts give us no information on what you have tried already and until you start showing that you're at least trying to solve these problems yourself a lot of people will read your posts and never reply. HTH, Paul @phpMagpie On Sep 16, 7:25 am, Sivaramakrishnan S siva...@nasoindia.com wrote: Hi, I need to create the multitab tab using css in cakephp, How to create that in cakephp 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
General question
Hi, 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. Within my templates I have in the default.ctp this area: div id=flags ?php echo $html-link($html-image('en.png', array('class' = 'map_icon')), array('controller' = 'lng/eng'), array('title' = 'English', 'escape' = false));? ... ... ... /div This way I have it hard coded, but as said I want to have it dynamically. I wonder how I can do this? Do I have to use elements for this? Where do I have to place all my database queries? In which controller? Within the pages_controller? And how to get the database results into the element template? Please help me out, I am kind of lost right now... Thanks! -- 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
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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media plugin transferTo
You can maybe do it manualy : don't use Media.Transfer But i don't know if you can use Media transfert methods in your controller after saving the post. something like that : function add() { $this-Post-create(); if ($this-Post-save($this-data)) { […] $dirname = 'files/'.$this-Session-read('Auth.User.id').'/'.$this- Post-id; $this-Post-saveField('dirname', $dirname); // transfert } else { // Error } } The simplest would be to let Media plugin transfert in Media folder, the path would be store in DB with dirname and basename. On 14 sep, 12:43, Zaky Katalan-Ezra procsh...@gmail.com wrote: Thank you Media plugin some how bind to the save function. So How do I tell the media plugin not to run after save and run only when I have the post_id? On Wed, Sep 14, 2011 at 11:47 AM, BenJsno bench...@yahoo.fr wrote: You have to save your post before upload the file. in your Post_controller : function add() { [...] if (!empty($this-data)) { $this-Post-create(); if ($this-Post-save($this-data)) { [...] $new_id = $this-Post-id // you can maybe put this data temporarily in the session $this-Session-write('Post.last_id', $this-Post-id); } else { [...] } } [...] } Hope this helps you On 13 sep, 13:24, ZAky procsh...@gmail.com wrote: I save my posts files under /files/[user_id]/[post_id]/[image]. This mean I need to know the just seved post id in Post-transfer_to. How do I achieve that? Thank you -- 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 -- 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
Re: Login to a CakePHP application from another site doesn't work
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
Re: General question
1. *Create controller and model:* The controller and model to use depend on the table the languages are stored in. For example if the languages are in a table called languages, then create a model named Language and a controller named LanguagesController. 2. *Create an action that returns the list of languages * In LanguagesController, create an action called getLanguages for example. Basically what it does is query the languages table ( $results=$this-Language-find('all'); ) and then it returns the result ( return $results; ) 3.*Create an element (for example call it language_list.ctp)* First retrieve the information using requestAction (for example: $languages=$this-requestAction('languages/getLanguages') ) Then create the html needed for the languages (for example: foreach($languages as $language){ //html here } 4.*Call the element from the default.ctp layout* * *echo $this-element('language_list'); Now usually I wouldn't use requestAction as it would hit my performance, but since the list of languages is part of the layout, I think it would be the safest way to go. In order to fix the performance costs of requestAction, I would recommend the use of caching (especially that these languages will probably not change very often) You can for example cache the element i.e: you can can add a parameter to the element call from default.ctp: echo $this-element('language_list',array('cache'=array('time'='+1 week','key'='languages'))); That is how I would do it. I'm sure there are other (and maybe better) solutions, but this would definitely work. On Fri, Sep 16, 2011 at 12:32 PM, heohni heidi.anselstet...@consultingteam.de wrote: Hi, 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. Within my templates I have in the default.ctp this area: div id=flags ?php echo $html-link($html-image('en.png', array('class' = 'map_icon')), array('controller' = 'lng/eng'), array('title' = 'English', 'escape' = false));? ... ... ... /div This way I have it hard coded, but as said I want to have it dynamically. I wonder how I can do this? Do I have to use elements for this? Where do I have to place all my database queries? In which controller? Within the pages_controller? And how to get the database results into the element template? Please help me out, I am kind of lost right now... Thanks! -- 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: General question
Well, using requestAction is only recommended in combination with caching. So using the cached element with requestAction inside the element is the way to go in my oppinion. The other possibility is loading the Language Model in AppController, setting the languages var in AppController::beforeFilter() and passing the var into the cached element. Kind regards Thomas Am 16.09.2011 11:56, schrieb Teddy Zeenny: 1. *Create controller and model:* The controller and model to use depend on the table the languages are stored in. For example if the languages are in a table called languages, then create a model named Language and a controller named LanguagesController. 2. *Create an action that returns the list of languages * In LanguagesController, create an action called getLanguages for example. Basically what it does is query the languages table ( $results=$this-Language-find('all'); ) and then it returns the result ( return $results; ) 3.*Create an element (for example call it language_list.ctp)* First retrieve the information using requestAction (for example: $languages=$this-requestAction('languages/getLanguages') ) Then create the html needed for the languages (for example: foreach($languages as $language){ //html here } 4.*Call the element from the default.ctp layout* **echo $this-element('language_list'); Now usually I wouldn't use requestAction as it would hit my performance, but since the list of languages is part of the layout, I think it would be the safest way to go. In order to fix the performance costs of requestAction, I would recommend the use of caching (especially that these languages will probably not change very often) You can for example cache the element i.e: you can can add a parameter to the element call from default.ctp: echo $this-element('language_list',array('cache'=array('time'='+1 week','key'='languages'))); That is how I would do it. I'm sure there are other (and maybe better) solutions, but this would definitely work. On Fri, Sep 16, 2011 at 12:32 PM, heohni heidi.anselstet...@consultingteam.de mailto:heidi.anselstet...@consultingteam.de wrote: Hi, 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. Within my templates I have in the default.ctp this area: div id=flags ?php echo $html-link($html-image('en.png', array('class' = 'map_icon')), array('controller' = 'lng/eng'), array('title' = 'English', 'escape' = false));? ... ... ... /div This way I have it hard coded, but as said I want to have it dynamically. I wonder how I can do this? Do I have to use elements for this? Where do I have to place all my database queries? In which controller? Within the pages_controller? And how to get the database results into the element template? Please help me out, I am kind of lost right now... Thanks! -- 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 mailto:cake-php%2bunsubscr...@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 -- 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: display last 5 inserted image
@phpMagpie: i am new to cakephp,so i didn't help u.. sorry for that.. i will try to help u Thanks, 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
Re: General question
OK great! That helps me a lot! First I was surprised as I know that requestAction is kind of bad, but I didn't know about the caching and this brings it into a total different light. I will try this, thanks a lot!! On 16 Sep., 11:56, Teddy Zeenny teddyzee...@gmail.com wrote: 1. *Create controller an! d model:* The controller and model to use depend on the table the languages are stored in. For example if the languages are in a table called languages, then create a model named Language and a controller named LanguagesController. 2. *Create an action that returns the list of languages * In LanguagesController, create an action called getLanguages for example. Basically what it does is query the languages table ( $results=$this-Language-find('all'); ) and then it returns the result ( return $results; ) 3.*Create an element (for example call it language_list.ctp)* First retrieve the information using requestAction (for example: $languages=$this-requestAction('languages/getLanguages') ) Then create the html needed for the languages (for example: foreach($languages as $language){ //html here } 4.*Call the element from the default.ctp layout* * *echo $this-element('language_list'); Now usually I wouldn't use requestAction as it would hit my performance, but since the list of languages is part of the layout, I think it would be the safest way to go. In order to fix the performance costs of requestAction, I would recommend the use of caching (especially that these languages will probably not change very often) You can for example cache the element i.e: you can can add a parameter to the element call from default.ctp: echo $this-element('language_list',array('cache'=array('time'='+1 week','key'='languages'))); That is how I would do it. I'm sure there are other (and maybe better) solutions, but this would definitely work. On Fri, Sep 16, 2011 at 12:32 PM, heohni heidi.anselstet...@consultingteam.de wrote: Hi, 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. Within my templates I have in the default.ctp this area: div id=flags ?php echo $html-link($html-image('en.png', array('class' = 'map_icon')), array('controller' = 'lng/eng'), array('title' = 'English', 'escape' = false));? ... ... ... /div This way I have it hard coded, but as said I want to have it dynamically. I wonder how I can do this? Do I have to use elements for this? Where do I have to place all my database queries? In which controller? Within the pages_controller? And how to get the database results into the element template? Please help me out, I am kind of lost right now... Thanks! -- 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
sub query and union all function in cakephp
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
subquery and unionall
hi, Anyone knows a good way to make UNION query in CakePHP? I would like to avoid using $this-query();. for this code = Select distinct bm.id,name, add From table1 bm, (Select id bid, count(id) cnt from table2 where status = 'N' group by id union all Select id bid, count(id) cnt from table3 where status = 'N' group by id order by cnt limit 10) ab Where id = bm.id -- 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
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 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: Se Ya Cake..bake a dick cake frosting on your face...............
Pat-a-cake, pat-a-cake, baker's man ... On 9/16/11, Dr. Tarique Sani tariques...@gmail.com wrote: FWIW http://www.google.com/trends?q=cakephp%2C+ruby+on+rails%2C+zend+framework%2C+symfonyctab=0geo=alldate=allsort=2 All trends regarding any framework ultimately merge into more or less the same thing IOW - lets move on Tarique On Thu, Sep 15, 2011 at 7:56 PM, Janos Csikos ja...@csikos.co.uk wrote: Hi Guys, I'm Cake fan since 2006 and excited about the coming 2.0, but I have to say this CLASSIC trolling means something. I mean thats true there is no CakePHP jobs posted. That's true there is not the latest cake sites are listed in the just baked box on cakephp.org. And also true the drupal (and ror, zend, ) much more popular than cake: http://www.google.com/trends?q=cakephp%2C+django%2C+ruby+on+rails%2C+zend+frameworkctab=0geo=alldate=allsort=0 -- = PHP for E-Biz: http://sanisoft.com = -- 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: Se Ya Cake..bake a dick cake frosting on your face...............
*FACTS: In oDesk there is 3500 PHP jobs and a 1000 of them is in joomla/drupal. There is also 88 zend projects 1 symphony and 63 Cakephp. So what you can learn from this? *From the above we learn that there are over 2,000 open jobs where they can use the CakePHP framework :) Many employers are looking for a PHP developer for their projects, but they do not care whether you use a framework or CMS... so no worries -- 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
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 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: Haml and Sass in CakePHP
Maybe modeled after may be a little too strong but this is what the book.cakephp.org said CakePHP is a free open-source rapid development framework for PHP. Its a structure of libraries, classes and run-time infrastructure for programmers creating web applications originally inspired by the Ruby on Rails framework There are a few links that says that same: http://stackoverflow.com/questions/493950/how-different-is-cakephp-from-ruby-on-rails (this has some harsh judgement toward CAhePHP though). http://stackoverflow.com/questions/493950/how-different-is-cakephp-from-ruby-on-rails http://blog.endpoint.com/2010/11/ruby-on-rails-cakephp-syntax-comparison.html(more objective comparison). Plus if you search for ruby in cakephp.org, you can find 1700 pages: http://www.google.com/search?q=site%3Acakephp.comie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a#sclient=psy-abhl=enclient=firefox-ahs=Fiwrls=org.mozilla:en-US%3Aofficialsource=hpq=site:cakephp.org+rubypbx=1oq=site:cakephp.org+rubyaq=faqi=aql=gs_sm=egs_upl=95311l96119l3l99330l5l3l0l0l0l2l777l1970l5-2.1l3l0bav=on.2,or.r_gc.r_pw.fp=23ce9c3efefc512cbiw=1200bih=784 I do not have to state again that HAML can speed up HTML programming minimizing the code to be written and SASS make CSS less painful to develop and maintain adding syntactical juice that make it more object oriented. --- Anyway, going back to the problem before using var $viewClass = 'Haml'; I got a missed view (I have a view called myotheraction.haml. After I received these messages: *Warning* (2): Missing argument 2 for HamlView::_render(), called in /Users/chris/workspace/FL_NT-RC1/_product/lib/Cake/View/View.php on line 364 and defined [*APP/View/haml.php*, line *257*] *Notice* (8): Use of undefined constant VIEWS - assumed 'VIEWS' [*APP/View/haml.php*, line *281*] *Warning* (2): file_put_contents(/Users/chris/workspace/FL_NT-RC1/_product/app/View/Test/otheraction.ctp) [function.file-put-contents http://php.net/function.file-put-contents]: failed to open stream: Permission denied [*APP/View/haml.php*, line *262*] *Notice* (8): Undefined variable: ___dataForView [*APP/View/haml.php*, line *265*] *Warning* (2): Missing argument 2 for HamlView::_render(), called in /Users/chris/workspace/FL_NT-RC1/_product/lib/Cake/View/View.php on line 413 and defined [*APP/View/haml.php*, line *257*] *Notice* (8): Undefined variable: ___dataForView [*APP/View/haml.php*, line *268*] Yes, The view.php in Cake 1.3 is pretty different than View.php in Cake 2.0. Anybody can point out how it can be fixed? Best, Chris On Sep 16, 2011 12:32 AM, Chris ch.ti...@googlemail.com wrote: I think Sass won't be a problem as you could set it to compile to webroot/css/ On 16 Sep., 08:59, Walther waltherl...@gmail.com wrote: CakePHP isn't modeled after Ruby (Or Ruby on Rails). It is simply a PHP framework that follows the MVC architecture, and Ruby on Rails is a Ruby framework that also follows the MVC architecture. That is pretty much their only simularity. Perhaps you could be better helped if you actually added what warnings and notices you get. People can't guess them out of the blue. Also, remember that quite a bit has changed in CakePHP 2.0, so unless that plugin has been specifically modified for CakePHP 2.0, you are going to need to follow the migration guide to change it to work with 2.0. On Sep 16, 3:56 am, Chris Cinelli chris.cine...@formativelearning.com wrote: I forgot to mention that I tried to follow the instruction here : https://github.com/goncaloesteves/phamlp/blob/master/Cake/Installatio... And I even substitute var $view = 'Haml'; = var $viewClass = 'Haml'; But cake give warning and notice later. On Thu, Sep 15, 2011 at 6:28 PM, Chris Cinelli chris.cine...@formativelearning.com wrote: I think almost everybody familiar with Ruby knows: http://haml-lang.com/ and http://sass-lang.com/ Since CakePHP is modeled after Ruby and in the spirit of having to write less code with more syntactic juice it would be great to have them in cake. Fortunately someone already though to that. So here is this great piece of code that has CakePHP extension: https://github.com/goncaloesteves/phamlp But following the instruction in the Cake folder does not make it work in Cake 2.0. Someone know how to solve the problem? On a side node, I think that it would be great to add it to Cake as a default plugin. Ruby 3.1 added sass with compass ( http://compass-style.org/) as default. Best, Chris -- 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
Re: General question
You can check out the cakephp i18n. Check out both these links maybe they can help you. http://book.cakephp.org/view/1228/Internationalization-Localization http://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 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: subquery and unionall
You sent me a direct email, but I prefer to offer what support I can in here. Sorry, I can't help with this as I have never used a MySQL Union. I had to search on what a UNION was and cannot come up with a situation where I would need to use it?!? If I had two tables with identical fields I would merge the tables to preserve a normalised database. Paul On Sep 16, 2:17 pm, Sivaramakrishnan S siva...@nasoindia.com wrote: hi, Anyone knows a good way to make UNION query in CakePHP? I would like to avoid using $this-query();. for this code = Select distinct bm.id,name, add From table1 bm, (Select id bid, count(id) cnt from table2 where status = 'N' group by id union all Select id bid, count(id) cnt from table3 where status = 'N' group by id order by cnt limit 10) ab Where id = bm.id -- 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
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-hasMany-belongsTo 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.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 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
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/partners lists partners fine. Performing a search posts to http://mydomain.com/partners/search and shows 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.json gives the 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 output, I still get an error! steve On Sep 16, 5:22 am, WebbedIT p...@webbedit.co.uk wrote: Take JSON out of the equation and simply check to see if the model-find() call is returning anything echo debug($this-paginate()); Although from your post above it seems the problem is that you passing partners (plural) to the view and echoing partner (singlular) in the view. Why are you linking what happens with index and view to what happens in search? They should all be different actions with different views? HTH, Paul @phpMagpie P.S. I can highly reccomend CakeDC's search plugin On Sep 15, 2:51 pm, steveo stevefis...@gmail.com wrote: Hey folks! I'm fairly new to CakePHP, but so far I love it! I had some troubles getting a search interface to work against my database, but after googling around I was finally able to put the pieces together and get it to work. I am not in the process of enabling REST interfaces and outputting in JSON/XML. I have everything working just fine in my index and view templates (where I can just add .json or .xml to the end of the URL and get the correct output. However, I am not able to get JSON/XML output from a search! It looks like my array is empty and I'm not sure how to pass the data over. I have the following code in my main controller: 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); } } Like I said, it works perfectly fine for the index and view, but not for search. Instead, I get the following error: Undefined variable: partner [APP/views/layouts/json/default.ctp, line 1]null Now, the tricky part. The json/default.ctp works for index and view, so if I change the variable to partners, it will no longer work for index and view (in addition, changing to partners will not work for the json/xml output either). Since I am seeing null in the error message, I'm assuming that the partners variable is not getting passed to the search (or default) template. Anyone think they can help me? Thanks!!! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site
Re: JSON output from search results
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/partnerslists partners fine. Performing a search posts tohttp://mydomain.com/partners/searchand shows 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.jsongives the 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 output, I still get an error! steve On Sep 16, 5:22 am, WebbedIT p...@webbedit.co.uk wrote: Take JSON out of the equation and simply check to see if the model-find() call is returning anything echo debug($this-paginate()); Although from your post above it seems the problem is that you passing partners (plural) to the view and echoing partner (singlular) in the view. Why are you linking what happens with index and view to what happens in search? They should all be different actions with different views? HTH, Paul @phpMagpie P.S. I can highly reccomend CakeDC's search plugin On Sep 15, 2:51 pm, steveo stevefis...@gmail.com wrote: Hey folks! I'm fairly new to CakePHP, but so far I love it! I had some troubles getting a search interface to work against my database, but after googling around I was finally able to put the pieces together and get it to work. I am not in the process of enabling REST interfaces and outputting in JSON/XML. I have everything working just fine in my index and view templates (where I can just add .json or .xml to the end of the URL and get the correct output. However, I am not able to get JSON/XML output from a search! It looks like my array is empty and I'm not sure how to pass the data over. I have the following code in my main controller: function search() { if(empty($this-data)) { $this-render(); } else { $search_term=$this-data['Partner']['q']; $conditions = array(partner_name LIKE = % {$search_term}%);
Media Views for streaming mp3 with flash player
I have a page with a audio flash player that streams several mp3 files. This player uses an XML file that has the path of all those files, which are in a audio folder in the webroot directory. What I don't like is that it's pretty easy for a user to get to the XML file (which is also in the webroot directory) and see the paths of the mp3 files, and then download them instead of just using the flash player. I've seen that CakePHP has something called Media Views, where you can set a folder outside the webroot and place your files there, so users can't freely access them. The explanation in Cake's website (http:// book.cakephp.org/view/1094/Media-Views) is focused on files to download, but I would like to know if I can use the Media Views to stream my mp3 files with the audio player without making them downloadable by the users. OR if there's any other alternative without Media Views that would work as well :) Thanks so much in advance! CLARIFICATION This is the code that I'm using that I would like to change: - In my controller: function index() {} - In my view (index.ctp): embed type=application/x-shockwave-flash flashvars=audioUrl=/ audios/01 Track 01.mp3 src=audio-player.swf/embed =How can I change that using Media Views so that my mp3 file is in a folder app/audios instead of app/webroot/audios? THIS IS WHAT I'VE TRIED: - In my controller (streams_controller.php): function index() {} function getFile() { $this-view = 'Media'; $params = array( 'id' = '01 Track 01.mp3', 'name' = '01 Track 01', 'download' = false, 'extension' = 'mp3', 'path' = APP . 'audios' . DS, 'cache' = true ); $this-set($params); } - In my view (index.ctp): embed type=application/x-shockwave-flash flashvars=audioUrl=/ streams/getFile src=audio-player.swf/embed STILL NO LUCK! What am I doing wrong? -- 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
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
hi guys
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
Pagination Problem
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: Haml and sass in CakePHP
For those who are interested: I fixed HAML for cakephp 2.0. Look at: https://github.com/ChrisCinelli/phamlp in the Cake 2.0 folder. scss seems having problems with mixins. Unfortunately I do not think the problem is just Cake 2.0. I am working on a faster assets manager. I will include changes to make sass work there. Best, Chris On Fri, Sep 16, 2011 at 12:32 AM, Chris ch.ti...@googlemail.com wrote: I think Sass won't be a problem as you could set it to compile to webroot/css/ On 16 Sep., 08:59, Walther waltherl...@gmail.com wrote: CakePHP isn't modeled after Ruby (Or Ruby on Rails). It is simply a PHP framework that follows the MVC architecture, and Ruby on Rails is a Ruby framework that also follows the MVC architecture. That is pretty much their only simularity. Perhaps you could be better helped if you actually added what warnings and notices you get. People can't guess them out of the blue. Also, remember that quite a bit has changed in CakePHP 2.0, so unless that plugin has been specifically modified for CakePHP 2.0, you are going to need to follow the migration guide to change it to work with 2.0. On Sep 16, 3:56 am, Chris Cinelli chris.cine...@formativelearning.com wrote: I forgot to mention that I tried to follow the instruction here : https://github.com/goncaloesteves/phamlp/blob/master/Cake/Installatio... And I even substitute var $view = 'Haml'; = var $viewClass = 'Haml'; But cake give warning and notice later. On Thu, Sep 15, 2011 at 6:28 PM, Chris Cinelli chris.cine...@formativelearning.com wrote: I think almost everybody familiar with Ruby knows: http://haml-lang.com/ and http://sass-lang.com/ Since CakePHP is modeled after Ruby and in the spirit of having to write less code with more syntactic juice it would be great to have them in cake. Fortunately someone already though to that. So here is this great piece of code that has CakePHP extension: https://github.com/goncaloesteves/phamlp But following the instruction in the Cake folder does not make it work in Cake 2.0. Someone know how to solve the problem? On a side node, I think that it would be great to add it to Cake as a default plugin. Ruby 3.1 added sass with compass ( http://compass-style.org/) as default. Best, Chris -- 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
Scripts for layout and Html-meta confusion
Hello people, i want to display canonical link attributes for some of my pages. I can do it with: echo $this-Html-meta('canonical', 'http:://example.com', array('rel'='canonical', 'type'=null, 'title'=null,'inline' = false)); I want the link tag to be displayed inside of my head tag. So i set inline to false. The problem is that it's placed where the $scripts_for_layout is echoed. But, i put my $scripts_for_layout at the bottom of the page. How can i echo $this-Html-meta at the top of the page (inside head tag) and have the scripts_for_layout at the bottom? Thank you! -- 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: CakeFest 2011
Look forward to it, he could punch out a couple at a time :-) Also if you email the group when the odd one gets added would be appreciated. On 16/09/2011, at 7:00 PM, Walther wrote: Octavian, I spoke with Larry the other day. He has something like 44 videos to transcode, edit and upload. It is going to take a while, but it will be done. -- 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
Hi aortizhi, I think it's not really something related to CakePHP. You're question is about JavaScript. If I was in your situation, I'd code my `prueba()` function to submit the form using AJAX. :) OJ -- 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