Re: slug of choice

2009-06-22 Thread Fran Iglesias


El 22/06/2009, a las 9:03, aman batra escribió:
 What should be the approach over this.. I m using the sluggable
 behavior to generate the slug for the post.

Perhaps...

- make the slug field editable in the ass/edit actions

- If the slug field is left blank by the user, create the slug  
programatically, and/or...
- Populate the slug file with the slugged title, if slug field is  
empty, using a javascript function

hth
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



slug of choice

2009-06-22 Thread aman batra

Hello,
I am using the title of any post to act as a slug for the post but now
I want to add a functionality that user can use anything he likes as
the slug of his post without changing the title of the post

For example :-

www.abcd.com/beautiful-life is the slug which gets generated now and
beautiful life is the title of the post.

I want to change it in the sense that the title of the post remains
beautiful life but the slug let's say i want it to be aman-batra
say on my name i.e www.abcd.com/aman-batra for that post.

What should be the approach over this.. I m using the sluggable
behavior to generate the slug for the post.

Thanks  Regards,
Aman Batra
--~--~-~--~~~---~--~~
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: slug of choice

2009-06-22 Thread aman batra

No, Actually what i was saying is that i generate slug with the Title
of the post. Now say i have another page from where i will redirect
user to the post action page by taking the name of the user. How can i
make the name as the Uid of the post and title remains unchanged as in
above example it remains beautiful life.

Thanks.

On Jun 22, 12:08 pm, Fran Iglesias cakephpi...@gmail.com wrote:
 El 22/06/2009, a las 9:03, aman batra escribió:

  What should be the approach over this.. I m using the sluggable
  behavior to generate the slug for the post.

 Perhaps...

 - make the slug field editable in the ass/edit actions

 - If the slug field is left blank by the user, create the slug  
 programatically, and/or...
 - Populate the slug file with the slugged title, if slug field is  
 empty, using a javascript function

 hth
--~--~-~--~~~---~--~~
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: view not echoing

2009-06-22 Thread dflow

i get

the hello echo
and underneath
Array
what should i see with the debug?

