Re: renderElement et son $params
On 9/17/06, bicephale [EMAIL PROTECTED] wrote: Je n'arrive pas à comprendre l'usage et l'utilisation du deuxièmeparamètre de la renderElement.Dans la documentation c'est unarray().J'envoie un array().Dans le fichier élément je peux lire le premier argument mais le second argument ($params) contient rien dans sa partie Array().Yes, it would help to post in english, at least on this list.He is having trouble understanding what the second parameter for renderElement does. The second parameter is an array. Within the array you are to pass data to your element.So in your view you would call something like this... ?php echo $this-renderElement('test_element', array('my_variable_name' = 'data for variable') ); ?In your /app/views/test_element.thtml you would then have access to $my_variable_name ?php echo $my_variable_name; ?will output the text data for variable. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Need a Genius for this one!
What I am trying to do, is... Find users in a database between two ages. $minage $maxage The birthdays of the users are in the database in this format 01-30-1980 Now this function takes a birthday in this format 1980-01-30 and returns the age function birthday ($birthday) { list($year,$month,$day) = explode(-,$birthday); $year_diff = date(Y) - $year; $month_diff = date(m) - $month; $day_diff = date(d) - $day; if ($month_diff 0) $year_diff--; elseif (($month_diff==0) ($day_diff 0)) $year_diff--; return $year_diff; } But what I need to do, is somehow only show the results from the database where the birthday is in between two different ages. How do I do this. My brain hurts enough already from writing the function above. Can anyone help? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Need a Genius for this one!
On 9/18/06, ameshkin [EMAIL PROTECTED] wrote: But what I need to do, is somehow only show the results from the database where the birthday is in between two different ages. Then do it in the database, not in PHP. Assuming MySQL: year(current_date()) - year(date_of_birth) returns almost someone's age. Almost, since it is one year too many if someone's birthday hasn't passed yet in the current year. datediff() comes to the rescue. Read http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html which will most likely give you enough information to build the query on your own. And then you'll be your own genius :-) -- Martin Schapendonk, [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Need a Genius for this one!
But what I need to do, is somehow only show the results from the database where the birthday is in between two different ages.If you store your data in your database in a supported date format you can do everything with one mysql statement. http://dev.mysql.com/doc/refman/5.0/en/date-and-time-type-overview.htmlFor mysql the link above has an overview of the date formats.For calculating age there are several ways of manipulating dates in php. The libraries at pear.php.net have some date functionality as well.A google search revealed http://www.devnewz.com/devnewz-3-20051128CalculatingtheDifferenceBetweenTwoDatesUsingPHP.html , which has a function and a usecase for calculating age. You might want to reference a more flexible way with dealing with dates if you change the way they are stored in the database so that you can use a select statement to get a range. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: display enum values in dropdown
Thanks to everyone who replied, I didn't check this thread all weekend. Nate: Thanks I moved the app model to model/app_model.php and updated it with the it works great now. I've also updated the code that retrieves the DB table name, cheers for that. my 2p's worth: I think Enums are great, a good way to reduce complexity of the database, even if they are a MySQL only thing : ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Is there a way for $html- method return normal form names
Hi, I am trying to see if $html-selectTag or other other methods return a variable name that is not in the form of data[model][field] eg: input name='varname' value='somevalue'/ instead of input name='data[model][varname]' value='somevalue'/ In RoR, there is a input as well as inputTag to differentiate between the two output. Its easy putting the form tag directly for input ../, but its cumbersome to do the same thing for select and other tags. cheers =R --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Security Exploit.
Yes it seems CakePHP has picked up a security expert as this is the second update I have seen for CakePHP security fix. Very nice to have someone interested in CakePHP enough to find them AND report them in a manner that the developers can resolve it. I love CakePHP! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Need a Genius for this one!
Store the age in days/minutes/hours/seconds, and use a simple greater than less than query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Postgres and Model-del() problem
Hi, I had an application that was using Mysql as the database. We switched to Postgres cause of client's request. Then we started to have some problems with some delete operations. Taking a look at the model_php5.php class, I saw that there is: if ($this-id $db-delete($this)) { $this-_deleteMulti($id); $this-_deleteHasMany($id, $cascade); $this-_deleteHasOne($id, $cascade); $this-afterDelete(); $this-_clearCache(); $this-id = false; return true; } But this causes an error in my Postgres beacause this operation above tries to dele the entity berfore trying to delete the relations that depend on the entity. So we get FK constraint error when $db-delete($this) is executed, which seems natural to me. Shouldn't the order of these delete calls be changed? The $db-delete($this) call should not be the last one? tks []s Felipe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Postgres and Model-del() problem
Hmm, you might be right. Open a ticket at https://trac.cakephp.org and we'll take a look at it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: renderElement et son $params
Slight correction for the above: the file path would be /app/views/elements/test_element.thtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Is there a way for $html- method return normal form names
In short, the answer is no, since this defeats half the purpose of using the method in the first place. Can I ask if there's a particular reason why you'd want to do that? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Is there a way for $html- method return normal form names
Makes me think about the ugly word performance: * At which point will my helper methods in $html weigh me down more than they help me? * When will I have to write Javascript manually, to lessen the load? I have no numbers on how much $html weighs in terms of processing overhead. I have experienced no problems yet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: PHP 4.4.2 and MySQL 4.1.16.
Hey Sujith, http://www.php.net/ChangeLog-4.php#4.4.2 lists what's happened in the bugs list. Take a look at the things that are not listed as Fixed bug #. They aren't that many. Does any one of those impact your work? (Probably not, but check anyway, so you are sure.) Then, go grab latest 4.4.4 and smile. kind regards from one PHP dude to another, Olle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: PHP 4.4.2 and MySQL 4.1.16.
Also, older MySQL's parted in 3 groups: 3.23, 4.0 and 4.1. Those are the partitions, where useful new stuff's been added in. The documentation link uses them in a group (all-versions-less-than-5): http://dev.mysql.com/doc/refman/4.1/en/ You've got 4.1. One of the very useful releases. That means you're not hindered by the database version. So go grab the latest 4.1 you can get. -Olle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: renderElement et son $params
Thinking of the Element as its own little View can make things easier to grasp. A View underneath the View, so to speak. Just like the Controller assigns a few variables to its friend the View, the View can assign a couple of choice variables to its buddy, little Element. Elements and variables: on a purely need-to-know basis. The calling View decides what is good for Element to know about. -Olle --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Is there a way for $html- method return normal form names
Hey Olle, I don't quite follow what you mean about JavaScript, but as far as performance overhead, I really don't think there is that much in the helpers, since all they're doing is outputting data, with no large loops or decision-making code, so I seriously doubt performance is an issue there. On a side note, most helper methods now automatically output DOM ID's for any form elements, which, if anything, should make it easier to write JavaScript. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
i've looked in the sourcecode of htmlhelper. apparently if you didn't set an id yourself, the helper will always automatically set the id setting id to null will trigger the behaviour above, setting id to '' sets id to '' so we don't want that either :'( this really isn't fun, because i have several forms of the same type on 1 page. (eg many newsitems each with a reply-form) and thus, i have many elements with the same id in my xhtml code. if i don't want this, i have to type the html code manually instead of using the html helper.. that's a bit a stupid solution imo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
How to use a suffix ?
Hi, I've seen that in CodeIgniter you can use a suffix for all your urls, say: web.site.com/controller.html or web.site.com/controller/action.html or web.site.com/controller/action/param.html Is it possible in Cake ? Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Association Array Structure
Hi there, I'm joining a link table via bindModel to manipulate extra data in the link table. The php code below is called from the 'Quote' model. The associations before the bind are as follows: Quote belongsTo Customer Quote belongsTo User Quote HABTM StockedItem (link table 'items_quotes') Quote HABTM Service (link table 'items_services') ?php $this-bindModel(array( 'hasMany' = array( 'ItemsQuote' = array( 'fields' = 'quote_id, item_id, quantity, item_unit_price_quoted, item_discount_percent'; $quote_items = $this-findAll('Quote.id = ' . $quote_id); ? Gives the following, which is far too much info. I'm really only interested the 'ItemsQuote' array in lines 57 through 77. Array ( [0] = Array ( [Quote] = Array ( [id] = 21 [customer_id] = 99 [field1] = value1 [field2] = value2 [field3] = value3 [created] = 2006-08-15 04:29:02 [modified] = 2006-08-15 04:29:02 ) [Customer] = Array ( [id] = [account_number] = [first_name] = [field1] = [field2] = [field3] = [created] = [modified] = ) [User] = Array ( [id] = 1 [first_name] = Bob [last_name] = Byrne [username] = bobby [password] = bobbypass [type] = cashier ) // line 57 [ItemsQuote] = Array ( [0] = Array ( [quote_id] = 21 [item_id] = 2 [quantity] = 4 [item_unit_price_quoted] = 46.50 [item_discount_percent] = 10 ) [1] = Array ( [quote_id] = 21 [item_id] = 3 [quantity] = 63 [item_unit_price_quoted] = 44.00 [item_discount_percent] = 0 ) // Line 57 ) [StockedItem] = Array ( [0] = Array ( [id] = 1 [item_id] = 10009 [supplier_id] = 1 [quantity] = 10 [unit_price] = 46.50 [buy_price] = 46.00 [created] = -12-31 23:59:59 [modified] = -12-31 23:59:59 ) [1] = Array ( [id] = 2 [item_id] = 10009 [supplier_id] = 1 [quantity] = 15 [unit_price] = 45.50 [buy_price] = 41.00 [created] = -12-31 23:59:58 [modified] = -12-31 23:59:58 ) [2] = Array ( [id] = 3 [item_id] = 10009 [supplier_id] = 2 [quantity] = 20 [unit_price] = 44.00 [buy_price] = 40.50 [created] = -12-31 23:59:57 [modified] = -12-31 23:59:57 ) ) [Service] = Array ( ) ) ) The second method below gives me a smaller output buy in an awkward array structure. Method 2: ?php $quote_items = $this-ItemsQuote-findAll('quote_id = ' . $quote_id); ? Gives the following smaller array but the parent index is now numberic with a child index 'ItemsQuote'. Why doesn't this give the 'ItemsQuote' array structure as in lines 57 through 77 above? Array ( [0] = Array ( [ItemsQuote] = Array ( [quote_id] = 21 [item_id] = 2 [quantity] = 4 [item_unit_price_quoted] = 46.50 [item_discount_percent] = 10 [created] = 2006-08-30 15:36:10 [modified] = 2006-08-30 15:36:10 ) ) [1] = Array ( [ItemsQuote] = Array ( [quote_id] =
Re: Html helper emits id attribute that i don't want
Currently, the helpers do not support multiple form elements for a single field. We're working on a solution for this in Cake 1.2. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
and what's wrong with just not outputting an id attribute unless specified? (like is the usual approach for attributes, you have to specify them if you want them) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How to use a suffix ?
You could use regex and Routes \ mod_rewrite to accomplish this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Is there a way for $html- method return normal form names
For stuff I collect in forms that doesn't ever make it's way into a database I just use Misc/formfield. This way I know that $this-data['Misc'] contains all those non saved form entered values. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
It is auto outputting to aid in javascript and AJAX. Which is a little hiccup in this stage until 1.2 is releasing with the multiple form elements for a single field and auto id. For now you could modify the HTML helper yourself to not do the auto id. That is the best suggestion I can give. Probably something more elegant, but that does what you need until 1.2 is released. I personally love that the framework has taken the turn to closely start integrating AJAX and Web2.0 tiny helpers like making ids nice and pretty for us automatically. I would like to see the Event.Selector code make its way into Cake 1.2 for even prettier degrading. Also, which Event.Selector and the rules it would be possible for an end user with problems to switch off AJAX rather quickly since if the Event.Selector never starts up neither does AJAX. Isn't that nice!??!?! http://encytemedia.com/event-selectors/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Multiple File upload Flash
Okay I am integrating a Multiple File upload Flash applet into CakePHP. It is configurable to direct the uploaded files to a CakePHP url. Now, here is the line of code normally used by the script to get at the files uploaded. move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile) Is there a pretty way to do this same thing in CakePHP? I am pretty new to this POST upload of files so just looking to get some more information on the CakePHP way to do it since I couldn't really find much on this Group about it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: How to use a suffix ?
Yes, it is possible in Cake. In fact, with Cake 1.2, these extensions have semantic meaning which you can use to build custom APIs in your application. Read more here: http://cake.insertdesignhere.com/posts/view/2 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
[EMAIL PROTECTED] wrote: and what's wrong with just not outputting an id attribute unless specified? (like is the usual approach for attributes, you have to specify them if you want them) Yes, you're right: the usual, dumb, wasteful approach to coding is that you have to explicitly specify every little thing you want your program to do. If that's how you want to write your code, you should not, I repeat *not* use CakePHP. CakePHP does things like automatically generate DOM ID's for form inputs, because 99.9% of the time, that's exactly what I want it to do, so I'd rather it just do it, as opposed to me having to tell it to do it. That's called convention over configuration. If you *do not* want it to follow this default behavior (a.k.a. convention), you can *explicitly specify* something else. Like, for example, a custom DOM ID. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
[EMAIL PROTECTED] If it is really causing some problem or bothers you, but you still want to use Html helper,why not write a simple wrapper helper that strip out id attribute when you don't specify? class HtmlwrapperHelper extends Helper { var $helpers = Array(Html); function input($fieldName, $htmlAttributes = null, $return = false) { } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
Sorry, I accidentally sent in the middle.But anyway, do some checking on attributes and preg_replace the output from the Html helper.Would that be a bad practice, or fine approach in Cake?Sohei --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
On 9/18/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: and what's wrong with just not outputting an id attribute unlessspecified?(like is the usual approach for attributes, you have to specify them ifyou want them)Cake is not the usual approach. That is what makes it useful. There is nothing stopping your from creating your form without the use of the html helper to omit the id, or as suggested earlier in the thread, wrapping the html helper in your custom helper.Not including the id by default would cause people to have to write more code/configuration in other situations that differ from your special case. Special cases are treated as special cases for a reason.Please do not take shots at the work being done (for free in fact). Calling it stupid does not help. There is a lot of intelligent design work that has been done with Cake and chances are if it works one way there is a good reason for it. Ask for an explanation or help with a solution instead. If there is a bug it will be taken care of promptly if you submit it to trac. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Multiple File upload Flash
I use the following code to upload images. I madethe images file mandatory, so save() is invalidated if there is no images. I choose to store them in a directory named after the object's id. I dunno on what to extend the explanation, please tell. You'll find the file in $this-data['MyObject']['image']['tmp_name'] Also make sure your form contains the attribute: enctype=multipart/form-data olivvv function edit($id = null) { $img = ''; if (isset($this-data['Applicationimage']['image']['tmp_name'])) $img = $this-data['Applicationimage']['image']['tmp_name']; if (empty($this-data)){ if ($id) $this-data = $this-Applicationimage-read(null, $id); $this-set('applicationArray',$this-Applicationimage-Application-generateList()); }else{ if (!$id) if (($img == '') || (!$this-_isValidImage($img))) $this-Applicationimage-invalidate('Applicationimage/image'); if ($id) if ($img != '') if (!$this-_isValidImage($img)) $this-Applicationimage-invalidate('Applicationimage/image'); $this-cleanUpFields(); if ($this-Applicationimage-save($this-data)){ if ($img != ''){ if ($id) $this-_uploadfile($img, $this-imgpath.DS.'application'.DS.$id.'.jpg'); if (!$id) $this-_uploadfile($img, $this-imgpath.DS.'application'.DS.$this-Applicationimage-getLastInsertID().'.jpg'); } $this-flash('Votre image d\'application a eacute;teacute; modifieacute;e.','/applicationimages'); }else{ $this-set('applicationArray',$this-Applicationimage-Application-generateList()); if ($id) if ($img != '') if (!$this-_isValidImage($img))$this-set('imageerror', true); if (!$id) if ($img == '') $this-set('imageerror', true); } } } functions in app_controller :## function _selectedArray($data, $key='') { $array = array(); if(!empty($data)) { if ($key != ''){ foreach($data as $var) { $array[$var[$key]] = $var[$key]; } } else { foreach($data as $var) { $array[$var] = $var; } } } return $array; } function _isValidImage($tmp_name){ if (is_uploaded_file($tmp_name)) if (@getimagesize($tmp_name))return true; else return false; } function _uploadFile($tmp_name, $filename){ if (is_uploaded_file($tmp_name)){ if(file_exists($filename)) unlink($filename); move_uploaded_file( $tmp_name , $filename); return true; } else return false; } ## view file: ## h1Ajouter une image d'application:/h1 form action=?php echo $html-url('/applicationimages/edit/'.$html-tagValue('Applicationimage/id')); ? enctype=multipart/form-data method=post ?php //echo $html-formTag('/applicationimages/add') ? p ?php echo $html-tagErrorMsg('Applicationimage/name', 'Entrez le nom.'); ? Nom: ?php echo $html-input('Applicationimage/name', array('size'='40')); ? /p p ?php echo $html-tagErrorMsg('Applicationimage/image', 'Entrez l\'image.'); ? ?php if(isset($imageerror)) echo 'div class=errorChoisissez une image./div'? Image: ?php echo $html-file('Applicationimage/image'); ? /p ?php if(!empty($this-data['Applicationimage']['id'])){ ? img src=/phpThumb/phpThumb.php?src=/cakeimg/application/?php echo $this-data['Applicationimage']['id'] ?.jpgamp;w=200 width=200/ ?php } ? p Application: ?php echo $html-tagErrorMsg('Applicationimage/application_id', 'Choisissez une application.'); ? ?php echo $html-selectTag('Applicationimage/application_id', $applicationArray, null, null) ; ? /p p ?php echo $html-hidden('Applicationimage/id') ? ?php echo $html-submit('Save') ? /p /form [EMAIL PROTECTED] wrote: Okay I am integrating a Multiple File upload Flash applet into CakePHP. It is configurable to direct the uploaded files to a CakePHP url. Now, here is the line of code normally used by the script to get at the files uploaoded. move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile) Is there a pretty way to do this same thing in CakePHP? I am pretty new to this POST upload of files so just looking to get some more information on the CakePHP way to do it since I couldn't really find much on this Group about it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php
Re: Html helper emits id attribute that i don't want
Chris that is so funny that people fight something that would make over 90% of their programming lives MUCH easier. And for the 10% that you have to figure out how to make it do it the CakePHP way it would still be hard programming it the conventional way of configuration. It is just that by that time you are used to configuring everything so why not configure the 10% as well. CakePHP takes all that away and lets you JUST configure for the special cases. And isn't it nice that they made it with classes that you can extend the functionality and wrap your own code around it? How awesome!!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Future of the Internet
I am curious to see what other's think about this ... Where is the internet headed in the near future? It seems that recently there is a huge onslaught of community-based sites and digital music but it is definitely starting to fade ... why? You can thank News Corp, Time Warner and the other ad agencies that are monopolizing the internet by flooding it with their products by buying out as much as they can and then shoving it down your throat only to shove it back further after you already puked all over the keyboard. Remember back to the day when MP3.com was just independent musicians looking for a way to get their music heard? It was incredible to hear the talent out there ... where has it gone? I don't care about Ludacris or any other degenerate, uneducated imbecile turned millionaire overnight with a song that we are told to listen to by radio, TV and news (cough .. surprisingly all owned by the same people.. cough). With the latest debates and possible threats of removing net neutrality could possible mean that this problem isn't going away anytime soon! Where does the internet stand now? Is the only way to make a decent income on a site is holding out to sell-out to larger corporations? As a web developer this issue is a hot one because it essentially is my future. Ideas? Comments? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Setting a page id for static pages?
Hey, I know that I can specify a pageTitle and Layout in my view (and the PagesController doesn't upchuck it), but can I specify an ID attribute for an element outside my content_for_layout DIV? Specifically, I'd like to be able to add an ID to the page body from within the view itself. Ideas, pros/cons? Thanks! -Toby (bigClown) Parent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Multiple File upload Flash
Thanks for all that example code that helps to really reinforce things. So, what is the location of the file before you call the move_uploaded_file?? Is this an Apache setting? I guess I am just confused as to how it knows where to upload to on the server and then knows to retrieve it and then you have to move it from being uploaded to actual a place on your server. I guess that is a layer of security so that you can check it out for someone trying to hack by uploading malicious stuff. So, basically uploading files in a form I have to use the move_uploaded_file function. But I can wrap it around a function in my app_controller to use frequently. Amazing that I have done web programming for a couple years now and never had to tackle the whole upload a file thing huh? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Errorviews with Smarty View class ( 1.1 )
Hello there, I am using the Smarty View class ( 1.1 ) and i really like it. But when i encounter a error, say a missing model, i get a completly different error : === No template file for view %s (expected %s), create it first' Fatal error: in C:\xampp\eclipse\workspace\projectadmin\cake\libs\view\view.php on line 315 === I am using the app_controller way of setting smarty as the view: function __construct() { $this-view = 'Smarty'; parent::__construct(); } If i use the var $view = 'Smarty'; in the controller and not in the app_controller i do get nice errormessages in the default Cake style. But i would like to get it working the app_controller way :) The first thing i found out is that i could create a missing_model.tpl in a new app/views/errors directory wich display's the file instead of the 'no template file' error. After some testing i found out that the LIBS constant didnot contain the whole path. The APP has this path: C:\xampp\eclipse\workspace\projectadmin\app\ And the LIBS just : cake\libs\ (is this a cake bug, or is it meant to be like this?) I sortof fixed it by adding ROOT.DS. in front of LIBS. I now get the correct error message but not the pretty CAKE style or my own css, the path to the css is wrong ( eclipseprojectadmin//../css/default.css - /eclipse/projectadmin/pages/../css/default.css ) The fix i use is good enough for me while developping but if someone has got any ideas the get the errormessages to work better, it would be nice. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Errorviews with Smarty View class ( 1.1 )
I use var $view = 'Smarty'; in app_controller.php. This doesn't do any better than your results though. I have had limited success copying cake/libs/view/templates/errors to app/views. I have not taken the time to figure it out yet (on the bottom of a long list). Hope That Helps, David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Future of the Internet
Not really the place for this post, but I will answer first. I think the whole net neutrality thing is over hyped. I mean the basis of the whole argument is that the networks that maintain the cable lines that keep the internet together want reimbursement for their maintenance costs. And they are thinking these costs should be comiserate of the amount of traffic that they maintain on their lines. There isn't anything wrong with that. They are indeed the ones that are doing the work to keep the backbone of the internet working. So, the proposal is to make sure that they have a means to collect the money that is already owed to them. Now, from what I can tell if this isn't abused (which is the whole uproar from the net neutrality camp) it will work out fine and the increased costs on those that use a chunk of the network traffic won't get passed on to the end consumer. Now, if it is abused and things escalate out of control then the costs will be passed on and the internet will become like natural gas. Most people will have to revert back to dialup to afford the increased costs for those of us on broadband because of the bandwidth we are sucking up. So as far as net neutrality I don't think it is at jeopardy in the short term. I think for things to go haywire to the point where the people with the most money win internet bandwidth and the ability to spread their own personalized point of views is at least 25+ years away. That is assuming that the whole ability for backbone providers to collect money is abused. As for independent sites giving way to commercial giants. This is simply because the internet was still new. Keep in mind that broadband as a majority of users is only a couple years old. So, the internet as a real viable media outlet has only recently become available. Of course big business is going to find a way to market and make money. And of course people will sell out to big business. The internet isn't any difference than brick and mortar in that regard. The future of the net? I think the future of the net lies in it going back to it's roots. The blogs are the way of the future. Mass free speech with the ability to tack on Google Adwords to make money. Have something to write about that people want to check naturally the more Adwords will get used and the more money you make. Blog copyright, in my opinion, is the fastest growing entrepenurial market on the internet today. I only feel this is increasing in speed and will be a mainstay. The internet is a cycle. Something becomes popular in the community and big business rushes to capitalize on it and make money. That gives way to the next big thing. Community sites and media is it, big business is capitalizing. This is giving way to blog, and that soon will be big businesses. Stay on the cutting edge and you will be fine. Stagnate for one second and you will be swallowed up whole by big business. No different in the brick and mortar world. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Great Trading Site!!
Hi group,I have found a great site for buying, selling and trading. If you have ever used Ebay, this is a site you must check out.Not only can you buy sell stuff, but you can also barter trade stuff too! The site is http://www.mydrew.com Check it out! It's very cool!! P.S. Join my private network. Add my member name "traderdavid" to your private trading network and you can begin trading with everyone in my network. Or simply click on the registration link below and you will automatically be added to my private network: http://www.mydrew.com/register/registration.jsp?ref_id=1158163856410ref_user=traderdavidadd_user=i_list Get your email and more, right on the new Yahoo.com Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Login renders blank page!
I had the same problem here, with BOM bytes added to some files. Just to keep people aware, it ate my doctype declaration, thus, changing the way browsers interpreted the page, changing font sizes and all, paddings, etc. really weird. I had to open every file, since I didn't knew wich ones where causing the problem, and save them in Notepad++ without BOM. My question: is there any script or app that could strip thos BOM bytes from many files in different folders ? I googled and got nothing useful :\ (ps.: prefereably windows, but could be on *nix/osX) thanks! spark On 9/16/06, AD7six [EMAIL PROTECTED] wrote: Hi Baydel, Have you checked the case of your files? Give your subscription model files is named Subscription emphasis on the 'S', I would guess your home controller file is named Home_controller.php - you need everything lower case. The session error is caused by the space you have at the beginning of your subscription model file. If there is no visible space - you have a BOM (Byte Order Mark) which you need to remove. HTH, AD7six -- [web] http://synapsisdi.com.br [livesets] http://djspark.com.br/mp3 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Re: Login renders blank page!
http://www.xs4all.nl/~mechiel/projects/bomstrip/ has versions of the same thing in a ton of languages (not php thought ;) for utf8 you could do this probably if you have sed sed -i -s -e '1s/^\xef\xbb\xbf//' files On 9/18/06, DJ Spark [EMAIL PROTECTED] wrote: I had the same problem here, with BOM bytes added to some files. Just to keep people aware, it ate my doctype declaration, thus, changing the way browsers interpreted the page, changing font sizes and all, paddings, etc. really weird. I had to open every file, since I didn't knew wich ones where causing the problem, and save them in Notepad++ without BOM. My question: is there any script or app that could strip thos BOM bytes from many files in different folders ? I googled and got nothing useful :\ (ps.: prefereably windows, but could be on *nix/osX) thanks! spark On 9/16/06, AD7six [EMAIL PROTECTED] wrote: Hi Baydel, Have you checked the case of your files? Give your subscription model files is named Subscription emphasis on the 'S', I would guess your home controller file is named Home_controller.php - you need everything lower case. The session error is caused by the space you have at the beginning of your subscription model file. If there is no visible space - you have a BOM (Byte Order Mark) which you need to remove. HTH, AD7six -- [web] http://synapsisdi.com.br [livesets] http://djspark.com.br/mp3 -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Problem of using ereg_replace before saving data to database
Good day Guys n Gals. Lately I'm having a little bit problem of using ereg_replace before saving data to database. I have this category table and i want to replace white space with underscore. I have this fields on my database: Table_name: Category Fields: id, cat I've tried this code: if (!empty($this-data)) { $this-ereg_replace( , _, $this-data['Category']['cat'])); $this-save($this-data)); } But it doesn't work as expected. Need your help guys and gals --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem of using ereg_replace before saving data to database
if (!empty($this-data)){ $this-data['Category']['cat'] = str_replace( , _, $this-data['Category']['cat']); $this-save($this-data);}ereg_replace is not a method of a class it is a php function and for what your doing it is not very good function to use anyway -- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @accesspublic*/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Html helper emits id attribute that i don't want
Related to how the htmlHelper outputs tags, I just read a blurb about the tags.ini file at http://www.avatarfinancial.com /pages/cake/Here is the relevant infoCustomizing HTML generated by the Helper I needed to change the default option generated when I called $html-selectTag() to say something like Please Select rather than an empty space (default). I also wanted radio buttons to have labels so the user doesn't have to click exactly on the radio button itself but can instead click anywhere on the text associated with it. Create the file /app/config/tags.ini.php and add the following:; Tag template for a input type='radio' tag. radio = input type=radio name=data[%s][%s] id=%s %s /label for=""> ; Tag template for an empty select option tag. selectempty = option value= %s-- Please Select --/optionYou can get a full list of available tags in /cake/config/tags.ini.php. I wouldn't recommend modifying that file, however, because you could lose your changes when you upgrade CakePHP. So using this configuration file, you can change the convention and omit the id tag. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---