Re: MVC-way to obtain common data formatting
Hmm I see ... well, I think this can only be accomplished with some kind of helper method/class in the view, just like Jon Bennet says. Imho a class like that will get bloated very quickly , because there will be different options to choose from on how to display the data. A small helper for translating model-specific values would be my personal choice. On Wed, Aug 26, 2009 at 3:51 PM, ark0n3nicolabeg...@gmail.com wrote: @ Bert: yes that's the problem, I'm looking for a way to accomplish in an automatic way and not only for boolean fields (which aren't difficult to implement with an ad-hoc behavior) On 26 Ago, 15:46, Bert Van den Brande cyr...@gmail.com wrote: I don't really understand the problem you present. Either you display a model field as a read-only piece of information in the view, and then there is no problem with data being updated. Or you display model data in a form that can be edited, and in case of for example the boolean you provide a dropdown list or use a radio button that displays a readable string to the user but holds the raw data as the value. On Wed, Aug 26, 2009 at 2:46 PM, ark0n3nicolabeg...@gmail.com wrote: Hi Jon thanks for your kind reply but that's just what I'd avoid: I'm trying to accomplish an automatic way to achieve that result, I know it's not right to use a model function and I asked for an MVC and non- validation-breaking way.. On 26 Ago, 11:23, Jon Bennett jmbenn...@gmail.com wrote: Hi Nicola. I'm trying to understand if and in which way could be possible to achieve such a result. Maybe I've explained the wrong way: I need to format some common fields like boolean value and achieve this adding an afterFind(results) callback in the app_model.php. I'd like to know if this is the best way to accomplish this 'cause I noticed that (of course) it causes problems when trying to edit something: the datas are formatted as I requested in the app_model but this causes validation problems (super simple example: boolean humanized as Yes/ No and no more as 1/0). I would have thought the only time you need to display 1 or 0 as yes or no is in the view. You're quite right that if you adjust the data in app_model, it will break your DB. I have a Config value set in my bootstrap, and output that. eg: // bootstrap.php Configure::write('yesno', array(0='No', 1='Yes'); // View Configure::read('yesno.'.$row[$modelClass]['field']); // outputs 'Yes' for 1, and 'No' for 0. hth Jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cloud application with CakePHP? Different databases with same app.
The title may be misleading, but bear with me. I would like to use CakePHP to create one application, which then has multiple instances. Think of it, if you will, as different websites being powered by the same application--not a copy of it. Each instance (website) would have its own database and website-specific files and configurations, but they all load the same CakePHP application to power it. The basic idea as I have it is to have different directories, each containing a .php file with configuration options, which then loads the application from another directory. Something like this: /mysite /myothersite /anothersite /app ...where the first three directories contain the single .php file, images and possibly a cache, and the app holds the application. The reason I want to do this is because of it being easier to maintain one installation per server than having 10 or 20 or 50 separate installations of the same application. Upgrading would be infinitely easier. It might even be faster and take less resources from the server. For the record, I'm somewhat new to CakePHP. I'm an experience PHP developer who also have extensive Rails background, so while I'm new to Cake, I'm not new to PHP or the MVC architecture. My question is whether this is a viable approach. Is using one CakePHP app with different databases going to screw up caching? Can I disable the caching and build my own caching system in the individual directories? Is it going to make things slower than if I had individual CakePHP apps for all of the websites? How would the single application handle, say, 50 websites? Basically, I'm looking for thoughts and ideas on whether the single installation of the application with X number of websites is a better approach than the X number of individual installations. Any help would be appreciated. - Sebastian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Announcing CakeXT: Bind CakePHP and ExtJS together
Hi I started using this project and I guess I still have to grasp the concept of ExtJs coding ... I wonder, would it be possible to use this in a different environment than just the 3 tabs you mentioned? Regards On 25 Aug., 10:23, technicaltitch technicalti...@gmail.com wrote: Very exciting! On Aug 24, 11:18 am, wirtsi florian.kra...@googlemail.com wrote: Hi ... I have started a new project to bind CakePHP and ExtJS together. I've been using CakePHP for the last few years and found that the further you push your projects into the Web 2.0 / heavy Ajax domain, the more difficult it gets to keep track of all the html / javascript dependencies you need for your site to work. ExtJs handles all this very nicely, it pushes ALL of the user interface creation onto the browser ... so the V from MVC purely lives on the client side. All the business logic like data validation is of course still handled by Cake. I've written a lengthy blog entry on how to use CakeXT (which consists of a Cake Helper and an extended Ext class) including a demo of the system. The cool part really is, that you don't need any further configuration of Ext. Add a new field to your database and it will automatically appear in your view. The blog entry can be found athttp://blog.mykita.com/2009/08/introducing-cakext-create-slick-single... and the project lives athttp://cakext.mykita.com/trac. Since this project is still very young I'd love to hear what you think about it ... for sure there's plenty of room for improvements :) Wirtsi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: encoding problems: utf-8
the main encoding problem is in a shell script: The script imports RSS from 10 different sources once every hour and stores them in DB. In order to normalize the grabbed content I use: foreach ($feed-get_items() as $item){ $myitem['title'] = trim($item-get_title()); $myitem['title'] = trim($myitem['title'])!='' ? html_entity_decode ($myitem['title'], ENT_QUOTES, 'UTF-8') : $rssFont['name']; $myitem['content'] = $item-get_description(); $myitem['link'] = $item-get_permalink(); $myitem['pubDate'] = $item-get_date('Y-m-d H:i:s'); $myitem['source_id'] = $rssFont['id']; $this-saveRetrievedData($myitem); } This works fine locally, while conversion is not going well remotely --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to use a plugin's layout form a different plugin
Hi to all. I'm developing a plugin named pizza and I have another plugin named beautifull_layout. When I order a new pizza i'd like to use a layout from the beautifull_layout plugin. class Pizza extend PizzaAppController { function order() { $this-plugin = beautifull_layout; $this-layout = pink_layout; } } When this code is being executed I get a missing view error because Cake look for Pizza::order view into beautifull_layout plugin. I want to use layout from different plugin but keep views and other things in my plugin. Thanks to all! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Friendly image/files URL routing
Actually, using a media view would be the better bet. Already deals with everything for you. On Aug 26, 3:30 pm, Jon Bennett jmbenn...@gmail.com wrote: Hi, I am uploading files(images, mp3s etc) to my webroot /files/ folder. The files are named their id number.their extension. Without any custom routing I can access these files by /files/343.png. I would like to access this file by using the URL /files/343- sometitle.png as well. At the moment I can do this by using a custom route and an action, but this just redirects and so the URL displays / files/343.png - I would like the URL to not change and for the file to be displayed as it would be normally. You're nearly there. What you need to do is use echo file_get_contents() in a controller method, eg: public function img($filename='') { $this-autoRender = false; // check file exists if (!file_exists(WWW_ROOT.'files'.DS.$filename)) return; // output file - very crude as it is, you'd want to set the correct header/mime type etc echo file_get_contents(WWW_ROOT.DS.'files'.DS.$filename); } this only checks for a file with a real name, you'll want to strip out anything other than the ID.ext hth Jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help
Just to clarify mike's point: in your controller: $conditions = array(Property.zip = $this-data); should be: $conditions = array(Property.zip = $this-data['Property'] ['zip']); On Aug 26, 10:15 pm, mike karthauser mi...@brightstorm.co.uk wrote: hi you should turn on debug=2 and have a look at your query. i suspect you aren't returning the value you want to return any data. have you pr($this-data) within your controller action? i suspect your echo $form-input('Zip Code'); field is better named as echo $form-input('zip', array(label'='Zip Code'));which will give you $this-data['Property']['zip'] with a value when you post HTH bumper wrote: I'm brand new to cake so please be gentle My view look like the following : div id=property ?php echo $form-create('property', array('action' = 'findzip')); echo $form-input('Zip Code'); echo $form-submit(); echo $form-end(); ? /div ?php foreach ($foundProperties as $property): ? ?php echo $this-element('property', array('property' = $property)); ? ?php endforeach; ? my function in the controller looks like : function findzip() { if (!empty($this-data)) { $conditions = array(Property.zip = $this-data); $foundProperties = $this-Property-findall ($conditions); $this-set(compact('foundProperties'));} } all I want to do is return the properties that have the zip code sent by the form. I've been working on it for two days and I'm at my wits end. Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Radio with WRONG LABEL ID
HI, I can't resolve a strange problem. This is my code: echo $form-input('User.SecurityAccess.'.$aco_id, array ( 'div' = false, 'label' = false, 'type' = 'radio', 'legend' = false, 'default' = $selected, 'options' = array('allow' = nbsp;{$allow}, 'deny' = nbsp;{$deny}) ) ); I try to create a set of radio groups, every group has 2 raàdio buttons. I want taht every radio group has different id in their label, so the user can click directly on the label, BUT CAKE SEEMS TO PUT the same id in the code. This is the resulting code: input type=radio name=data[Group][SecurityAccess][4] id=GroupSecurityAccessAllow value=allow / label for=GroupSecurityAccessAllownbsp;Allow/label input type=radio name=data[Group][SecurityAccess][4] id=GroupSecurityAccessDeny value=deny checked=checked / label for=GroupSecurityAccessDenynbsp;span style = 'color: red'Deny/span/label The other pairs of radio buttons has the SAME LABEL ID. ANY IDEAS? Tnx!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: related to Session-setFlash
Sorry for the late reply.Yes, you are right, if you are doing it in views/layouts/default.ctp On Aug 21, 6:53 am, kdubya kenwin...@winanstech.com wrote: On Aug 19, 9:01 am, zaboo adambartholo...@gmail.com wrote: Don't echo $this-Session-setFlash() On Aug 19, 8:27 am, Chander Bhan gotob...@gmail.com wrote: I always get the digit 1 in the next line of the message sent through Session-setFlash from controller, need help I don't understand this answer. I have been having the same problem (the number 1 being displayed on the line after the flash message). Here is the code snippet from my controller: function edit($id = null) { $this-set('schema', $this-Item-_schema); if (!$id empty($this-data)) { $this-Session-setFlash(__('Invalid Item', true)); $this-redirect(array('action'='index')); } And here is the code from the view: ?php echo $session-flash();? Are you saying that in the view the code should be: ?php $session-flash();? Is that correct? Thanks, Ken --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
You should first check by is_uploaded_file() and then move it by move_uploaded_file(). It is the only safe way with PHP. These functions goes through bunch of PHP security restrictions instead of normal file functions. Until move_uploaded_file() called or request finished file is in temp dir with temp name. After move or script exit it is deleted. Doing the move after the is_uploaded_file puts the file in the right place, but makes the is_uploaded_file return false. It only means that you actually do move_uploaded_file() before is_uploaded_file() somewhere. On Aug 27, 2:42 am, MrMeikel mrmei...@gmail.com wrote: Hi, I haven't done any file upload handling for a long time in php, so maybe I am missing something quite obvious here. I have a simple upload form using the form helper that seems to work. My controller then calls a model function called data_upload which is responsible for moving the uploaded file using move_uploaded_file. This suceeds and I have now have the chosen file in my /files/ folder - everything seems fine. However, my Model validation calls on the php method is_uploaded_file which is passed the same file path/name as the move_uploaded_file - which returns false. I also cannot find the suggested temp file anywhere on my computer (local server). Removing the move_uploaded_file makes is_uploaded_file return true, but still I cannot find the temp file anywhere. Doing the move after the is_uploaded_file puts the file in the right place, but makes the is_uploaded_file return false. I have checked php.ini and file uploads are on, and the tmp file is the one where I am looking - I also checked my whole C:\ for any possible temp file and found nothing. I assume this is something to do with caching uploads? I am running xampp on windows 7. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: MVC-way to obtain common data formatting
You can try creating a couple of methods in your model. One afterFind, and another beforeSave. You can convert the data however you want in the afterFind, and then convert it back in the beforeSave so that it doesn't mess up your validation and save methods. But you're going to run into other problems with this method as well. The form helper might;' have some issues with the newly formatted data, and not knowing exactly what to do with it. Your best bet is to convert the data how you want right before viewing. It's not the easiest to edit a lot of files, but it will save you headache in the long run. Also... to convert a 0/1 to a No/Yes, you can use the built in Set::enum($select, $list = null) method, leaving the $list var empty will auto populate it with a yes/no array. echo Set::enum($data['boolean_field']) will output yes or no depending on value. Wrap that in a ucfirst or ucwords to get Yes No, done. On Aug 26, 3:52 pm, ark0n3 nicolabeg...@gmail.com wrote: That's a good starting point but there's need to change every interested line in the views, while I'd like to obtain an automatic and centralized solution i.e. if I write a new page there should be no need to remember that work-around On 26 Ago, 15:42, Jon Bennett jmbenn...@gmail.com wrote: Hi Nicola, thanks for your kind reply but that's just what I'd avoid: I'm trying to accomplish an automatic way to achieve that result, I know it's not right to use a model function and I asked for an MVC and non- validation-breaking way.. Another way would be to create a helper. How about this helper:http://pastie.org/595351 // use it like so $data = array('Model'=array('status'=1)); echo $dataConverter-nice('Model.status', 'onoff', $data); IMHO the thing to remember is that you only adjust the data for presentation only, hence it's done in either the view or the controller. hth jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cloud application with CakePHP? Different databases with same app.
I detailed how I do it in an article in the Bakery: http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-domains It works on one Cake core, one app, one apache (or nginx) vhost (with multiple aliases). It makes development-specific settings easy as-well since that is handled the same way. The local domain martin.site gets the same level of separation as all the rest. It works and has worked since 2006 in various iterations. It does require a minimal alteration to one Cake core file to make caching and logging domain-specific. In reality I maintain two app directories. One stable and one edge or testing. Each has it's own vhost and I can more sites from stable to testing and back by just moving the single line with the domain name from one vhost to the other. On Aug 27, 6:02 am, Sebastian sebastian.von.con...@gmail.com wrote: The title may be misleading, but bear with me. I would like to use CakePHP to create one application, which then has multiple instances. Think of it, if you will, as different websites being powered by the same application--not a copy of it. Each instance (website) would have its own database and website-specific files and configurations, but they all load the same CakePHP application to power it. The basic idea as I have it is to have different directories, each containing a .php file with configuration options, which then loads the application from another directory. Something like this: /mysite /myothersite /anothersite /app ...where the first three directories contain the single .php file, images and possibly a cache, and the app holds the application. The reason I want to do this is because of it being easier to maintain one installation per server than having 10 or 20 or 50 separate installations of the same application. Upgrading would be infinitely easier. It might even be faster and take less resources from the server. For the record, I'm somewhat new to CakePHP. I'm an experience PHP developer who also have extensive Rails background, so while I'm new to Cake, I'm not new to PHP or the MVC architecture. My question is whether this is a viable approach. Is using one CakePHP app with different databases going to screw up caching? Can I disable the caching and build my own caching system in the individual directories? Is it going to make things slower than if I had individual CakePHP apps for all of the websites? How would the single application handle, say, 50 websites? Basically, I'm looking for thoughts and ideas on whether the single installation of the application with X number of websites is a better approach than the X number of individual installations. Any help would be appreciated. - Sebastian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
Cake can handle it... what you are really asking is wether your server can handle it without any type of load-balancing. This is a much harder question to answer since it would depend on many factors. The reason Cake is a good framework for your situation is that it is designed to help you out if and when you need to scale up. Cake has support for many optimizing techniques. Caching on several levels, memcached support, switching of database servers at runtime (one write db and three read dbs for example) and so on. Cake also encourages you to design your application well which helps. :) An SQL table with 500'000 rows is no problem for the database engine. Just don't tell cake to load them all up at the same time :) On Aug 27, 1:23 am, DigitalDude e.blumsten...@googlemail.com wrote: Hey, I'm wondering if it would be possible to build up a small a medium social network, just testwise, with CakePHP. Let's say we would have approx 50.000 users and the could connect to each other, could Cake and the DB handle those masses of users and information? How would it be pissible to save the users relations? A hasAndBelongsToMany-table where the relationships are stored would take up to let's say 500.000 records in a DB table, is this possible with only ONE database? Although this is quite a theoretical question here, I'd be interested in your opinions and suggestons. Regards, DD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: get profile id when user logs in
Actually, you had the right idea already. If User hasOne Profile and Profile belongsTo User, then Profile will have user_id and User will not have profile_id. However, you could pass just the User.id as before and get the Profile.id in the action that your link points to. view: echo $html-image( 'cog.png', array( 'alt' = 'Edit', 'title' = 'Edit', 'url' = array( 'controller' = 'users', 'action' = 'edit', $session-read('Auth.User.id') ) ) ); controller: function edit($user_id = null) { if (!is_null($user_id)) { $profile_id = $this-Profile-find('first', array('Profile.user_id' = $user_id)); ... } } or: function edit($user_id = null) { if (!is_null($user_id)) { $profile = $this-Profile-find( 'first', array( 'conditions' = array('Profile.user_id' = $user_id) ) ); ... } } On Wed, Aug 26, 2009 at 4:39 PM, paulos nikolopaulitosthe...@gmail.com wrote: Sry Brian you are right!The relations are: User HasOne Profile and Profile belongsTo User.In profiles table i use the user_id field but in users i didn't use the profile_id.So in order to make your solution work i must add a field with that name,if there is not any other soluton. Many thanks for your post Brian! 2009/8/26 brian bally.z...@gmail.com Use $session-read('Auth.User.profile_id') *if* your User model has that field. You haven't explained how the association between User Profile has been set up, so it's difficult to say. On Wed, Aug 26, 2009 at 12:01 PM, Paulos23paulitosthe...@gmail.com wrote: Hello people, I am facing a small problem here.To get you to the point i have 2 models User,Profile and their controllers as well.I have set up the relations and then i created an element which appears when user logs in.In the element i have put options in order to view,edit User details and Profile details.I have managed to pass the id of user from the view like this ?php echo $html-image(cog.png,array(alt = Edit,title=Edit,'url' = array('controller' = 'users', 'action' = 'edit',$session-read('Auth.User.id';? and now i want to pass the profile id but when i do - ?php echo $html-image(user_go.png,array(alt = View ,title=View,'url' = array('controller' = 'profiles', 'action' = 'view',$user['Profile']['id'])));? i take 2 errors that user and profile variables are not defined. How can I take the profile id to pass it to the profiles_controller like in the users above?? Is there any way to do it? Ty very much in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: encoding problems: utf-8
Are you sure your db connection is using UTF-8? BTW, I noticed an error in my last reply. It should be SET NAMES 'utf8'; (no '-') On Thu, Aug 27, 2009 at 4:01 AM, danfreakfreakclimb...@gmail.com wrote: the main encoding problem is in a shell script: The script imports RSS from 10 different sources once every hour and stores them in DB. In order to normalize the grabbed content I use: foreach ($feed-get_items() as $item){ $myitem['title'] = trim($item-get_title()); $myitem['title'] = trim($myitem['title'])!='' ? html_entity_decode ($myitem['title'], ENT_QUOTES, 'UTF-8') : $rssFont['name']; $myitem['content'] = $item-get_description(); $myitem['link'] = $item-get_permalink(); $myitem['pubDate'] = $item-get_date('Y-m-d H:i:s'); $myitem['source_id'] = $rssFont['id']; $this-saveRetrievedData($myitem); } This works fine locally, while conversion is not going well remotely --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
Just to add to Dr. Loboto's response, from your question, it seems that you're passing the final destination path to is_uploaded_file(). That will not work, as it expects the tmp name (because it will look in the tmp directory). And, as it's already been moved, the tmp file will have been deleted, as already mentioned. On Thu, Aug 27, 2009 at 7:25 AM, Dr. Lobotodrlob...@gmail.com wrote: You should first check by is_uploaded_file() and then move it by move_uploaded_file(). It is the only safe way with PHP. These functions goes through bunch of PHP security restrictions instead of normal file functions. Until move_uploaded_file() called or request finished file is in temp dir with temp name. After move or script exit it is deleted. Doing the move after the is_uploaded_file puts the file in the right place, but makes the is_uploaded_file return false. It only means that you actually do move_uploaded_file() before is_uploaded_file() somewhere. On Aug 27, 2:42 am, MrMeikel mrmei...@gmail.com wrote: Hi, I haven't done any file upload handling for a long time in php, so maybe I am missing something quite obvious here. I have a simple upload form using the form helper that seems to work. My controller then calls a model function called data_upload which is responsible for moving the uploaded file using move_uploaded_file. This suceeds and I have now have the chosen file in my /files/ folder - everything seems fine. However, my Model validation calls on the php method is_uploaded_file which is passed the same file path/name as the move_uploaded_file - which returns false. I also cannot find the suggested temp file anywhere on my computer (local server). Removing the move_uploaded_file makes is_uploaded_file return true, but still I cannot find the temp file anywhere. Doing the move after the is_uploaded_file puts the file in the right place, but makes the is_uploaded_file return false. I have checked php.ini and file uploads are on, and the tmp file is the one where I am looking - I also checked my whole C:\ for any possible temp file and found nothing. I assume this is something to do with caching uploads? I am running xampp on windows 7. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
A single DB table with 500,000 records is not a problem, as long as you're using a decent DB engine. I've used both Postgres and MySQL for tables with several million records. Just make sure that you use the DB's optimisation for large tables (eg. indexes, etc.) On Wed, Aug 26, 2009 at 7:23 PM, DigitalDudee.blumsten...@googlemail.com wrote: Hey, I'm wondering if it would be possible to build up a small a medium social network, just testwise, with CakePHP. Let's say we would have approx 50.000 users and the could connect to each other, could Cake and the DB handle those masses of users and information? How would it be pissible to save the users relations? A hasAndBelongsToMany-table where the relationships are stored would take up to let's say 500.000 records in a DB table, is this possible with only ONE database? Although this is quite a theoretical question here, I'd be interested in your opinions and suggestons. Regards, DD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use a plugin's layout form a different plugin
You can not do this. But you can add beautifull_layout to $viewPaths in bootstrap.php. I would hack this out like: class Pizza extend PizzaAppController { function order() { Configure::write('viewPaths', array_unshift(Configure::read ('viewPaths'), APP.'plugins'.DS.'beautifull_layout'.DS.'views'.DS)); $this-layout = pink_layout; } } On Aug 27, 12:18 pm, MPeg marco.pegor...@gmail.com wrote: Hi to all. I'm developing a plugin named pizza and I have another plugin named beautifull_layout. When I order a new pizza i'd like to use a layout from the beautifull_layout plugin. class Pizza extend PizzaAppController { function order() { $this-plugin = beautifull_layout; $this-layout = pink_layout; } } When this code is being executed I get a missing view error because Cake look for Pizza::order view into beautifull_layout plugin. I want to use layout from different plugin but keep views and other things in my plugin. Thanks to all! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cloud application with CakePHP? Different databases with same app.
Martin, Thank you for the link! It seems to be more than enough to get me started on this. I will likely modify some of your methods to suit my intended setup, but it is indeed a great article. Out of curiosity, how many different domains do you run with this setup? And how do you feel the performance and speed is? - Sebastian On Aug 27, 9:46 pm, Martin Westin martin.westin...@gmail.com wrote: I detailed how I do it in an article in the Bakery:http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom... It works on one Cake core, one app, one apache (or nginx) vhost (with multiple aliases). It makes development-specific settings easy as-well since that is handled the same way. The local domain martin.site gets the same level of separation as all the rest. It works and has worked since 2006 in various iterations. It does require a minimal alteration to one Cake core file to make caching and logging domain-specific. In reality I maintain two app directories. One stable and one edge or testing. Each has it's own vhost and I can more sites from stable to testing and back by just moving the single line with the domain name from one vhost to the other. On Aug 27, 6:02 am, Sebastian sebastian.von.con...@gmail.com wrote: The title may be misleading, but bear with me. I would like to use CakePHP to create one application, which then has multiple instances. Think of it, if you will, as different websites being powered by the same application--not a copy of it. Each instance (website) would have its own database and website-specific files and configurations, but they all load the same CakePHP application to power it. The basic idea as I have it is to have different directories, each containing a .php file with configuration options, which then loads the application from another directory. Something like this: /mysite /myothersite /anothersite /app ...where the first three directories contain the single .php file, images and possibly a cache, and the app holds the application. The reason I want to do this is because of it being easier to maintain one installation per server than having 10 or 20 or 50 separate installations of the same application. Upgrading would be infinitely easier. It might even be faster and take less resources from the server. For the record, I'm somewhat new to CakePHP. I'm an experience PHP developer who also have extensive Rails background, so while I'm new to Cake, I'm not new to PHP or the MVC architecture. My question is whether this is a viable approach. Is using one CakePHP app with different databases going to screw up caching? Can I disable the caching and build my own caching system in the individual directories? Is it going to make things slower than if I had individual CakePHP apps for all of the websites? How would the single application handle, say, 50 websites? Basically, I'm looking for thoughts and ideas on whether the single installation of the application with X number of websites is a better approach than the X number of individual installations. Any help would be appreciated. - Sebastian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Weird SQL requests with CakePHP on an Oracle DataBase ?!!
Hi everyone, I've transfered all my data from MySQL to an Oracle Database. It used to work very well with MySQL. Now, when i try to launch my application, i've got weird request. I respected all tablename conventions from the CakePHP sites so i've set plural tablenames. For examples for the table groups here is the sql request from CakePHP : SELECT Group.id, Group.name, Group.parent_id, Group.lft, Group.rght, Group.commentaires, Group.created, Group.modified FROM groups Group WHERE 1 = 1 ORDER BY Group.lft asc Notice that it don't use the plural of Group AND at the end, in the FROM, i've got the tablename two times.. I don't have any clue from where does it come and how can i fix this.:( Thanks in advance for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Modules in cake?
No, but you can group mvc files by adding additional paths in bootstrap.php (see doc comments), but this is not best solution. (performance and some other issues on how cake includes view files) On Aug 26, 11:09 pm, Mech7 chris.de@gmail.com wrote: Is there way to setup modules in cake... I don't mean plugins which are seperate capplications but modules that will hace MVC files... but could also work togheter... for example you can install a Tag module.. and if you install a Pages or Blog modules they could make use of it... all in seperate directories? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help
Thanks ... that did it !!! Rich --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Modules in cake?
Well, you could just write plugins that take advantage of this functionality - i.e. write a Blog plugin that will use a Tag plugin if it exists. On Aug 26, 2:09 pm, Mech7 chris.de@gmail.com wrote: Is there way to setup modules in cake... I don't mean plugins which are seperate capplications but modules that will hace MVC files... but could also work togheter... for example you can install a Tag module.. and if you install a Pages or Blog modules they could make use of it... all in seperate directories? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
checkboxes with alternative value
Dear all, i'm a CakePHP newbie and i'm looking for some help regarding a particular use of checkboxes in a form. Basically i've got a check-boxes-section in the form of a baked edit.ctp, called with a basic echo $form-input('Amenity', array( 'type' = 'select', 'multiple' = 'checkbox' )); The models refers to a join table with an additional field 'specify': CREATE TABLE IF NOT EXISTS `amenities_properties` ( `id` int(11) unsigned NOT NULL auto_increment, `property_id` int(11) NOT NULL, `amenity_id` int(11) NOT NULL, `specify` varchar(100) NOT NULL default 'yes', PRIMARY KEY (`id`) ); The idea is to set values like this: 'no' if unchecked 'yes' ..if checked 'whatever'... if checked and a string 'whatever' is inserted In other words I need to associate to each checkboxes an additional input text field to be eventually filled only if the checkboxes are previously checked I've found what it seems a perfect solution for this, but now I need some help to implement it in CakePHP terms. Here it is: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd html head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 titleTest Checkbox/title script type=text/javascript function CheckCheckBox(frm) { if (!frm.CheckThis.checked) frm.CheckThis.focus() } /script /head body form pinput type=checkbox name=CheckThis To insert your name check the box./p p Name: input type=text name=UserName onfocus=CheckCheckBox (this.form)/p /form /body /html (see it in action here: http://www.html.it/articoli/1756/esempio.html ) How you can see, the javascript function allows the user to input an alternative value to yes/no only if the checkbox is previously checked So the point is: how to get done this behaviour togheter with CakePHP default Form Helper ? Do you think it's possible somehow or another approach would be better to achieve the same result ? Thanks a lot in advance for some suggestions Best regards fabio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use a plugin's layout form a different plugin
But this way it couldn't be two (or more) layout with same name in different plugins... I might use plugins to distribute graphics and client-side functionality... import every plugins's paths into viewPaths might reduce system performance... do you know an alternative way to share layout between plugins and application? Thanks! On Aug 27, 3:32 pm, majna majna...@gmail.com wrote: You can not do this. But you can add beautifull_layout to $viewPaths in bootstrap.php. I would hack this out like: class Pizza extend PizzaAppController { function order() { Configure::write('viewPaths', array_unshift(Configure::read ('viewPaths'), APP.'plugins'.DS.'beautifull_layout'.DS.'views'.DS)); $this-layout = pink_layout; } } On Aug 27, 12:18 pm, MPeg marco.pegor...@gmail.com wrote: Hi to all. I'm developing a plugin named pizza and I have another plugin named beautifull_layout. When I order a new pizza i'd like to use a layout from the beautifull_layout plugin. class Pizza extend PizzaAppController { function order() { $this-plugin = beautifull_layout; $this-layout = pink_layout; } } When this code is being executed I get a missing view error because Cake look for Pizza::order view into beautifull_layout plugin. I want to use layout from different plugin but keep views and other things in my plugin. Thanks to all! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Weird SQL requests with CakePHP on an Oracle DataBase ?!!
I'm not familiar with Oracle syntax. Does it normally leave out the AS when using an alias? If so, it looks ok to me. The table is groups and the alias is Group. On Thu, Aug 27, 2009 at 9:48 AM, Xanaxmammer...@gmail.com wrote: Hi everyone, I've transfered all my data from MySQL to an Oracle Database. It used to work very well with MySQL. Now, when i try to launch my application, i've got weird request. I respected all tablename conventions from the CakePHP sites so i've set plural tablenames. For examples for the table groups here is the sql request from CakePHP : SELECT Group.id, Group.name, Group.parent_id, Group.lft, Group.rght, Group.commentaires, Group.created, Group.modified FROM groups Group WHERE 1 = 1 ORDER BY Group.lft asc Notice that it don't use the plural of Group AND at the end, in the FROM, i've got the tablename two times.. I don't have any clue from where does it come and how can i fix this.:( Thanks in advance for any help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Weird SQL requests with CakePHP on an Oracle DataBase ?!!
I found the reason : it's the alis GROUP. This is a keyword reserved by ORACLE database engine. How can i change the alias ? Perahps in the model of the table ? Another solution is to change the tablename so it will change the alias associated but i would have to change a lot of SQL request... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
Hey, ok these infos sound nice, the fact with the multiple read-db's is one I haven't heard of but I'll gather all required info on that topic. But to stay more practical, how would one realise a friend-list like facebook or the other big networks? Is a join-table really a good approach to realize it? If I had 100 friends, then just for ME there would be 100 records in that table, right? I'm not sure if I'll ever build such a network, but I'm very interested to see how things work and how to implement such complex structures! On 27 Aug., 15:24, brian bally.z...@gmail.com wrote: A single DB table with 500,000 records is not a problem, as long as you're using a decent DB engine. I've used both Postgres and MySQL for tables with several million records. Just make sure that you use the DB's optimisation for large tables (eg. indexes, etc.) On Wed, Aug 26, 2009 at 7:23 PM, DigitalDudee.blumsten...@googlemail.com wrote: Hey, I'm wondering if it would be possible to build up a small a medium social network, just testwise, with CakePHP. Let's say we would have approx 50.000 users and the could connect to each other, could Cake and the DB handle those masses of users and information? How would it be pissible to save the users relations? A hasAndBelongsToMany-table where the relationships are stored would take up to let's say 500.000 records in a DB table, is this possible with only ONE database? Although this is quite a theoretical question here, I'd be interested in your opinions and suggestons. Regards, DD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: saveAll with a hasMany relationship
I think maybe the difference between what you and I was doing is that I was trying to save multiple main records at one time, whereas you were doing one. $this-data[1]['Recipe']['name'] = 'Delicious apple pie'; $this-data[1]['Recipe']['serves'] = 6; $this-data[1]['Recipe']['valid'] = 1; $this-data[1]['Tag'][0]['tag_id']=4; $this-data[1]['Tag'][1]['tag_id']=2; $this-data[1]['Tag'][2]['tag_id']=3; $this-data[1]['Recipe']['name'] = 'Pork spare ribs'; $this-data[1]['Recipe']['id'] = 166; $this-data[1]['Recipe']['serves'] = 4; $this-data[1]['Recipe']['valid'] = 1; $this-data[1]['Tag'][0]['tag_id']=1; $this-data[1]['Tag'][1]['tag_id']=5; $this-data[1]['Tag'][2]['tag_id']=9; - Once I added the hasMany ingredients that broke and I had to loop through the data and save each one individually: foreach ($this-data as $save) { $this-saveAll($save); } So $save would look like this: $save['Recipe']['name'] = 'Delicious apple pie'; $save['Recipe']['serves'] = 6; $save['Recipe']['valid'] = 1; $save['Tag'][0]['tag_id']=4; $save['Tag'][1]['tag_id']=2; $save['Tag'][2]['tag_id']=3; $save['Ingredient'][0]['name']='sugar'; $save['Ingredient'][1]['name']='apples'; and so on... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Changing the alias giver to a table ! :)
Hi, I have a problem with some SQL request in Oracle. GROUP is a reserved keyword for Oracle. And Cakephp generate some SQL request with this alias (because my table's name is GROUPS). So these request don't work until i change the alias from GROUP to GROUPE for example. I would like to know if it's possible to change the alias given to this table. I tried to change the name of the model and the name of the class by doing this : class Groupe extends AppModel { var $name = 'Group'; //Like this, i don't have to change my code ... } I have now a strage error : CakePhp generate a SQL request which is children and that's all. I use a treebehavior on this model. I don't know from where this problem come... Thanks in advance dor any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Moving TinyMCE into vendors folder...Need Help.....
Hi, when TinyMCE was placed inside webroot/js folder, everything worked fine. But when i placed it inside vendor folder (more apps can use it) TinyMCE run and display their window in place of textarea, but icons don't load. When I move the mouse over, button gets highlighted but icons are not displayed. Is there some way how to put TinyMCE into vendor folder with 100% functionality? Thanks for tips --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
String conversion error when enabling debug mode after switching hosts.
Greetings to all, This is my first cake app I've made and I am having problems after moving it from my development server to a production server. Everything is working fun except two actions are just giving me a blank page when I try to view them. One is an advanced search action and the other is just a basic index. When I turn the debug level to 1 or higher nothing works at all. Here is the errors it gives: Illegal offset type [CORE/cake/libs/model/datasources/dbo_source.php, line 331] Array to string conversion [CORE/cake/libs/model/datasources/dbo/ dbo_mysql.php, line 411] Array to string conversion [CORE/cake/libs/model/datasources/ dbo_source.php, line 519] SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Array' at line 1 [CORE/cake/libs/model/datasources/ dbo_source.php, line 526] Array to string conversion [CORE/cake/libs/model/datasources/ dbo_source.php, line 530] Query: Array Cannot modify header information - headers already sent by (output started at /usr/home/rgctbp1/cake/cake/basics.php:111) [CORE/cake/libs/ controller/controller.php, line 640] I know the headers already sent message is coming is happening because it's trying to redirect to the login page and cannot. If I manually enter the login url it looks normal but still has these errors and I cannot login. Obviously something is wrong because it's sending an array as a sql query. I did a print_r in dbo_source.php and the array is: Array ( [class] = Query [alias] = Query [id] = ) If that helps at all. The only things that have changed from my dev server to my production server is my dev server was running php5 and mysql5 and the production server is running php4 and mysql4 but I don't expect that to have made a difference. I have deleted all the cache information so that's not the problem. The production server does have a /~username/ in the url so I had to add the rewriteBase /~user/ to the .htaccess file before it would work. Any help would be appreciated. David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Where do you put code needed in controllers and models?
Would a component be the right thing to use? For instance, I have a routine that parses data and I need it both in models and controllers. How do you include a component in model? I guess I can always access the model from the controller, so perhaps app_model is a better choice. Any opinions welcome! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Yes, you could use array_push() indeed, although you don't even need to. The PHP manual recommends this method if you want to add just one entry: $isps['none'] = None of the above; This way 'none' will show up as last in the dropdown, as long as you put the line after -find(). On 27 aug, 20:52, DigitalDude e.blumsten...@googlemail.com wrote: Hey, nice one, didn't know about that. Would it be correct for an added value at the END of the array to use array_push() ? On 27 Aug., 20:48, Melgior melg...@hotmail.com wrote: Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
Not necessarily. If you are doing a friend system, the table would look like so: friends: id, user1_id, user2_id And 1 row would be for both user1 and user2, instead of adding 2 rows for each user. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Change the alias or the name of a table !!
Hi, I need to change the alias OR the name of a table. It's weird, i tried to change many variable whithout any changes on requests generated by Cakephp : var $name var $useTable The name of the controller (the name of the file AND the name of the class) The name of the model(the name of the file AND the name of the class) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
forgot something... If you save the value none to your database and in the other cases 0, 1, 2, 3 (id's of the suppliers...) and so on your code should probably look like this: $form-input(Modelname.isp_id, array( 'empty' = __('Select your supplier', true) ); The 'empty' key of the array is used to display the first item on a select as the defined text, set as a gettext (so you can make it multilanguage). The Select will be builded up by cake as a select, because your controller builded it up as a list, so you do not need to type $form-select. other options of the options-array could be: 'type' = select/radio/cechbox, 'label' = set a label for the input, and so on... If you follow cake conventions Cake will automatically display a selected value when editing a record. With the hint from Melgior your list should be complete in the matter you wanted it to look like... On 27 Aug., 20:52, DigitalDude e.blumsten...@googlemail.com wrote: Hey, nice one, didn't know about that. Would it be correct for an added value at the END of the array to use array_push() ? On 27 Aug., 20:48, Melgior melg...@hotmail.com wrote: Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ajax remoteFunction problem
Thanks. I'll give that a try. For now I had just modified h() in basics.php to get it to work. On Aug 13, 2:26 am, Dr. Loboto drlob...@gmail.com wrote: script language=JavaScript function new_heading(heading) { var name =prompt(Enter a heading name, ); new Ajax.Updater( 'heading_list', '?php echo $html-url('/calendars/add_heading/'); ?' + name + '', { asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'heading_list'] } );} /script On Aug 13, 1:05 am, bondo kevd...@gmail.com wrote: The function h($text) in /cake/basics.php has changed and is causing the problem for me. It now uses htmlspecialchars which escapes the single quotes. In the beta version it didn't do this. Without modifying that code, how can I solve my problem so that it does not escape the single quote? On Aug 12, 11:08 am, bondo kevd...@gmail.com wrote: I just upgrade from an old 1.2beta version to 1.2.3.8166 but I'm having a problem with using the remoteFunction now. This is the code I have: script language=JavaScript function new_heading(heading) { var name =prompt(Enter a heading name, ); ?php echo $ajax-remoteFunction(array (update=heading_list, url=/calendars/add_heading/' + name + ')); ?} /script With the old version, when I view the source in a browser, it would look like: new Ajax.Updater('heading_list','/calendars/add_heading/' + name + '', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'heading_list']}) } Now however, it looks like: new Ajax.Updater('heading_list','/calendars/ add_heading/#039; + name + #039;', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'heading_list']}) } It doesn't work with the escaped apostrophe's. How can I fix that? I haven't been able to find anything on it. Thanks. Bondo. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Where do you put code needed in controllers and models?
Most people seem to be fan of 'fat' models: put all your code that handles data in your models and keep your controllers thin and easy to read. Since your function parses data I would put it into the model indeed. If you need it in every model/controller, you can add it to app_model. You could also create a behaviour (the model's equivalent of a component). On 27 aug, 20:57, Nancy nancy.milli...@gmail.com wrote: Would a component be the right thing to use? For instance, I have a routine that parses data and I need it both in models and controllers. How do you include a component in model? I guess I can always access the model from the controller, so perhaps app_model is a better choice. Any opinions welcome! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
Hey, ah ok I think we both mean the same thing, but I forgot that the relation is not only by one side, but by two sides. So a simple example would look like this: Table friends: id user1_id user2_id 1 12 2 52 3 31 4 41 5 24 This would mean: User 1 is a friend of: 2, 3 and 4 User 2 is a friend of: 1, 4 and 5 User 3 is a friend of: 1 User 4 is a friend of: 1 and 2 User 5 is a friend of: 2 Is that correct? I think it is...? On 27 Aug., 18:33, Miles J mileswjohn...@gmail.com wrote: Not necessarily. If you are doing a friend system, the table would look like so: friends: id, user1_id, user2_id And 1 row would be for both user1 and user2, instead of adding 2 rows for each user. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Multiple pagination same view
Does anyone know how to have multiple blocks (multiple tables for example) of paginated data on the same page? There seems to be 2 issues: 1) the navigation section ($paginator-next, etc) gets overwritten by the last pagination on the page. So the navigation data and page counts are correct only for the last pagination instance. 2) clicking a link in the navigation section to show a new page will affect each instance of pagination. Thanks very much, ML --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Radio with WRONG LABEL ID
Um correct me if im wrong, but in the example you showed me the IDs are different and correct. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
Take a look at http://needish.com It's cakephp based :) Regards, Pablo Viojo pvi...@gmail.com http://pviojo.net ¿Que necesitas? http://needish.com On Wed, Aug 26, 2009 at 7:23 PM, DigitalDude e.blumsten...@googlemail.comwrote: Hey, I'm wondering if it would be possible to build up a small a medium social network, just testwise, with CakePHP. Let's say we would have approx 50.000 users and the could connect to each other, could Cake and the DB handle those masses of users and information? How would it be pissible to save the users relations? A hasAndBelongsToMany-table where the relationships are stored would take up to let's say 500.000 records in a DB table, is this possible with only ONE database? Although this is quite a theoretical question here, I'd be interested in your opinions and suggestons. Regards, DD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Hey, nice one, didn't know about that. Would it be correct for an added value at the END of the array to use array_push() ? On 27 Aug., 20:48, Melgior melg...@hotmail.com wrote: Hi, That's easy. You can use array_unshift to add an entry to the start of an array. Just add this to your controller: $isps = $this-Consultation-Isp-find('list'); array_unshift($isps, array(none=None of the above)); And you should be all set. Greets, Melgior. On 27 aug, 19:52, channel5 edd.daw...@comptonsolutions.com wrote: Hi I have a select box that is populated by a database: $isps = $this-Consultation-Isp-find('list'); and then output using the form helper in the view: echo $form-select('isp_id', $isps, array('selected' = $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be none of the below. I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
redirect after download dialog
Let's say I have a view that renders an excel file to download. It presents a download dialog to the user. This user can decide to save the file to the local drive, to open the file or to cancel the operation. Now I need to redirect somewhere else after any operation with the download dialog. Does anybody knows how to do this? Thnks MARTIN --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Passing data from the view to the controller
I am trying to add a comments area to a simple blog application and I would like to pass the id of a specific blog post to the comments controller. The only example I can find involves setting a hidden form field and passing it via the form data... echo $form-hidden('Comment.post_id', array('value' = $post['Post'] ['id'])); Is there any other way to pass the contents of $post['Post']['id'] to the comments controller? The reason I am concerned about this method is (correct me if i'm wrong) it is possible to manipulate the client side of html forms - such as the post id to be passed via html form data therefore a user could tell their browser to add a comment to ANY post id. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
I don't recommend this approach because if you want to know all user 1 friends yo must do something like user_id_1=1 or user_id_2=1 and thats an overhead (and you need two indexes for that) if you have something like: Table friends: id user1_id user2_id 1 12 1 21 2 52 2 25 3 31 3 13 4 41 4 14 5 24 5 42 you can do user_id_1=1 (only one index) Regards Pablo Viojo pvi...@gmail.com http://pviojo.net ¿Que necesitas? http://needish.com On Thu, Aug 27, 2009 at 2:48 PM, DigitalDude e.blumsten...@googlemail.comwrote: Hey, ah ok I think we both mean the same thing, but I forgot that the relation is not only by one side, but by two sides. So a simple example would look like this: Table friends: id user1_id user2_id 1 12 2 52 3 31 4 41 5 24 This would mean: User 1 is a friend of: 2, 3 and 4 User 2 is a friend of: 1, 4 and 5 User 3 is a friend of: 1 User 4 is a friend of: 1 and 2 User 5 is a friend of: 2 Is that correct? I think it is...? On 27 Aug., 18:33, Miles J mileswjohn...@gmail.com wrote: Not necessarily. If you are doing a friend system, the table would look like so: friends: id, user1_id, user2_id And 1 row would be for both user1 and user2, instead of adding 2 rows for each user. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Joining two arrays to use in a Select box with the formhelper
Thanks all for your help, worked a charm! Thanks again :) c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
Ah, that worked. :) Thank you! On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example); ? On Aug 28, 6:01 am, Sarah sarah.e.p.jo...@gmail.com wrote: This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: saveAll with a hasMany relationship
Ok, just caught something in the cakephp online docs: saveAll(array $data = null, array $options = array()) Used to save (a) multiple individual records for a single model or (b) this record, as well as all associated records So perhaps this means I'm just trying to do something that isn't supported. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
The only problem I am having with this is that userpages are then received like this: [Userpage] = Array ( [0] = Array ( [id] = 2 [filename] = helloworld.html [type] = text/html [size] = 34 [approved] = 0 [user_id] = 130 [created] = 2009-08-13 23:13:55 [content] = Is without knowing how many userpages a user has, how can I get the the actual userpage data (id, etc). Thanks, ~Sarah On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example); ? On Aug 28, 6:01 am, Sarah sarah.e.p.jo...@gmail.com wrote: This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Organizing hierarchical system with breadcrumb navigation
I have modeled a business system for my department and it includes about 60 tables/models, perhaps 20 of which as simply lookup/reference tables that I would only make available through admin routing. Out of the box, CakePHP organization is pretty flat -- views and controllers all lying under the application root. So for example, let's say I have these 6 models/controllers: /budgets /invoices /expenses /rooms /buildings /equipment What I want to do is organize these more hierarchically, like so: /financial /budgets /invoices /expenses /facilities /rooms /buildings /equipment I have created a model called menus that is structured to support a 2-level menu and the structure is like so (this is example of a top- level menu entry): [id] = 1 [parent_item] = 0 [title] = Financial [menu_link] = /financial [weight] = 20 I also found a breadcrumb helper that is fairly simple to add. To support some of these top-level menus I have added entries in routes.php, so that when you, for example, navigate to /financial it actually maps to a show menu function in the menus controller that takes /financial as a parameter amd then displays the child menu items for financial. Great. So now the issue that I am looking at is this: When you go into Financial menu and click on budgets it goes to the budgets controller/view that is sitting under the Web root as simply / budgets (and for the moment simply using the default, baked view). At that point my context for Back and breadcrumbs is lost. So I am trying to think of the sanest, least onerous method to add some hierarchical navigation into all of these various controllers and the associated add/edit/index views. I realized that I could add a lot of this in routes.php, for example I could map /financial/budgets to /budgets so that the URL would show the hierarchy (and I could also write a function to split the link into breadcrumb components (Financial Budgets). But keeping eveything up in routes.php seems a little abusive of what routes.php is supposed to do. I am curious to know if anyone has any other ideas. To make this more complicated, I'll be using Authake to enforce access control. So, for example, some users may not have any access to some of the top-level menus (like Financial, say). So I want to try to keep this simple enough to be able to apply reasonably simple access rules.* Thanks, Jim *This brings a question to mind: if using a route, does access control test against the route or against the controller you are routing to? I'm guessing the latter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: jQuery with Cake forms
Thanks a ton for the tip - this worked out great! The only thing I'd want to warn other people about (just in case someone else is following these same footsteps) is that the text input appeared to be a normal, everyday text input until I clicked on it, whereupon the DatePicker control nicely slid out allowed me to use it. :) Thanks again! --Mike On Aug 26, 7:57 pm, Matt Curry m...@mcurry.net wrote: This one's pretty easy actually...Just set the input to be type text and attach the datepicker to the id of the input (not the div): ?php echo $form-input('field', array('type' = 'text')); ? script type=text/javascript $(function(){ $('#ModelField').datepicker(); }); /script -Matthttp://www.pseudocoder.com On Aug 26, 10:02 pm, Mike mike.pan...@gmail.com wrote: Hello! I'm looking to use jQuery with Cake, specifically with a form. My plan was to use a DatePicker (http://docs.jquery.com/UI/Datepicker) control instead of the default datetime drop-down menus, but it looks like the easy approach (give the datetime div an id that jQuery's DatePicker automagically replaces) doesn't seem to work. Specifically, jQuery doesn't replace the Cake form elements (nevermind stuff like feeding back into Cake's validation logic). Also, I don't want to use AJAX, just the UI control to make my otherwise normal form easier to use. I was thinking about hacking together some sort of custom, hidden form elements to convey the datetime back to Cake, putting the DatePicker on the page, and then having code in the 'onSubmit' to extract the relevant info stuff them into the hidden fields. I got as far as realizing that I'd need more code to auto-populate the control, plus the uncertainty that Cake would actually use this info (even if I named the form elements identically to the normal datetime stuff), and realized how dodge-y this all sounded :) So instead of throwing a lot of time into that first up, I wanted to instead ask if there's a reasonable approach to this. I *think* what I want to do is replace a standard Cake $form-input field with my own, but still have the auto-populate (and auto-validate) logic work. Any ideas on ways to approach this would be appreciated. Authoritative responses like There's no way to do this without rewriting parts of Cake/vast amounts of your own code are also appreciated (I'd rather find out this isn't possible try something else, instead of throwing tons of time into it and find that out on my own :) ). Thanks! --Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example); ? On Aug 28, 6:01 am, Sarah sarah.e.p.jo...@gmail.com wrote: This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Strange queries
Hi pals, this is an freak error in my mysql queries: when save / edit an datetime field, all the hyphens are converted in #45; then this field can't be saved or edited. I've checked all the database and app configurations and that's set in utf-8. Some idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Custom query pagination
Hi folks, Before I begin, yes I've read this page: http://book.cakephp.org/view/249/Custom-Query-Pagination I've also read many of the other pages on Google but I'm still stuck! First of all if I may introduce you to my query: http://bin.cakephp.org/view/1064020598 It's a union query that allows me to search across two tables and return the results, ordered by relevance. To put it simply I want to paginate these results, but I haven't a clue how to do it. I tried, and failed, over-riding the paginate and paginateCount methods in my model, but I shan't even begin to post my long list of errors. Where should I start? Thanks! Dean --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
To clarify, I get the error message: Warning (512): SQL Error: 1054: Unknown column 'Userpage.id' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 525] When I try to get select the Userpage.id field. On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example); ? On Aug 28, 6:01 am, Sarah sarah.e.p.jo...@gmail.com wrote: This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: String conversion error when enabling debug mode after switching hosts.
I figured it out. I had a module named 'Query' and when I changed the class name and filename etc to 'Search' and the controller etc to searches everything worked fine. For some reason cakephp with php4 does not like modules named 'Query'. Does that mean I found a bug? On Aug 27, 12:19 pm, superdav da...@stonefamily.cjb.net wrote: Greetings to all, This is my first cake app I've made and I am having problems after moving it from my development server to a production server. Everything is working fun except two actions are just giving me a blank page when I try to view them. One is an advanced search action and the other is just a basic index. When I turn the debug level to 1 or higher nothing works at all. Here is the errors it gives: Illegal offset type [CORE/cake/libs/model/datasources/dbo_source.php, line 331] Array to string conversion [CORE/cake/libs/model/datasources/dbo/ dbo_mysql.php, line 411] Array to string conversion [CORE/cake/libs/model/datasources/ dbo_source.php, line 519] SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Array' at line 1 [CORE/cake/libs/model/datasources/ dbo_source.php, line 526] Array to string conversion [CORE/cake/libs/model/datasources/ dbo_source.php, line 530] Query: Array Cannot modify header information - headers already sent by (output started at /usr/home/rgctbp1/cake/cake/basics.php:111) [CORE/cake/libs/ controller/controller.php, line 640] I know the headers already sent message is coming is happening because it's trying to redirect to the login page and cannot. If I manually enter the login url it looks normal but still has these errors and I cannot login. Obviously something is wrong because it's sending an array as a sql query. I did a print_r in dbo_source.php and the array is: Array ( [class] = Query [alias] = Query [id] = ) If that helps at all. The only things that have changed from my dev server to my production server is my dev server was running php5 and mysql5 and the production server is running php4 and mysql4 but I don't expect that to have made a difference. I have deleted all the cache information so that's not the problem. The production server does have a /~username/ in the url so I had to add the rewriteBase /~user/ to the .htaccess file before it would work. Any help would be appreciated. David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is Cake capable of building up a small or medium social network?
@DigitalDude - Yes thats correct. @Pablo - No its not, it doesn't make a difference in overhead at all. Also by inserting 2 rows your causing overhead and unneeded rows in the database. Heres an example of one of my methods in my Friend model. /** * Checks to see if two users are friends * @param int $user_id * @param int $friend_id * @return boolean */ function isFriend($user_id, $friend_id) { $status = $this-find('first', array( 'fields' = 'Friend.status', 'recursive' = -1, 'conditions' = array( 'OR' = array( array('Friend.user_id' = $user_id, 'Friend.friend_id' = $friend_id), array('Friend.user_id' = $friend_id, 'Friend.friend_id' = $user_id) ) ) )); return $status['Friend']['status']; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Radio with WRONG LABEL ID
Do you mean the name is the same? Because it is supposed to be - both buttons provide a value to the same field. What is the symptom of your problem? On Aug 27, 9:19 pm, lacenaepro...@gmail.com lacenaepro...@gmail.com wrote: HI, I can't resolve a strange problem. This is my code: echo $form-input('User.SecurityAccess.'.$aco_id, array ( 'div' = false, 'label' = false, 'type' = 'radio', 'legend' = false, 'default' = $selected, 'options' = array('allow' = {$allow}, 'deny' = {$deny}) ) ); I try to create a set of radio groups, every group has 2 raàdio buttons. I want taht every radio group has different id in their label, so the user can click directly on the label, BUT CAKE SEEMS TO PUT the same id in the code. This is the resulting code: input type=radio name=data[Group][SecurityAccess][4] id=GroupSecurityAccessAllow value=allow / label for=GroupSecurityAccessAllow Allow/label input type=radio name=data[Group][SecurityAccess][4] id=GroupSecurityAccessDeny value=deny checked=checked / label for=GroupSecurityAccessDeny span style = 'color: red'Deny/span/label The other pairs of radio buttons has the SAME LABEL ID. ANY IDEAS? Tnx!! AS? Tnx!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Hi, my server admin in not loving changes.
On 8/26/2009 1:27 PM, Cosmin Paul wrote: Hi, I am a programmer from a 7 gays team, and I have recently finisher my module. When I uploaded my work to stage one server, I have a bug in sql query generated by cake: guys, right? :-) It appends the model name to an aliascode MortgageDetail`.(`interest_only_rate + 0 `) as interest_only_rate, /code. This is wrong but it is fixed on latest releases of Cake. On the server we got 1.2.1.8004 and I use on my devel machine 1.2.4.8284. This is a common bug, or my code is not ok ?! I haven't seen your code; I can't say. Can some one give me some argument why we should keep the old release ?! and haw can I resolve this problem in the old release ? I don't see any argument to keep 8004. https://trac.cakephp.org/wiki/changelog/1.2.x.x/8120 https://trac.cakephp.org/wiki/changelog/1.2.x.x/8166 https://trac.cakephp.org/wiki/changelog/1.2.x.x/8284 Show your sysadmin the above changelogs. There are way too many fixes and improvements to mention them in one e-mail. P.S.: CakePHP code has been moved to git. Details here: http://code.cakephp.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Passing data from the view to the controller
Look into the Security component. However, I have to ask: so what? If a user is determined to be a jackass, this is one of the least things I'd be concerned about. On Thu, Aug 27, 2009 at 1:18 PM, Robert Popplewellr0b...@gmail.com wrote: I am trying to add a comments area to a simple blog application and I would like to pass the id of a specific blog post to the comments controller. The only example I can find involves setting a hidden form field and passing it via the form data... echo $form-hidden('Comment.post_id', array('value' = $post['Post'] ['id'])); Is there any other way to pass the contents of $post['Post']['id'] to the comments controller? The reason I am concerned about this method is (correct me if i'm wrong) it is possible to manipulate the client side of html forms - such as the post id to be passed via html form data therefore a user could tell their browser to add a comment to ANY post id. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Moving TinyMCE into vendors folder...Need Help.....
You cant link to img, css and js within the vendors folder, unless the files are in the respective folders, example: /venders/css/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Modules in cake?
But plugins are not convenient to use for this purpose as they have their own layout / script etc files.. And not really share anything from the main application On Aug 27, 4:36 pm, Jamie jamie@gmail.com wrote: Well, you could just write plugins that take advantage of this functionality - i.e. write a Blog plugin that will use a Tag plugin if it exists. On Aug 26, 2:09 pm, Mech7 chris.de@gmail.com wrote: Is there way to setupmodulesin cake... I don't mean plugins which are seperate capplications butmodulesthat will hace MVC files... but could also work togheter... for example you can install a Tag module.. and if you install a Pages or Blogmodulesthey could make use of it... all in seperate directories? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Changing the alias giver to a table ! :)
Try leaving the class name as 'Group' and adding var $alias = 'Groupx'; On Thu, Aug 27, 2009 at 12:03 PM, Xanaxmammer...@gmail.com wrote: Hi, I have a problem with some SQL request in Oracle. GROUP is a reserved keyword for Oracle. And Cakephp generate some SQL request with this alias (because my table's name is GROUPS). So these request don't work until i change the alias from GROUP to GROUPE for example. I would like to know if it's possible to change the alias given to this table. I tried to change the name of the model and the name of the class by doing this : class Groupe extends AppModel { var $name = 'Group'; //Like this, i don't have to change my code ... } I have now a strage error : CakePhp generate a SQL request which is children and that's all. I use a treebehavior on this model. I don't know from where this problem come... Thanks in advance dor any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?
Hi Sarah; I'm not sure what you are asking. User hasmany Userpages, so Userpage array will contain all the Userpages belonging to User. $example = $this-User-find('first'); foreach($example['Userpage'] as $key=$value){ debug($value['id']); } On Aug 28, 9:18 am, Sarah sarah.e.p.jo...@gmail.com wrote: To clarify, I get the error message: Warning (512): SQL Error: 1054: Unknown column 'Userpage.id' in 'field list' [CORE/cake/libs/model/datasources/dbo_source.php, line 525] When I try to get select the Userpage.id field. On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example); ? On Aug 28, 6:01 am, Sarah sarah.e.p.jo...@gmail.com wrote: This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to search for Animal information as well? This won't work because of the last field, but this is conceptually what I want: 'fields'=array('user_id', 'id', 'User.animal_id', 'User.Animal.frontfilename') Thanks in advance! ~Sarah --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Passing data from the view to the controller
I'd rather it werent possible for some random jackass to post comments to ANY published/unpublished post :p Regardless of how far down the list, it is still a concern! 2009/8/28 brian bally.z...@gmail.com Look into the Security component. However, I have to ask: so what? If a user is determined to be a jackass, this is one of the least things I'd be concerned about. On Thu, Aug 27, 2009 at 1:18 PM, Robert Popplewellr0b...@gmail.com wrote: I am trying to add a comments area to a simple blog application and I would like to pass the id of a specific blog post to the comments controller. The only example I can find involves setting a hidden form field and passing it via the form data... echo $form-hidden('Comment.post_id', array('value' = $post['Post'] ['id'])); Is there any other way to pass the contents of $post['Post']['id'] to the comments controller? The reason I am concerned about this method is (correct me if i'm wrong) it is possible to manipulate the client side of html forms - such as the post id to be passed via html form data therefore a user could tell their browser to add a comment to ANY post id. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect after download dialog
You can't. In order to have the browser present the user with a save dialog, certain headers need to be sent. By the time that's happened, it's too late to send a redirect header. On Thu, Aug 27, 2009 at 5:35 PM, Martin Radostamartinrado...@gmail.com wrote: Let's say I have a view that renders an excel file to download. It presents a download dialog to the user. This user can decide to save the file to the local drive, to open the file or to cancel the operation. Now I need to redirect somewhere else after any operation with the download dialog. Does anybody knows how to do this? Thnks MARTIN --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Organizing hierarchical system with breadcrumb navigation
In my opinion using a model for breadcrumbs is bloated. Why don't you just set the breadcrumbs in the view manually? The HTML helper has two functions addCrumb and getCrumbs, which makes basic breadcrumbs really simple. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---