On Jun 22, 7:59 am, Pablo Viojo pvi...@gmail.com wrote:
 debug(...) is your friend! always!
 Saludos,

 Pablo Viojo
 pvi...@gmail.comhttp://pviojo.net
 (#260 y creciendo!)

 
 Ayudar nos hace felices!http://needish.com -http://helperman.org

 On Sun, Jun 21, 2009 at 6:23 PM, Miles J mileswjohn...@gmail.com wrote:

  Because Product does not exist.

  Its $products[0]['Product'];

  Its a multi array.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Media Plugin of David Persson

2009-06-22 Thread byqsri

This is the $validationErrors:

Array
(
[Photo] = Array
(
[file] = location
)

)


On 20 Giu, 15:36, davidpersson davidpers...@gmx.de wrote:
 Hi Marco,

 You did the right thing with changing the format of $this-data,
 because the hasOne Relationship needs it to be in that format.

 What kind of validation error do you get?

 -David

 On 18 Jun., 12:42, byqsri marco.rizze...@gmail.com wrote:

  is here someone can help me?

  On 15 Giu, 16:52, marco.rizze...@gmail.com

  marco.rizze...@gmail.com wrote:
   Hi
   I try to use MediaPlugin of David Persson.
   I have installed it I config it but when I tr8y test it using
   documentation (http://wiki.github.com/davidpersson/media/attachment-
   model ) but It doesn't work (the plugin doesn't save the attachment).
   My situation is:
   I have User model with :

           var $hasOne = array(
                   'Photo' = array(
                           'className' = 'Media.Attachment',
                           'foreignKey' = 'foreign_key',
                           'conditions' = array('model' = 'User'),
                           'dependent' = true,
                   )
           );

   In my controller I have:

                   $this-data = array(
                           'User' = array(
                                   'id' = 1
                           ),
                           'Photo' = array(
                                   0 = array('file' = 
   'http://cakephp.org/img/cake-logo.png',
   'model' = 'User')
                           )
                   );

                   $this-User-saveAll($this-data, array('validate' = 
   'first'));

   $this-data seems strange if I read from cake documentation  
   (http://book.cakephp.org/view/75/Saving-Your-Data)
   But if I set :

                   $this-data = array(
                           'User' = array(
                                   'id' = 1
                           ),
                           'Photo' = array(
                                   'file' = 
   'http://cakephp.org/img/cake-logo.png',
                                   'model' = 'User'
                           )
                   );
   I get an validation error from plugin
   I hope someone can help me
   Many Thanks
   Marco


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problems with saving data through an associated model

2009-06-22 Thread logout

Hi folks,

I have this problem:

When I save through the model like this:

$this-CurrencyRate-save($rate); (in the CurrencyRates controller)

I get this resulting SQL statement:

INSERT INTO `currency_rates` (`currency_id`, `rate`, `created`) VALUES
(10, 1.15, 'here goes the current timestamp and it's OK).

But when I try to save it through the associated model like this:

$this-Currency-CurrencyRate-save($rate); (in the Currencies
controller)

I get this resulting SQL statement:

INSERT INTO `currency_rates` (`created`, `currency_id`, `rate`) VALUES
('CURRENT_TIMESTAMP', 10, 1.15)

and the timestamp is set to zeroes in the database.

In both cases I do not set the 'created' field, it should be the
current timestamp and in the first case it works fine, but as you can
see, in the second case the value is wrong.

The model associations are OK - with $hasMany('CurrencyRate') in the
Currency model and $belongesTo('Currency') in the CurrencyRate model.

I can't figure out where the problem is. One solution is to set the
'created' field before saving the data and it works, but I am sure
there is an explanation for the above.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



make form at flash

2009-06-22 Thread taufiq ridha

Hello, guys...
anyone any advice for make login form with flash, and cake php,
or simple thing makes flash can POST some variable to cakephp?

Thanks for 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: set not working

2009-06-22 Thread andy

Is 'type' a possible value for $this-params['action']? Rather than
setting the 'test' variable, have you tried to echo something from
that action just to be sure the routing is correctly taking you to
there?

On Jun 21, 6:37 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote:
 When I use $this-set in my controller it doesn't seem to work, I
 think this could be due to my beforeFilter as I have it takes the
 current action, then checks the first variable to determine which view
 to show.

 function beforeFilter() {
                 if (in_array($this-params['action'],$this-actions)) {
                         if ( !( empty($this-params['pass'][0]) ) ) {
                                 $this-render(DS . 'admins' . DS . 
 $this-params['action'] . DS .
 $this-params['pass'][0]);
                         } else {
                                 $this-render(DS . 'admins' . DS . 
 $this-params['action'] . DS .
 'index');
                                                         }
                 }
         }

 My controller action looks like this. When I echo it in the view it
 says undefined variable, so could this be due to the way I have my
 beforeFilter set up?
 function type($load = null,$id = null) {
                 switch ($load) {
                         Case 'add':
                                 if(!empty($this-data)) {
                                         if($this-Type-save($this-data)) {
                                                 
 $this-Session-setFlash('Type has been saved.');
                                                 
 $this-redirect(array('controller'='admins','action'='type'));
                                         } else {
                                                 $this-Session-setFlash('An 
 error has occured in saving
 type.');
                                         }
                                 }
                                 $this-set('test','test');
                         break;
--~--~-~--~~~---~--~~
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: who is 'Cake' : some basic oop cake nonunderstanding

2009-06-22 Thread lefty

hi ken. yes it does :) thx
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



handling MySql errors

2009-06-22 Thread toka...@gmail.com

Hi, I am wondering how to handle and recognize MySQL type of
errors...in cake.

For EXAMPLE.. I have integrity checks (ON DELETE) designed on DB
server - when I do delete on some item who has its childs...it is not
allowed by DBso in debug mode in cake i get following..

 SQL Error: 1451: Cannot delete or update a parent row: a foreign key
constraint fails


if i turn off debug mode, i get only 404 Not Found page.



is cake able to recognize that error and display nice message like
using setFlash??  I would rather tell user than he cannot delete item
because it has childs connected to it instead of showing 404 page...
which is more confusing...


Thanks for help.
Tomas
--~--~-~--~~~---~--~~
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: Bootstrap variable

2009-06-22 Thread Stu

You could try:

define('site_new', '/'.$_SERVER[HTTP_HOST].'/abc');

or, I'm pretty sure you read config vars like this:

Configure::read('site_new');

http://book.cakephp.org/view/42/The-Configuration-Class#read-413

Good luck!
--~--~-~--~~~---~--~~
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: handling MySql errors

2009-06-22 Thread Richard
Hi - IMO, the best approach is to check for child records before you attempt
to delete the parent data. I would even go as far as doing this before even
rendering the delete link, preventing your end user trying to do something
they can't in the first place.

For what its worth, I personally preferring to validate actions before they
happen, rather than responding to errors as I've generally found this
approach saves me time in the long run. I do however, still use constraints
like this as a last-line of defense to protect against database corruption,
just in case :)

Hope this helps,
Richard

On Mon, Jun 22, 2009 at 1:35 PM, toka...@gmail.com toka...@gmail.comwrote:


 Hi, I am wondering how to handle and recognize MySQL type of
 errors...in cake.

 For EXAMPLE.. I have integrity checks (ON DELETE) designed on DB
 server - when I do delete on some item who has its childs...it is not
 allowed by DBso in debug mode in cake i get following..

  SQL Error: 1451: Cannot delete or update a parent row: a foreign key
 constraint fails


 if i turn off debug mode, i get only 404 Not Found page.



 is cake able to recognize that error and display nice message like
 using setFlash??  I would rather tell user than he cannot delete item
 because it has childs connected to it instead of showing 404 page...
 which is more confusing...


 Thanks for help.
 Tomas
 


--~--~-~--~~~---~--~~
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: Array Help

2009-06-22 Thread kdubya

Try something like this (assuming the two arrays you mentioned are
called $id and $percent respectively):

$combined = array();
foreach ($id as $key=$value) {
  $combined[$key] = array('id'=$value), 'percent'=$percent[$key]);
}
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



app cannot find CakePHP controller?

2009-06-22 Thread Ernesto

hello.

i'm getting a weird error that i can't resolve...

here's my routes.php config (comments removed)

?php

Router::connect('/', array('controller' = 'orders', 'action' =
'index'));

?

here's the response from mywebserver/ordersapp (app root)


Missing Controller

Error: CakePHPController could not be found.

Error: Create the class CakePHPController below in file: Cassonetti
\controllers\cake_p_h_p_controller.php

?php
class CakePHPController extends AppController {

var $name = 'CakePHP';
}
?

Notice: If you want to customize this error message, create Cassonetti
\views\errors\missing_controller.ctp


i have another app, configured the same way, that works like a charm.

i can't find where's the error :(
--~--~-~--~~~---~--~~
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: handling MySql errors

2009-06-22 Thread toka...@gmail.com

Hi Richard,
thanks for your post. Now I realize that it may be more user friendly
to not display that button and it will avoid all that stuff.

Thanks Tomas

On Jun 22, 3:04 pm, Richard rclay...@gmail.com wrote:
 Hi - IMO, the best approach is to check for child records before you attempt
 to delete the parent data. I would even go as far as doing this before even
 rendering the delete link, preventing your end user trying to do something
 they can't in the first place.

 For what its worth, I personally preferring to validate actions before they
 happen, rather than responding to errors as I've generally found this
 approach saves me time in the long run. I do however, still use constraints
 like this as a last-line of defense to protect against database corruption,
 just in case :)

 Hope this helps,
 Richard

 On Mon, Jun 22, 2009 at 1:35 PM, toka...@gmail.com toka...@gmail.comwrote:



  Hi, I am wondering how to handle and recognize MySQL type of
  errors...in cake.

  For EXAMPLE.. I have integrity checks (ON DELETE) designed on DB
  server - when I do delete on some item who has its childs...it is not
  allowed by DBso in debug mode in cake i get following..

   SQL Error: 1451: Cannot delete or update a parent row: a foreign key
  constraint fails

  if i turn off debug mode, i get only 404 Not Found page.

  is cake able to recognize that error and display nice message like
  using setFlash??  I would rather tell user than he cannot delete item
  because it has childs connected to it instead of showing 404 page...
  which is more confusing...

  Thanks for help.
  Tomas
--~--~-~--~~~---~--~~
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: Bootstrap variable

2009-06-22 Thread Stu

I know that you probably set that variable up in Bootstrap for a good
reason, but for Conventions over Configuration you should (if
possible) set this up in the app_controller:

$site_new = '/'.$_SERVER[HTTP_HOST].'/abc';
$this-set('site_new', $site_new);

--~--~-~--~~~---~--~~
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 tree's

2009-06-22 Thread Mech7

Is it possible to have multiple trees with the behaviour like doctrine
has:
http://www.doctrine-project.org/documentation/manual/1_1/en/hierarchical-data#nested-set:multiple-trees
--~--~-~--~~~---~--~~
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: tableCells and bgcolor doesn't work for me

2009-06-22 Thread nsens...@hotmail.com

I've tried in both ways and nothing happens, maybe I'm thinking that
I'm using the default cakephp template and it has its own styles, and
the new row style it's not recognize by cake

On Jun 19, 10:22 am, Rick will...@gmail.com wrote:
 Looking at the docs for $html-tableCells the call is expecting all of
 the table rows in one call.  (How else could it keep up with alternate
 row counts?)  From the manual:

 echo $html-tableCells(array(
     array('Jul 7th, 2007', 'Best Brownies', 'Yes'),         // row 1
     array('Jun 21st, 2007', 'Smart Cookies', 'Yes'),        // row 2
     array('Aug 1st, 2006', 'Anti-Java Cake', 'No'),         // row 3
 ));

 For your array something like this should work:

 table
 ?=
 echo $html-tableCells($autors, array ('bgcolor'='#FFCC99'));
 ?
 /table

 On Jun 18, 11:28 am, nsens...@hotmail.com nsens...@hotmail.com
 wrote:

  Hi, new at cakephp, so I'm trying with some tutorials, but using
  tablecells doesn't work with bgcolor, I get the table with rows and
  data but all rows are white, I mean odds and even rows are in same
  color, what I'm doing wrong?

  table
  ?php foreach($autors as $row) {
  echo $html-tableCells( array (  $row['Autor']['id'],
                                   $row['Autor']['nombre'],
                                   $row['Autor']['apellido'],
                                   $row['Autor']['fecha_nacimiento'],
                                   $row['Autor']['fecha_defuncion'] ) ,

                                   array ('bgcolor'='#FFCC99'));}
  ?
  /table

--~--~-~--~~~---~--~~
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: view not echoing

2009-06-22 Thread Pablo Viojo
try it!
debug($products);

Saludos,

Pablo Viojo
pvi...@gmail.com
http://pviojo.net
(#260 y creciendo!)


Ayudar nos hace felices!
http://needish.com  - http://helperman.org



On Mon, Jun 22, 2009 at 4:53 AM, dflow deeepf...@gmail.com wrote:


 i get

 the hello echo
 and underneath
 Array
 what should i see with the debug?

 On Jun 22, 7:59 am, Pablo Viojo pvi...@gmail.com wrote:
  debug(...) is your friend! always!
  Saludos,
 
  Pablo Viojo
  pvi...@gmail.comhttp://pviojo.net
  (#260 y creciendo!)
 
  
  Ayudar nos hace felices!http://needish.com -http://helperman.org
 
  On Sun, Jun 21, 2009 at 6:23 PM, Miles J mileswjohn...@gmail.com
 wrote:
 
   Because Product does not exist.
 
   Its $products[0]['Product'];
 
   Its a multi array.
 


--~--~-~--~~~---~--~~
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: open $html link in new window

2009-06-22 Thread Carlos Gonzalez Lavin
That's just cheating the validation... the idea of forcing links to open on
an external page breaks some usability/accesibility guidelines (specifically
the fact that the user should be the one deciding where he wants to opens
his links), which is why it was left out of the xhtml specification.

2009/6/20 brian bally.z...@gmail.com


 With jQuery, you can have outside links open in a new tab/window with this:

 $(function()
 {
$('a[href^=http]')
.not('[href*=' + window.location.hostname + ']')
.attr('target', '_new');
 });

 If you'd still prefer not polluting the DOM with that, you can instead
 explicitly create a new window (with dimensions, attributes, etc.)

 $(function()
 {
$('a[href^=http]')
.not('[href*=' + window.location.hostname + ']')
.click(function(e)
{
// new window code here

e.preventDefault();
});
 });



 On Sat, Jun 20, 2009 at 10:50 AM, Bankaihgnelso...@gmail.com wrote:
 
  How can you do this in a XHTML Strict environment? Target=blank doesn
  ´t validate.
  
 

 


--~--~-~--~~~---~--~~
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: Blog tutorial - I get a blank page

2009-06-22 Thread cshehadi


This was resolved finally.

the problem was that we still had an old rpm of mod_auth_mysql on our
RedHat ES 3 server.  Apparently this was causing some sort of conflict
with php 5.2.9.  I'm not entirely sure what the conflict is, but
removing the rpm from our system resolved the problem and CakePHP is
now working.

-Charlie

On Jun 2, 9:38 am, Marcelo Andrade mfandr...@gmail.com wrote:
 On Mon, Jun 1, 2009 at 12:43 PM, cshehadi csheh...@gmail.com wrote:

  For the record, yes, now that I check the server error logs (as
  opposed to the Virtual Host error logs) I see that there is a
  segmentation fault.  Not sure I've got the stomach for an apache/php
  reinstall on a busy server however.  Thanks for your help though.

 I don't know about your server profile to suppose what's the
 cause for that segmentation fault error.  But, if you're on a
 *nix host, you could also check the ulimit parameters for your
 server.

 http://linux.about.com/library/cmd/blcmdl1_ulimit.htm

 Best regards.

 --
 MARCELO DE F. ANDRADE
 Belem, PA, Amazonia, Brazil
 Linux User #221105

 http://mfandrade.wordpress.com
--~--~-~--~~~---~--~~
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: open $html link in new window

2009-06-22 Thread brian

On Mon, Jun 22, 2009 at 11:24 AM, Carlos Gonzalez
Lavincarloslavi...@gmail.com wrote:
 That's just cheating the validation... the idea of forcing links to open on
 an external page breaks some usability/accesibility guidelines (specifically
 the fact that the user should be the one deciding where he wants to opens
 his links), which is why it was left out of the xhtml specification.

Much of web development is finding and utilising a number of cheats.

--~--~-~--~~~---~--~~
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: view not echoing

2009-06-22 Thread brian

On Sun, Jun 21, 2009 at 1:20 PM, dflowdeeepf...@gmail.com wrote:

 i have done some tutorials
 the scaffold works fine

 when i want to create my own view
 nothing is echoed here is the controller:
 ?php
  class ProductsController extends AppController {
  var $name = 'Products';

  //var $scaffold;
  function index() {
 $this-set('products',$this-Product-find('all'));
 }
  }
  ?

 and the products/index.ctp view

 i get the hello and nothing blank screen with the default
 cake layout
 the code:
 ?php echo'hello';?

 html
  head
  titletest title/title
  /head
  body
  div id=container
  div id=content
 ?=$content_for_layout;?
 ?php echo $product['Product']['id']; ?
  /div
  /div
  /body
 /html


That looks more like a layout than a view. It should be like:

// view file -- index.ctp:
?php echo'hello';?
?php echo $product['Product']['id']; ?

// layout file -- default.ctp
html
 head
 titletest title/title
 /head
 body
 div id=container
 div id=content
?=$content_for_layout;?
 /div
 /div
 /body
/html

--~--~-~--~~~---~--~~
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: Array Help

2009-06-22 Thread Dave Maharaj :: WidePixels.com

Thanks... Works like a charm!

Had to change it to:
$combined = array();
foreach ($id as $key=$value) {
$combined[$key] = array('id'=$value ,
'percent'=$percent[$key]); 

}
  debug($combined);

Which makes;

Array
(
[0] = Array
(
[id] = 3
[percent] = 100
)

[1] = Array
(
[id] = 4
[percent] = 100
)
)
. And so on for each

How would I then use this array for pagination?

$data = $this-paginate('Job', array('Job.id' =  $combined ));



-Original Message-
From: kdubya [mailto:kenwin...@winanstech.com] 
Sent: June-22-09 10:45 AM
To: CakePHP
Subject: Re: Array Help


Try something like this (assuming the two arrays you mentioned are called
$id and $percent respectively):

$combined = array();
foreach ($id as $key=$value) {
  $combined[$key] = array('id'=$value), 'percent'=$percent[$key]); }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with Media Plugin of David Persson

2009-06-22 Thread davidpersson

Have a look at the Attachment Model's validation property.

To make http transfers work you must explicitly allow all http
transfers by specifying 'http://' in the location validation rule or -
if you only want to allow transfers from certain domains - use 'http://
example.org' instead.

  var $validate = array(
'file' = array(
  // ...
  'location' = array('rule' = array('checkLocation', array
(MEDIA_TRANSFER, '/tmp/', 'http://'))),
  // ...
  )
));

On 22 Jun., 12:00, byqsri marco.rizze...@gmail.com wrote:
 This is the $validationErrors:

 Array
 (
     [Photo] = Array
         (
             [file] = location
         )

 )

 On 20 Giu, 15:36, davidpersson davidpers...@gmx.de wrote:

  Hi Marco,

  You did the right thing with changing the format of $this-data,
  because the hasOne Relationship needs it to be in that format.

  What kind of validation error do you get?

  -David

  On 18 Jun., 12:42, byqsri marco.rizze...@gmail.com wrote:

   is here someone can help me?

   On 15 Giu, 16:52, marco.rizze...@gmail.com

   marco.rizze...@gmail.com wrote:
Hi
I try to use MediaPlugin of David Persson.
I have installed it I config it but when I tr8y test it using
documentation (http://wiki.github.com/davidpersson/media/attachment-
model ) but It doesn't work (the plugin doesn't save the attachment).
My situation is:
I have User model with :

        var $hasOne = array(
                'Photo' = array(
                        'className' = 'Media.Attachment',
                        'foreignKey' = 'foreign_key',
                        'conditions' = array('model' = 'User'),
                        'dependent' = true,
                )
        );

In my controller I have:

                $this-data = array(
                        'User' = array(
                                'id' = 1
                        ),
                        'Photo' = array(
                                0 = array('file' = 
'http://cakephp.org/img/cake-logo.png',
'model' = 'User')
                        )
                );

                $this-User-saveAll($this-data, array('validate' = 
'first'));

$this-data seems strange if I read from cake documentation  
(http://book.cakephp.org/view/75/Saving-Your-Data)
But if I set :

                $this-data = array(
                        'User' = array(
                                'id' = 1
                        ),
                        'Photo' = array(
                                'file' = 
'http://cakephp.org/img/cake-logo.png',
                                'model' = 'User'
                        )
                );
I get an validation error from plugin
I hope someone can help me
Many Thanks
Marco


--~--~-~--~~~---~--~~
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: conditions with date in hasMany

2009-06-22 Thread brian

You shouldn't have conditions in there. You're describing an
association between 2 models, not options for eg. pagination. Jobs
that are  2 weeks old should still be associated with Recruiter (I'm
guessing is the other model).

Put those conditions in the controller's $paginate var or whatever
find() call you're making where you only want new Jobs.

On Mon, Jun 22, 2009 at 12:10 PM, abest11abhishe...@gmail.com wrote:

 Hi,
 Im a newbie to Cake, so apologies in advance if this is a silly
 question.  I am trying to use a simple hasMany model association with
 a condition on a date field, so that only Jobs created in the last
 two weeks are returned.  In my model, I have:

 var $hasMany = array(
        'Job' = array(
                'className' = 'Job',
                'foreignKey' = 'recruiter_id',
                'conditions' = array(Job.created  = date('Y-m-d', 
 strtotime(-2
 weeks))),
        )
 );

 This is based off the manual Complex Find Conditions topic.

 For some reason, I keep getting the error
 Parse error: syntax error, unexpected '.', expecting ')' for the
 line which defines the conditions...

 I can't seem to figure out whats wrong with my syntax. Im using the
 latest version of Cake.

 Thanks!


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



conditions with date in hasMany

2009-06-22 Thread abest11

Hi,
Im a newbie to Cake, so apologies in advance if this is a silly
question.  I am trying to use a simple hasMany model association with
a condition on a date field, so that only Jobs created in the last
two weeks are returned.  In my model, I have:

var $hasMany = array(
'Job' = array(
'className' = 'Job',
'foreignKey' = 'recruiter_id',
'conditions' = array(Job.created  = date('Y-m-d', 
strtotime(-2
weeks))),
)
);

This is based off the manual Complex Find Conditions topic.

For some reason, I keep getting the error
Parse error: syntax error, unexpected '.', expecting ')' for the
line which defines the conditions...

I can't seem to figure out whats wrong with my syntax. Im using the
latest version of Cake.

Thanks!


--~--~-~--~~~---~--~~
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: conditions with date in hasMany

2009-06-22 Thread abest11

I understand that I can specify conditions when I do a find call.
But I want it to filter the associated model automatically.

If I am misunderstanding, can you explain what the use of the
'conditions' key is in the hasMany association as described here
http://book.cakephp.org/view/82/hasMany

On Jun 22, 6:41 pm, brian bally.z...@gmail.com wrote:
 You shouldn't have conditions in there. You're describing an
 association between 2 models, not options for eg. pagination. Jobs
 that are  2 weeks old should still be associated with Recruiter (I'm
 guessing is the other model).

 Put those conditions in the controller's $paginate var or whatever
 find() call you're making where you only want new Jobs.



 On Mon, Jun 22, 2009 at 12:10 PM, abest11abhishe...@gmail.com wrote:

  Hi,
  Im a newbie to Cake, so apologies in advance if this is a silly
  question.  I am trying to use a simple hasMany model association with
  a condition on a date field, so that only Jobs created in the last
  two weeks are returned.  In my model, I have:

  var $hasMany = array(
         'Job' = array(
                 'className' = 'Job',
                 'foreignKey' = 'recruiter_id',
                 'conditions' = array(Job.created  = date('Y-m-d', 
  strtotime(-2
  weeks))),
         )
  );

  This is based off the manual Complex Find Conditions topic.

  For some reason, I keep getting the error
  Parse error: syntax error, unexpected '.', expecting ')' for the
  line which defines the conditions...

  I can't seem to figure out whats wrong with my syntax. Im using the
  latest version of Cake.

  Thanks!
--~--~-~--~~~---~--~~
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: conditions with date in hasMany

2009-06-22 Thread brian

On Mon, Jun 22, 2009 at 12:44 PM, abest11abhishe...@gmail.com wrote:

 I understand that I can specify conditions when I do a find call.
 But I want it to filter the associated model automatically.

 If I am misunderstanding, can you explain what the use of the
 'conditions' key is in the hasMany association as described here
 http://book.cakephp.org/view/82/hasMany

It's just what you thought it was. That's new to me. It's not
something that makes any sense to me because the status of a Comment
or the date that a Job was created should not, IMHO, be the basis for
filtering an association between models. Personally, I think that,
while it may be a shortcut, it's wrong to filter like that in the
association. I guess the Cake devs feel otherwise.

So, ignore my other comment, if you like.

--~--~-~--~~~---~--~~
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: open $html link in new window

2009-06-22 Thread Carlos Gonzalez Lavin
Cheats against stuff that should work and doesn't (like IE css cheats),
that's all good (would be better to just throw IE away altogether... if
only), but IMO those guidelines were made by the w3c for a reason... it is
actually a bit annoying to have another tab open when the user prolly didn't
want to...

2009/6/22 brian bally.z...@gmail.com


 On Mon, Jun 22, 2009 at 11:24 AM, Carlos Gonzalez
 Lavincarloslavi...@gmail.com wrote:
  That's just cheating the validation... the idea of forcing links to open
 on
  an external page breaks some usability/accesibility guidelines
 (specifically
  the fact that the user should be the one deciding where he wants to opens
  his links), which is why it was left out of the xhtml specification.

 Much of web development is finding and utilising a number of cheats.

 


--~--~-~--~~~---~--~~
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: German Umlaut in form-end

2009-06-22 Thread Carlos Gonzalez Lavin
To be a bit more file text-encoding safe, u could use the html entity ouml;

2009/6/21 AD7six andydawso...@gmail.com




 On Jun 21, 5:50 pm, Braindead markus.he...@gmail.com wrote:
  Hi, how can I use a German Umlaut in form-end('Löschen')?

 You've accidentally pasted the answer in your question
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP Freelance Programmer opportunity (Argentina)

2009-06-22 Thread CONNAXIS - Santiago Pauni

Connaxis (http://www.connaxis.com) is looking for Senior CakePHP
programmers for a freelance project of up to 160 hrs., in Buenos Aires
to end August 1st 2009. The workplace would be our offices downtown,
and you should also have advanced experience with XHTML/CSS and
jQuery, and preferrably knowleadgable of performance/optimization for
high-traffic sites.

Please e-mail me your portfolio and/or CV directly (recruitment at
connaxis dot com) if you're interested, stating availability and
hourly based salary expectations.  Thanks!

--~--~-~--~~~---~--~~
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: make form at flash

2009-06-22 Thread Carlos Gonzalez Lavin
Of course it can, google as3 and urlrequest (which is a type of as3 object
used for this)... you pritty much just specify the url you're sending the
stuff to, the sending method (POST in this case), each var your sending and
the value.

2009/6/22 taufiq ridha taufiq.ri...@gmail.com


 Hello, guys...
 anyone any advice for make login form with flash, and cake php,
 or simple thing makes flash can POST some variable to cakephp?

 Thanks for 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: app attempting to insert records rather than update

2009-06-22 Thread Jon Chin
Thanks, Brian for all your input.  I agree, the code was pretty 
difficult to understand.  After spending tons of time staring at the 
code, I realized there was a simpler and more correct way to do it.  I 
rewrote it and it's working for the most part now.  I still have to work 
out a few kinks, though.


Jon Chin




brian wrote:

That's a bit difficult to follow. At what point are you calling
_processMerit()? And you have an empty block inside wizard()? Is that
on purpose?

You have a couple of instances with $this-Merit-save($this-data)
but I only see where you're reading data from the DB for Application.
hich model are you working with?

Sorry, I've never used the WizardComponent so this is a bit opaque to me.

On Sat, Jun 20, 2009 at 2:06 AM, Jon Chinj...@boogly.net wrote:
  

Here's the code.  I still can't get it to update rather than insert.
What am I doing wrong?

 function beforeFilter() {
   $this-Wizard-steps = array('profile', 'merit', 'finance',
'education', 'endorsement');
 }

 function wizard($step = null) {
 if(isset($this-passedArgs['1']) ||
$this-Session-read('application_id')) //if application already
defined, load it
 {
   //Ensure the user is authorized to edit the application
   if(isset($this-passedArgs['1']))
   {$this-Session-write('application_id', $this-passedArgs['1']);}
   $application =
$this-Application-findById($this-Session-read('application_id'));

   if($application['Application']['user_id'] ==
$this-Auth-user('id'))
   {
   }
   else
   {
 $this-Session-setFlash('You do not have authorization to
view this.');
 $this-Session-delete('application_id');
 $this-redirect('/applications');
   }

 }
 else //if not entering with previously started application, start one
 {
   //create application record
   $this-Application-create();
   $this-Application-save(array('user_id'=$this-Auth-user('id')));
   $this-Session-write('application_id',
$this-Application-getInsertID());
 }
   $this-Wizard-process($step);
 }

   function _processMerit() {
 App::import('Sanitize');
 Sanitize::clean($this-data);
 switch($this-params['form']['action'])
 {
   case 'Continue':
 if($this-Merit-save($this-data)) {
   return true;
 }
 else
 {
   $this-Session-setFlash('Sorry, the information you\'ve
entered is incorrect.');
   return false;
 }
 break;
   case 'Back':
 $this-redirect('/applications/wizard/profile');
 break;
   case 'Save':
 if($this-Merit-save($this-data)) {
   $this-Session-setFlash('Your changes have been saved.');
 }
 else
 {
   $this-Session-setFlash('Sorry, the information you\'ve
entered is incorrect.');
 }
 break;
 }
 return false;
   }

Jon Chin



brian wrote:


On Fri, Jun 19, 2009 at 2:04 AM, Jon Chinj...@boogly.net wrote:

  

Thanks for the tip.  Sadly, I'm still having problems with it.  When I
add ?=$form-input('id');? to the view, all it does is generate input
type=hidden name=data[Application][id] value= id=ApplicationId
/ which doesn't change anything in my controller when I print the
contents of $this-data.  I also tried making the field called
application_id in the form, but it didn't have an effect either.

It's really stumping me.  Any idea what's going on?  Since my primary
key on Merit is application_id, should Cake already know that if I'm
trying to set $this-Merit-id?




The PK for Merit should be id, not application_id. That should be
a foreign key pointing to applications table.

If you post the code for the controller action we might be able to sort it out.

  


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

  


smime.p7s
Description: S/MIME Cryptographic Signature


Re: automatically adding a

2009-06-22 Thread Carlos Gonzalez Lavin
Im a bit of a newbie to cake... but im guessing this could work after u save
the First:

$new_thing = array('Second' = array('first_id' = $this-First-id));
$this-Second-save($new_thing);
2009/6/19 lefty lu...@yoga-innsbruck.com


 how to automatically create() a thingy :)  in another model  ?

 Say you have 2 model classes, 'first'  'second', where the first
 hasmany of the second.
 BUT the first has to have at least one of the second - right from the
 start !
 How do you implement that ?

 maybe can you add that somehow using as a basis the following code -
 as simple as possible! :):)  ??  :

 class First extends AppModel {
var $name = 'First';
var $hasmany = array('Second');
 }
 class second extends AppModel {
var $name = 'Second';
var $belongsto = array('First');
 }

 class FirstsController extends AppController {

var $name = 'Firsts';

function add() {
if (!empty($this-data)) {
if ($this-First-save($this-data)) {
$this-Session-setFlash('Your First has been saved.
 and the 'first
 of the second' created :) ');
$this-redirect(array('action' = 'index'));
}
}
}

 class SecondController .
 naturally each where they belong.
 many thx

 


--~--~-~--~~~---~--~~
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 to something after successful login (like callback) ?

2009-06-22 Thread u2ix

 seehttp://book.cakephp.org/view/395/autoRedirect

 regards,

 AD
oh much thanks.
i wonder why I never saw that.
But now it works, wonderful
thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



pre production check off list

2009-06-22 Thread justclint

I remember seeing a check off list of things to do before making your
app live (ie: set degub to 0). But I cant seem to find it anymore. Can
some one point me in the right direction where this info is.

Thanks!

Clint
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Order by question

2009-06-22 Thread Dave Maharaj :: WidePixels.com

I have an array which I have re-ordered to meet the sites needs after a find
so it now looks like this:
Simply page Id's
Array
(
[0] = 4
[1] = 52
[2] = 50
[3] = 48
[4] = 43
[5] = 41
[6] = 38
[7] = 36
[8] = 16
[9] = 47
[10] = 46
[11] = 37
[12] = 32
[13] = 28
[14] = 27
[15] = 26
[16] = 25
[17] = 24
[18] = 22
[19] = 19
[20] = 18
[21] = 13
[22] = 6
[23] = 3
)
When I send this to paginate it still orders them by ID value by default so
the page renders not in the correct order, there is no field to order by so
I cant use that
Array
(
 = 3
 = 4
 = 6
 = 13
 = 16
.. And so on in numeric order
)

How can I set the order to remain as I sent it?
 
Dave 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



autocomplete result list scroll focus

2009-06-22 Thread Adriano Varoli Piazza

Using the ajax helper to provide an autocomplete list of results, and
giving a result list back as the rendered view, if you use the mouse
(and even the mouse wheel) to scroll results, all is well. Using the
arrow keys, on the other hand, has the nasty effect of awkwardly
scrolling the view: if I press down, the select box and the whole page
move to the bottom of the browser's view pane; pressing up has the
opposite effect of moving it to the top.

Has anyone else noticed this behaviour, and thought of something? the
resultant list is provided by, e.g.:
ul
?php foreach($peoples as $person): ?
li?php echo $person['Person']['id']; ?/li
?php endforeach; ?
/ul

(Just an example, I actually show the id, the name / surname /
commercial name).

The CSS for the list is as follows:

div.auto_complete {
position: absolute;
width: 250px;
background-color: white;
border: 1px solid #888;
margin: 0px;
padding: 0px;
}

div.auto_complete ul{
list-style: none;
margin: 0px;
}

--
Best regards,
Adriano
Adriania: http://adriania.blogspot.com
--~--~-~--~~~---~--~~
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: make form at flash

2009-06-22 Thread taufiq ridha

Hai carlos, can u give me something details info for do that,
some tutorial link maybe, that's will be great,
i don't know befor that is possible to make login form from flash, but
still used auth component from cakephp,

thanks

On Jun 23, 12:42 am, Carlos Gonzalez Lavin carloslavi...@gmail.com
wrote:
 Of course it can, google as3 and urlrequest (which is a type of as3 object
 used for this)... you pritty much just specify the url you're sending the
 stuff to, the sending method (POST in this case), each var your sending and
 the value.

 2009/6/22 taufiq ridha taufiq.ri...@gmail.com





  Hello, guys...
  anyone any advice for make login form with flash, and cake php,
  or simple thing makes flash can POST some variable to cakephp?

  Thanks for 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: make form at flash

2009-06-22 Thread taufiq ridha

Did it possible too, if we used for as2 carlos?

thanks
On Jun 23, 2:59 am, taufiq ridha taufiq.ri...@gmail.com wrote:
 Hai carlos, can u give me something details info for do that,
 some tutorial link maybe, that's will be great,
 i don't know befor that is possible to make login form from flash, but
 still used auth component from cakephp,

 thanks

 On Jun 23, 12:42 am, Carlos Gonzalez Lavin carloslavi...@gmail.com
 wrote:



  Of course it can, google as3 and urlrequest (which is a type of as3 object
  used for this)... you pritty much just specify the url you're sending the
  stuff to, the sending method (POST in this case), each var your sending and
  the value.

  2009/6/22 taufiq ridha taufiq.ri...@gmail.com

   Hello, guys...
   anyone any advice for make login form with flash, and cake php,
   or simple thing makes flash can POST some variable to cakephp?

   Thanks for 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: Dynamic use of MySQL views

2009-06-22 Thread VisionIzoizo

Adam, you genius, it works perfectly, thanks a lot!

Cheers to you man,
Mauro

On Jun 19, 2:32 am, Adam Royle a...@sleekgeek.com.au wrote:
 Does this work?

 $this-Item-setSource($locationId.'_items');

 Cheers,
 Adam

 On Jun 19, 12:43 pm, VisionIzoizo mauro.tr...@googlemail.com wrote:

  Hi, I have one big table named 'items'. It's split into manyviews,
  according to a custom defined criteria (location). I want to access
  theseviewsdynamically, I tried the 'useTable' property, but it
  doesn't work at all. This is my controller action:

          function listLocation($locationId)
          {
                  $this-Item-useTable = $locationId.'_items';
                  $this-Item-recursive = 0;
                  $this-set('items', $this-paginate());
          }

  Myviewsare named according to the location Id, i.e. 1_items,
  2_items, ...

  Is there any way to make this work?

  Thanks 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: transactions + redirect doesn't work!

2009-06-22 Thread Mateo San Román

Thank you for you quick answer.
Any way to do that operation in a standard way?

Thanks,
Mateo

On 22 jun, 00:45, Adam Royle a...@sleekgeek.com.au wrote:
 Yes. You must start and end atransactionwith the same mysql connection.
 MySQL connections are automatically closed once the page has finished
 executing. Aredirectstops the current page execution.

 Cheers,
 Adam

 - Original Message -
 From: Mateo San Román sanroma...@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Monday, June 22, 2009 2:49 PM
 Subject: transactions +redirectdoesn't work!

  Hello

  I have this code:

  function A () {
  $this-query('BEGINTRANSACTIONA');
   xxx
   xxx
   $this-redirect('/controller/B);
  }

  function B () {
  xxx
  xxx
  $this-query('COMMITTRANSACTIONA');
  }

  doesn't work  because there is a missing BEGINTRANSACTION

  However, if I use instead

  $this-query('BEGINTRANSACTIONA');
   xxx
   xxx
   $this-B();
  }

  It works somehow. Any ideas about this? Doesredirectautomatically
  shuts down existingtransaction?

  Thanks a lot
--~--~-~--~~~---~--~~
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: transactions + redirect doesn't work!

2009-06-22 Thread Marcel

Mateo San Román wrote:
 Thank you for you quick answer.
 Any way to do that operation in a standard way?


Depending on what you like to do put the SQL in a model. I think/hope 
that cake does not make new connections for each model method call ;)

--~--~-~--~~~---~--~~
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: German Umlaut in form-end

2009-06-22 Thread Mark

just encode all your templates with utf8
and you can normally type äöü etc

On 22 Jun., 19:37, Carlos Gonzalez Lavin carloslavi...@gmail.com
wrote:
 To be a bit more file text-encoding safe, u could use the html entity ouml;

 2009/6/21 AD7six andydawso...@gmail.com



  On Jun 21, 5:50 pm, Braindead markus.he...@gmail.com wrote:
   Hi, how can I use a German Umlaut in form-end('Löschen')?

  You've accidentally pasted the answer in your question
--~--~-~--~~~---~--~~
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: transactions + redirect doesn't work!

2009-06-22 Thread Adam Royle

What I am saying is you can't redirect to another page in the same 
transaction. If you really need to do something over multiple page loads, 
then you should save this data in temporary tables or in the session, and 
then add it all to the real tables on the final page. Transactions are meant 
to be kept as short as possible.

Cheers,
Adam

- Original Message - 
From: Mateo San Román sanroma...@gmail.com
To: CakePHP cake-php@googlegroups.com
Sent: Tuesday, June 23, 2009 7:02 AM
Subject: Re: transactions + redirect doesn't work!



Thank you for you quick answer.
Any way to do that operation in a standard way?

Thanks,
Mateo

On 22 jun, 00:45, Adam Royle a...@sleekgeek.com.au wrote:
 Yes. You must start and end atransactionwith the same mysql connection.
 MySQL connections are automatically closed once the page has finished
 executing. Aredirectstops the current page execution.

 Cheers,
 Adam

 - Original Message -
 From: Mateo San Román sanroma...@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Monday, June 22, 2009 2:49 PM
 Subject: transactions +redirectdoesn't work!

  Hello

  I have this code:

  function A () {
  $this-query('BEGINTRANSACTIONA');
  xxx
  xxx
  $this-redirect('/controller/B);
  }

  function B () {
  xxx
  xxx
  $this-query('COMMITTRANSACTIONA');
  }

  doesn't work because there is a missing BEGINTRANSACTION

  However, if I use instead

  $this-query('BEGINTRANSACTIONA');
  xxx
  xxx
  $this-B();
  }

  It works somehow. Any ideas about this? Doesredirectautomatically
  shuts down existingtransaction?

  Thanks a lot




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Breadcrumb doesn't show parent without specifying it

2009-06-22 Thread Sidney

Hi All,
After some searching and looking into the html crumbs helper source
code, it seems I totally misunderstood (and overestimated) the
functionality, and would just like to a) confirm I now understand
correctly now, and b) share this with any other misguided souls.

I thought that all that was needed was:
$html-addCrumb('Text', '/controller/action');  //anywhere in the view
echo $html-getCrumbs('  ', 'Home-text); // where I want crumbs to
appear

This works OK but only the Home-text and Text crumbs are rendered (2
crumbs). Echoing _crumbs confirms only these are in the array.

I thought that cake would automatically pick up the parent crumbs and
addCrumb would just add to that list i.e. each page only needed to add
itself to the list.

So now I :
$html-addCrumb('Parent', '/controller/actiona');  //anywhere in the
view - how to know what parent(s) to add?
$html-addCrumb('Parent1', '/controller/actionb');  //anywhere in the
view - how to know what parent(s) to add?
$html-addCrumb('Text', '/controller/action');  //anywhere in the view
echo $html-getCrumbs('  ', 'Home-text); // where I want crumbs to
appear - now renders 3 crumbs

This works and renders 4 crumbs.

I guess I could make this more flexible (e.g. by using referrer) but
that would just mean more testing!


So have I understood this correctly  - is this the correct way to use
the helper?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Code Snippets for Gedit

2009-06-22 Thread cem

Any one has the code snippets for Gedit ? I searched the interenet but
the only link I found is Broken .
And the site is down .
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Makes no sense

2009-06-22 Thread Dave Maharaj :: WidePixels.com

I am doing 2 things to an array:
combine 2 single arrays into one array matching up the keysworks perfect
 
then sort the combined array based on the percent
$combined = Set::sort($combined, '{n}.percent', 'DESC');
 
 
then extracting id in the sorted order from the combined array before
sending to paginate:
$newPosts = Set::extract($combined, '{n}.id'));
 
which returns the ID of the Post orderd from highest to lowest percentage
match
 
when i set $newPosts to paginate it automaticaly puts the $newPosts back
into the original order before i ordered themordering them by ID DES
which then i look at my posts page after the search and 
1st post has percentage match of 57%, 
2nd = 33%, 
3rd = 87%
 
when i set the array to be 87%, 57%, 33%
 
How can paginate not re-order the array? Percent is not a field so order by
does nothing because there is not percent field, percent is created whena
user does a search and results basedon what was found
SQL Error: 1054: Unknown column 'percent' in 'order clause'

Is there someway to stop paginate from automaticaly re-ordering my already
custom ordered array?
 
Dave 


--~--~-~--~~~---~--~~
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 cake bake,finding .profile file

2009-06-22 Thread keanoppy

 On the PC, it will depend on what console application you’re running
(e.g.,
C:\msys\1.0\etc\).

i'm using windows xp...can't find this .profile file to use the bake
feature
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
-~--~~~~--~~--~--~---



How to paginate w/ a hasMany condition

2009-06-22 Thread Kyle Decot

I am building a search form and I want the user to be able to select a
checkbox to only show results that has photos. My model uses a hasMany
= (Photo); How do I write my conditions array? I've tried the
following but get an Invalid use of group function.

$conditions [] = COUNT(Photo)  0;

$this-paginate(MyModel,$conditions);

--~--~-~--~~~---~--~~
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: Makes no sense

2009-06-22 Thread kdubya

Dave,

Keep in mind that Paginate is like doing a $this-Model-find(). The
options setup in the $paginate variable in the controller are setting
up the arguments to a find-like SQL query on your database. Every time
a new page is requested (by the user clicking on the next page link)
causes a new query to be run on the database. So any post-processing
you did on the results of the query once will need to be done again.

You might try setting up a afterFind() function in your Model but you
haven't posted enough actual code here for me to tell if this might
work.

You might consider storing the percent field in the Model (database).
Then Paginate will work.

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: Makes no sense

2009-06-22 Thread Dave Maharaj :: WidePixels.com

I actually added the percent to the db, but even though it works its not the
best solution as this is a search function so a user searches and the
results each get a percent inserted into the dbbut that seems like a lot
of overhead for the db...constantly updating the percent field every time a
search is run and results found for each post.

My code is just this from a tutorial
http://foldifoldi.com/news/?p=271

Except:

$jobs = array();
  foreach ($this-Job-find('all', $params) as $row) {
  array_push($jobs, $row['Job']['id']);
  $job_id = $row['Job']['id'];

$program_matches = count(array_intersect($this-data['Program']['Program'],
Set::extract($q, 'Program.{n}.id')));
  
  $language_matches =
count(array_intersect($this-data['Language']['Language'], Set::extract($q,
'Language.{n}.id')));
  
  $matches = $program_matches + $language_matches;
  
  $searchCount = $searchProgramCount + $searchLanguageCount;

  $percent = ceil(($matches / $searchCount) * 100);
  $this-Job-id = $q['Job']['id'];
  //debug($q['Job']['id']);
  $this-Job-saveField('percent', $percent);
  }

I would like to explore the idea of afterFind but that's new to me as I have
never used it yet.

Hw would I go about that?

-Original Message-
From: kdubya [mailto:kenwin...@winanstech.com] 
Sent: June-22-09 11:45 PM
To: CakePHP
Subject: Re: Makes no sense


Dave,

Keep in mind that Paginate is like doing a $this-Model-find(). The options
setup in the $paginate variable in the controller are setting up the
arguments to a find-like SQL query on your database. Every time a new page
is requested (by the user clicking on the next page link) causes a new query
to be run on the database. So any post-processing you did on the results of
the query once will need to be done again.

You might try setting up a afterFind() function in your Model but you
haven't posted enough actual code here for me to tell if this might work.

You might consider storing the percent field in the Model (database).
Then Paginate will work.

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: German Umlaut in form-end

2009-06-22 Thread Braindead

Thanks for the help. I guess it's a problem with the encoding, because
either Löschen nor Louml;schen work. :-(
--~--~-~--~~~---~--~~
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 app, Expiring logins help

2009-06-22 Thread Louie Miranda
Guys,

Where do I need to place a filter that if...

if ($username == OK) {
 if ($expiration  date_required) {
   proceed
  } else {
   issue error
  }
} else {
 invalid login
}

Will I place this on the app_controller.php? and use beforefilter() ?

--
Louie Miranda (lmira...@gmail.com)
http://www.louiemiranda.net

Quality Web Hosting - www.axishift.com
Pinoy Web Hosting, Web Hosting Philippines

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---