Re: Data cleanup in Model

2007-03-26 Thread ianh

Hi,

I agree that data cleaning and sanitization is best kept out of the
controller and in the model. However, before I present my solution and
for the sake of completeness, there are two functions,
sanitize::paranoid and sanitize::cleanArray that work from the
controller. I and others have found that cleanArray is useful but
limiting, e.g. it strips characters from email addresses and phone
numbers and doesn't seem to protect against JS code. Paranoid is
perfect but is only useful on a var by var basis from the controller.

So, my solution to clean up data before save is as follows:

1) In appModel put the function found at http://pastebin.co.uk/12244

2) Still in appModel put the following function:

/*
 *  Calls the global sanitize method and sanitizes data via paranoid.
 *  Allowed Chars passed in via an allowedChars array in individual
models
 *  @return must return boolean true otherwise save execution will abor
 **/
function beforeValidate()
{
$this-__sanitize($this-data);
return true;
}

3) So now, your app will run each item of a $this-data array through
sanitize::paranoid() and will strip out everything except alphanumeric
characters. I operate on the basis that you should remove everything
and then create a whitelist of allowed characters for each field in
your model. To do this, in each model create a protected array called
$allowedChars as follows:

protected $allowedChars = array();

If you have two fields in your model, lets say an ID and an email, you
would want only numbers in the ID field but the email field should
contain the special characters @, ., -, _. To do this, your
$allowedChars would appear as:

protected $allowedChars = array('email' = array('@', ',', '.', '-',
'_'));

Effectively the second array in $allowedChars is the second var of the
sanitize::paranoid function.

If you look carefully at my __sanitize function you will see there are
some shortcuts, called 'default', 'datetime', 'markdown' and
'textarea'. These contain pre-written groups of allowed characters. So
for a datetime field (not created or modified, you don't need to do
anything with those) you could write your $allowedChars array as:

protected $allowedChars = array('date' = array( 'datetime'));

You can combine characters and shortcuts as well, e.g.

protected $allowedChars = array('date' = array( 'datetime', '@',
'markdown', '-', '/'));

What do people think of that type of approach? One important note,
this does not clean up inputs used for search or filtering and you
would need to call paranoid for those inputs. I am working on a
beforeFind version of the above but it is not so quick.

HTH, Ianh

On Mar 24, 7:45 am, Michael Tuzi [EMAIL PROTECTED] wrote:
 I thought that data cleaning should be done prior to a save, so I
 tried using stripAll in the model as follows:

 function beforeSave()
 {
 require_once('sanitize.php');
 $cleaner = new Sanitize();

 $profile = $this-data;
 $fields['Profile'] = $this-getColumnTypes();
 foreach ($fields['Profile'] as $k = $v)
 {
 if (isset($profile['Profile'][$k]))
 {
 if (($v == 'string') || ($v == 'text'))
 {
 $fields['Profile'][$k] = 
 $this-RequestHandler-stripAll[$profile['Profile'][$k]];

 }
 else
 {
$fields['Profile'][$k] = $profile['Profile'][$k];
 }
 }
 else {
 $fields['Profile'][$k] = '';
 }
 }
 $cleaner-cleanArray($fields);
 }

 But I get this warning:
 Undefined property: Profile::$RequestHandler, because the components
 array isn't defined in the model. It's in the controller. Any
 suggestions on how I might move some of this cleaning work out of the
 controller?

 Thanks in advance,

 Michael Tuzi


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



where to put my functions ?

2007-03-26 Thread feelexit

in the posts_controller.php file,  I have a function called  funcation
add() to add new posts.  inside add function, i want to call another
function checktags(), where do i write this function.  I place it in
the posts_controllers.php file, and get this error  message.

Fatal error: Call to undefined function checktag() in D:\AppServ\www
\blog\resourceforge\app\controllers\posts_controller.php on line 35

btw, what does components (the one inside controller folder) do?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



1.2 ready?

2007-03-26 Thread R. Rajesh Jeba Anbiah

I'm fairly new here (except that I did lurk in the early stage).
I'd like to know if 1.2 is really ready? I don't seem to find good
plugins/articles based on 1.2. TIA.

--
  ?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



R: where to put my functions ?

2007-03-26 Thread m.sbragi

hello  feelexit
Are you calling your function like this?

function checktags() {
return 'Bravo!';
}

function add() {
  $retVal = $this-checktags();
}

 -Messaggio originale-
 Da: cake-php@googlegroups.com 
 [mailto:[EMAIL PROTECTED] Per conto di feelexit
 Inviato: lunedì 26 marzo 2007 10.46
 A: Cake PHP
 Cc: [EMAIL PROTECTED]
 Oggetto: where to put my functions ?
 
 
 in the posts_controller.php file,  I have a function called  funcation
 add() to add new posts.  inside add function, i want to call 
 another function checktags(), where do i write this function. 
  I place it in the posts_controllers.php file, and get this 
 error  message.
 
 Fatal error: Call to undefined function checktag() in 
 D:\AppServ\www 
 \blog\resourceforge\app\controllers\posts_controller.php on line 35
 
 btw, what does components (the one inside controller folder) do?
 
 
  


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: R: where to put my functions ?

2007-03-26 Thread feelexit

hi, M.  thanx.

I am using
echo checktags(); this gives me error.

after I change it to
echo  $this-checktags();
it works now.. thanx alot.



On Mar 26, 6:02 pm, [EMAIL PROTECTED] wrote:
 hello  feelexit
 Are you calling your function like this?

 function checktags() {
 return 'Bravo!';

 }

 function add() {
   $retVal = $this-checktags();

 }
  -Messaggio originale-
  Da: cake-php@googlegroups.com
  [mailto:[EMAIL PROTECTED] Per conto di feelexit
  Inviato: lunedì 26 marzo 2007 10.46
  A: Cake PHP
  Cc: [EMAIL PROTECTED]
  Oggetto: where to put my functions ?

  in the posts_controller.php file,  I have a function called  funcation
  add() to add new posts.  inside add function, i want to call
  another function checktags(), where do i write this function.
   I place it in the posts_controllers.php file, and get this
  error  message.

  Fatal error: Call to undefined function checktag() in
  D:\AppServ\www
  \blog\resourceforge\app\controllers\posts_controller.php on line 35

  btw, what does components (the one inside controller folder) do?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread francky06l

You can use a hack to format the tags using an indice ... such as
['model'][0]['Name'], ['model'][1]['Name] etc ...

You can use :  'Model/'.$indice.'][fieldname' into the tag name to
produce the above format ..

On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote:
 I know how to do in PHP,
 but I have no idea how to work it on cakePHP

 e.g.
 I have a table of products,
 and I will list all the products in one form , one page,

 -Name, Desc, Qty, Price, Total
 -Name, Desc, Qty, Price, Total
 -Name, Desc, Qty, Price, Total
 -Name, Desc, Qty, Price, Total

 user will input the Qty in the form, and once he submitted into
 server
 it will save into invoice database

 BUt how can cake handle the name in Multi-Row
 and direction will help .

 Thanks


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



e - the textmate on windows

2007-03-26 Thread purepear

Just check it.. you'll love it.

http://www.e-texteditor.com/

While i was waiting InType to gain some speed and development i found
e-texteditor which saved my day :P


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread Diona K

What a timely post! I'm doing the same thing...showing a table of data
and allowing the user to edit it. By using this 'hack' will CakePHP
handle the insert without any additional considerations?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



PHPmailer

2007-03-26 Thread Enchy

Hi

I installed phpmailer

Calling it like the tutorial says:
  vendor('phpmailer/class.phpmailer');

And then error:
Call to undefined function: addaddress() in /usr/www/users/struts/cake/
app/controllers/hunters_controller.php on line 37

line 37:
 $this-Mailer-AddAddress('[EMAIL PROTECTED]');

I can't figure out why.  I coppied phpmailer to vendors??
Also tried copying it to both vendors directories.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: PHPmailer

2007-03-26 Thread Daniel Pape
Is $this-Mailer an instance of class.phpmailer??



2007/3/26, Enchy [EMAIL PROTECTED]:


 Hi

 I installed phpmailer

 Calling it like the tutorial says:
   vendor('phpmailer/class.phpmailer');

 And then error:
 Call to undefined function: addaddress() in /usr/www/users/struts/cake/
 app/controllers/hunters_controller.php on line 37

 line 37:
 $this-Mailer-AddAddress('[EMAIL PROTECTED]');

 I can't figure out why.  I coppied phpmailer to vendors??
 Also tried copying it to both vendors directories.


 


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: PHPmailer

2007-03-26 Thread Brian Dailey

You won't need to use $this- when calling it from a controller.

You'll probably need to do something like:

$mailer = new Mailer;
$mailer-AddAddress('[EMAIL PROTECTED]');

I suggest brushing up on PHP OOP techniques. The book PHP 5 Objects,
Patterns, and Practice by Zandstra is a great way to familiarize
yourself with this sort of thing. I promise it will make your life a
lot easier when you attempt to develop programs in CakePHP.


On 3/26/07, Daniel Pape [EMAIL PROTECTED] wrote:
 Is $this-Mailer an instance of class.phpmailer??



 2007/3/26, Enchy [EMAIL PROTECTED]:
 
  Hi
 
  I installed phpmailer
 
  Calling it like the tutorial says:
vendor('phpmailer/class.phpmailer');
 
  And then error:
  Call to undefined function: addaddress() in /usr/www/users/struts/cake/
  app/controllers/hunters_controller.php on line 37
 
  line 37:
  $this-Mailer-AddAddress('[EMAIL PROTECTED]');
 
  I can't figure out why.  I coppied phpmailer to vendors??
  Also tried copying it to both vendors directories.
 
 
 


  


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread dima

You would have to use a custom model to overwrite some functionality
(cake 1.x):
E.g

class MyHtml extends Html
{
   ...
   function setFormTag($tagValue) {
  $parts = explode(/, $tagValue);

  $this-model = $parts[0];
  $this-field= array_pop($parts);

  // We add a class attribute to indicate the index of the model
  if (count($parts)  1)
 $this-modelIndex = $parts[1];
  else
 $this-modelIndex = null;
   }

   ...
   function tagValue($fieldName) {
  $this-setFormTag($fieldName);
  if ($this-modelIndex !== null)
  {
 // This assumes that your data is like so:
 // data = array('Model'=array(array('Model'=array(/* data
*/; // Default cake
 // which can be obtained with $this-data['Model'] = $this-
Model-findAll();

 if (isset($this-params['data'][$this-model][$this-
modelIndex][$this-model][$this-field])) {
return h($this-params['data'][$this-model][$this-
modelIndex][$this-model][$this-field]);
 } elseif(isset($this-data[$this-model][$this-modelIndex]
[$this-model][$this-field])) {
return h($this-data[$this-model][$this-modelIndex]
[$this-model][$this-field]);
 }
  }
  else
  {
 return parent::tagValue($fieldName);
  }
   }
   ...
}


In your view, you can then do the following:

?php foreach ($this-data['Product'] as $i = $rec) : ?

  tr
 td?= $rec['Product']['name'] ?/td
 td?= $myhtml-input(Product/$i/qty) ?/td
  /tr

?php endforeach; ?

Please note that this code was not tested.
Also, the id of your input will become Product0Qty, Product1Qty, etc.

Please contribute your final solution. There are many with the same
issue :S.

Thanks.

Dimitry Z


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Links and Images with correct path from pure html

2007-03-26 Thread korcs

Hi Bakers,

I am working on a refactoring project for an existing cms andI have
decided to make it using cake.

The CMS has an existing database with
thousands of articles, stored basically as HTML code, where all the
links and images appear as HTML tags like href..., or img...with
relative links. (f.e.img src=uploads/news/images/test.jpg).

I want to implement the editing function of the new cake based CMS by
using tinyMCE and faced the problem that it is quite a hard nut to get
my images and links displayed correctly at the front end.

I think that the solution should be to parse the html code before
displaying and replace the img...or href...tags using the html
helper.
This would be a solution for displaying the images and links when
viewing a page, but I am afraid that this still don't solve the
problem, that the images are not showing up in the tinyMCE editor
while editing...

If someone already had the same problem and has a baked solution,
would be great if he would share it with me and other bakers who are
struggeling with the this issue.

Thanks,

korcs


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Links and Images with correct path from pure html

2007-03-26 Thread dima

Korcs,

Thanks for re-posting on the Group :)

Could you provide some additional code?

From what I can tell, you would need a custom helper like so:

class CustomHelper
{
   function parseAnchors($content)
   {
  // Replaces all anchors locations to an absolute value.
  return preg_replace_callback('href=([^]+)', array($this,
'__parseAnchorsCallback'));
   }

   function __parseAnchorsCallback($matches)
   {
  // $this-siteRoot is the absolute path of your pages.
  // e.g. / or http://domain.com/
  return 'href=' . $this-siteRoot . $matches[1] . '';
   }

   function linkToImage()
   {
  // Same as for the anchors, but with a different root...
   }
}

And in your view, you would do something like so

textarea?= $custom_helper-parseAnchors($this-data['Page']
['content']) ?/textarea

But from what you've written, you are already doing this (?)

Dimitry Z.


On Mar 26, 12:07 pm, korcs [EMAIL PROTECTED] wrote:
 Hi Bakers,

 I am working on a refactoring project for an existing cms andI have
 decided to make it using cake.

 The CMS has an existing database with
 thousands of articles, stored basically as HTML code, where all the
 links and images appear as HTML tags like href..., or img...with
 relative links. (f.e.img src=uploads/news/images/test.jpg).

 I want to implement the editing function of the new cake based CMS by
 using tinyMCE and faced the problem that it is quite a hard nut to get
 my images and links displayed correctly at the front end.

 I think that the solution should be to parse the html code before
 displaying and replace the img...or href...tags using the html
 helper.
 This would be a solution for displaying the images and links when
 viewing a page, but I am afraid that this still don't solve the
 problem, that the images are not showing up in the tinyMCE editor
 while editing...

 If someone already had the same problem and has a baked solution,
 would be great if he would share it with me and other bakers who are
 struggeling with the this issue.

 Thanks,

 korcs


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Bakery Article

2007-03-26 Thread Erich C. Beyrent

I am trying to add a new article to the Bakery, but there are no 
categories.  The article cannot be submitted without a category, so I'm 
stuck.

Can the person/people who maintain the Bakery take a look at this?

-Erich-

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



one to one relationship (ADD)

2007-03-26 Thread christianandradet

hi,
i am traing to insert data with a one to one relationship, i am
working with this tables:
 CREATE TABLE 'people` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `lastname` varchar(40) NOT NULL,
  `firstname` varchar(40) NOT NULL,
  PRIMARY KEY  (`id`) )

 CREATE TABLE `judges` (
  `person_id` smallint(5) unsigned NOT NULL,
  `location_id` smallint(5) unsigned NOT NULL,
  `flavor` enum('USDJ','USMJ') default 'USDJ' )

in the people controller:
 var $hasOne = array('judge' = array('className'= 'judge',
  'conditions'   = '',
  'order'= '',
  'dependent'=  true,
  'foreignKey'   = 'person_id'
)
  );

but i don't know how to insert data in both tables at the same time,
how do i configure the add method??? (i can list both tables)


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread cc96ai

I cant generate this kind of format ['model'][0]['Name'], ['model'][1]
['Name]

but I m trying to put the id into tag name

$html-input(product/qty.$product['Product']['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?hl=en
-~--~~~~--~~--~--~---



one to one relationship (ADD)

2007-03-26 Thread christianandradet

hi,
i am traing to insert data with a one to one relationship, i am
working with this tables:
 CREATE TABLE 'people` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `lastname` varchar(40) NOT NULL,
  `firstname` varchar(40) NOT NULL,
  PRIMARY KEY  (`id`) )

 CREATE TABLE `judges` (
  `person_id` smallint(5) unsigned NOT NULL,
  `location_id` smallint(5) unsigned NOT NULL,
  `flavor` enum('USDJ','USMJ') default 'USDJ' )

in the people controller:
 var $hasOne = array('judge' = array('className'= 'judge',
  'conditions'   = '',
  'order'= '',
  'dependent'=  true,
  'foreignKey'   = 'person_id'
)
  );

but i don't know how to insert data in both tables at the same time,
how do i configure the add method??? (i can list both tables)


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



phpGACL

2007-03-26 Thread Michael Tuzi

I'd like to use this, but I can't figure out how to access MySQL,
because the database is running on a non-standard port. With CakePHP,
I can define the host as hostname:port, but this doesn't work with the
plugin. It's using ADOdb, and I can't seem to define a port using any
of the included drivers.

Thanks,

Michael Tuzi


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Strange problem with $javascript in renderElement

2007-03-26 Thread Siegfried Hirsch
Hello,

I have a strange problem. Developing in Win2k with php5 eveything is
working.
But porting to Linux with php4, I get an error when calling
$javascript-link(...);
in a renderElement('header');
First I thought it could be the readerElement, which has problems, but
putting
the same code into the layout, brings the same problem:
*Fatal error*: Call to a member function on a non-object in *
//htmlheader.ctp* on line *34*

So, has anybody expirience the same problem. Keep in mind, that everything
is
working on the windows machine (both sides apache 2.x).

Thanks for any suggestions

Siegfried

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Bakery Article

2007-03-26 Thread gwoo

Please submit bug reports to https://trac.cakephp.org/newticket.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



problem with hasOne

2007-03-26 Thread salimk786

My problem is that every time i update my profile, it does an insert
instead of an update sql command. Is my associations incorrect ?

Thanks.

class Member extends AppModel
{
var $name = 'Member';
var $hasOne = array('Profile' =
array('className'= 'Profile',
  'conditions'   = '',
  'order'= '',
  'dependent'=  true,
  'foreignKey'   = 'member_id'
)
  );
}
--
class Profile extends AppModel {
var $name = 'Profile';
var $belongsTo = array('Member' =
   array('className'  = 'Member',
 'conditions' = '',
 'order'  = '',
 'foreignKey' = 'member_id'
   )
 );
}
-
function editprofile()
{
if (empty($this-data))
{

$this-set('attribute_id_activitylevel',$this-Attribute-
generateList(array('name' = 'ActivityLevel'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));
$this-set('attribute_id_appearance',$this-Attribute-
generateList(array('name' = 'Appearance'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));

$this-set('attribute_id_attractivefeatures',$this-Attribute-
generateList(array('name' = 'AttractiveFeatures'), 'id ASC', 0,
'{n}.Attribute.id', '{n}.Attribute.value'));
$this-Member-id = $this-Authentication-getId();
$this-set('data', $this-Member-read());
$this-render();
}
else
{
if ($this-Profile-validates($this-data))
{
$this-Member-id = 
$this-Authentication-getId();
$this-data['Profile']['member_id'] = 
$this-Authentication-
getId();
$this-Profile-save($this-data);
die;
}
else
{
$this-validateErrors($this-Profile);
$this-render();
}
}
}


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Bakery Article

2007-03-26 Thread Erich C. Beyrent


Forbidden

TICKET_CREATE privileges are required to perform this operation

TracGuide — The Trac User and Administration Guide


gwoo wrote:
 Please submit bug reports to https://trac.cakephp.org/newticket.
 
 
  

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: Bakery Article

2007-03-26 Thread Mariano Iglesias

This is the problem we discussed gwoo. Should be fixed today.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de gwoo
Enviado el: Lunes, 26 de Marzo de 2007 02:27 p.m.
Para: Cake PHP
Asunto: Re: Bakery Article

Please submit bug reports to https://trac.cakephp.org/newticket.



--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread [EMAIL PROTECTED]

Another method that was referenced in this group a while back was to
use tags like
['model0']['Name']
['model1']['Name']

Then in your controller, dynamically create a new model for each
'modelX' that you have and validate() it and then save() it.
This way you also get the proper validation messages passed back from
the model to the view fields.

I created a component to automatically convert the findAll() results
array to this format for the view, and back to the multiple models and
did the saves automatically.

All you have to do is a multiModel-get() before your view and then a
multModel-save() call to do your saves.

I also created a helper to take this model and create the form fields
needed to make an editable grid in the view.

I tried to create an article in the Bakery for it, but I could not
submit it because of the bugs in the Bakery.

I may try again - or just post it here if there is interest.


Steve Truesdale



On Mar 26, 8:57 am, francky06l [EMAIL PROTECTED] wrote:
 You can use a hack to format the tags using an indice ... such as
 ['model'][0]['Name'], ['model'][1]['Name] etc ...

 You can use :  'Model/'.$indice.'][fieldname' into the tag name to
 produce the above format ..

 On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote:

  I know how to do in PHP,
  but I have no idea how to work it on cakePHP

  e.g.
  I have a table of products,
  and I will list all the products in one form , one page,

  -Name, Desc, Qty, Price, Total
  -Name, Desc, Qty, Price, Total
  -Name, Desc, Qty, Price, Total
  -Name, Desc, Qty, Price, Total

  user will input the Qty in the form, and once he submitted into
  server
  it will save into invoice database

  BUt how can cake handle the name in Multi-Row
  and direction will help .

  Thanks


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: how to do Multi-Row Edit ?

2007-03-26 Thread digital spaghetti

Absolutly steve, get posting so we can get baking :). I haven't had to
do this yet but I know it'll be coming soon.

Tane

On 3/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Another method that was referenced in this group a while back was to
 use tags like
 ['model0']['Name']
 ['model1']['Name']

 Then in your controller, dynamically create a new model for each
 'modelX' that you have and validate() it and then save() it.
 This way you also get the proper validation messages passed back from
 the model to the view fields.

 I created a component to automatically convert the findAll() results
 array to this format for the view, and back to the multiple models and
 did the saves automatically.

 All you have to do is a multiModel-get() before your view and then a
 multModel-save() call to do your saves.

 I also created a helper to take this model and create the form fields
 needed to make an editable grid in the view.

 I tried to create an article in the Bakery for it, but I could not
 submit it because of the bugs in the Bakery.

 I may try again - or just post it here if there is interest.


 Steve Truesdale



 On Mar 26, 8:57 am, francky06l [EMAIL PROTECTED] wrote:
  You can use a hack to format the tags using an indice ... such as
  ['model'][0]['Name'], ['model'][1]['Name] etc ...
 
  You can use :  'Model/'.$indice.'][fieldname' into the tag name to
  produce the above format ..
 
  On Mar 26, 5:37 am, cc96ai [EMAIL PROTECTED] wrote:
 
   I know how to do in PHP,
   but I have no idea how to work it on cakePHP
 
   e.g.
   I have a table of products,
   and I will list all the products in one form , one page,
 
   -Name, Desc, Qty, Price, Total
   -Name, Desc, Qty, Price, Total
   -Name, Desc, Qty, Price, Total
   -Name, Desc, Qty, Price, Total
 
   user will input the Qty in the form, and once he submitted into
   server
   it will save into invoice database
 
   BUt how can cake handle the name in Multi-Row
   and direction will help .
 
   Thanks


 


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: sessions in cake db _gc

2007-03-26 Thread jyrgen

hello all,

can anybody help please ?

thanks, jyrgen


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Yet another Ajax-link question

2007-03-26 Thread Christopher E. Franklin, Sr.

I feel like an idiot for asking since there are so many posts in this
group on Ajax-link questions but, I have already wasted 2 hours
trying to find the answer.

I was following a small tutorial to get Ajax working (the one with the
stars =D ) and it didn't work.  So, I tried to do a little test and
this is my real problem,

I can use $ajax-link and get a link to show up.  Viewing the source,
you can see the javascript being inserted after the link for an ajax
call.  The problem is, when I click on the link, nothing happens.
Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
Firebug tells me that no XMLHTTPRequests were made at all.

This leads me to believe that there is an error in my coding somewhere
but, looking at the cake manual and other references, it seems that my
code is correct.

Maybe another pair of eyes can spot something that I am missing.

Keep in mind that this is supposed to be a simple test for me to get
the feel of how Ajax works with cakephp.
I want to display http://localhost/user/ and get an Ajax link called
Log In.  When I click Log In, it will call http://localhost/user/login/
and I was expecting the result (pHi!/p) to update into my test div
(testola).
When I click login, it does nothing, no errors, no request calls,
nothing.  See the (**) notes after each piece of code.

I am at a loss here.  Sorry for the long post, I am trying to be
thorough.

The info:
CakePHP :: 1.3.1
Prototype :: 1.5.1_rc2
Scriptaculous :: 1.7.1_beta1
Firefox :: 2.0
Internet Explorer :: 7.0
PHP :: 5
Apache :: 2

Here is the ajax code I have:

// /app/plugins/user/view/user/index.thtml

div id=mainContent
h1Welcome to the user plug-in/h1
hr /
?php
echo $ajax-div('testola');
echo $ajax-divEnd('testola');
$ajaxLoginOptions = array('update' = 'test');
echo $ajax-link('Log In', '/user/login/', array('update' =
'testola', 'url' = 'login/'), null, false);
?
/div
**I have tried this with the ajax-div and without just using a hard
div tag.  I have also tried passing a variable with and without the
url array key/value.  None work

// /app/plugins/user/user_app_controller.php

?php
class UserAppController extends AppController {
public $helpers = array('Html', 'Javascript', 'Ajax');
}
?
**I have included the Javascript and Ajax helpers.  I have no problems
loading js files from default.thtml

// /app/plugins/user/controllers/user_controller.php

?php
class UserController extends UserAppController {

function index()
{

}

function register()
{

}

function login()
{
$this-render('login', 'ajax');
}

function logout()
{

}
}
?
** Under function login, I have commented this out and left it in to
test, neither work

// /app/plugins/user/views/login.thtml

pHi/p
**This is what I want to update my div with


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Yet another Ajax-link question

2007-03-26 Thread Christopher E. Franklin, Sr.

Oh yeah, this is the source in the page after it is rendered:
div id=testola/div
a href=/user/login/  id=link191330890 onclick= return
false;Log In/a
script type=text/javascript
Event.observe('link191330890', 'click', function(event){ new
Ajax.Updater('mainContent','/user/login/', {asynchronous:true,
evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) },
false);
/script

On Mar 26, 11:48 am, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
 I feel like an idiot for asking since there are so many posts in this
 group on Ajax-link questions but, I have already wasted 2 hours
 trying to find the answer.

 I was following a small tutorial to get Ajax working (the one with the
 stars =D ) and it didn't work.  So, I tried to do a little test and
 this is my real problem,

 I can use $ajax-link and get a link to show up.  Viewing the source,
 you can see the javascript being inserted after the link for an ajax
 call.  The problem is, when I click on the link, nothing happens.
 Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
 Firebug tells me that no XMLHTTPRequests were made at all.

 This leads me to believe that there is an error in my coding somewhere
 but, looking at the cake manual and other references, it seems that my
 code is correct.

 Maybe another pair of eyes can spot something that I am missing.

 Keep in mind that this is supposed to be a simple test for me to get
 the feel of how Ajax works with cakephp.
 I want to displayhttp://localhost/user/and get an Ajax link called
 Log In.  When I click Log In, it will callhttp://localhost/user/login/
 and I was expecting the result (pHi!/p) to update into my test div
 (testola).
 When I click login, it does nothing, no errors, no request calls,
 nothing.  See the (**) notes after each piece of code.

 I am at a loss here.  Sorry for the long post, I am trying to be
 thorough.

 The info:
 CakePHP :: 1.3.1
 Prototype :: 1.5.1_rc2
 Scriptaculous :: 1.7.1_beta1
 Firefox :: 2.0
 Internet Explorer :: 7.0
 PHP :: 5
 Apache :: 2

 Here is the ajax code I have:

 // /app/plugins/user/view/user/index.thtml

 div id=mainContent
 h1Welcome to the user plug-in/h1
 hr /
 ?php
 echo $ajax-div('testola');
 echo $ajax-divEnd('testola');
 $ajaxLoginOptions = array('update' = 'test');
 echo $ajax-link('Log In', '/user/login/', array('update' =
 'testola', 'url' = 'login/'), null, false);
 ?
 /div
 **I have tried this with the ajax-div and without just using a hard
 div tag.  I have also tried passing a variable with and without the
 url array key/value.  None work

 // /app/plugins/user/user_app_controller.php

 ?php
 class UserAppController extends AppController {
 public $helpers = array('Html', 'Javascript', 'Ajax');}

 ?
 **I have included the Javascript and Ajax helpers.  I have no problems
 loading js files from default.thtml

 // /app/plugins/user/controllers/user_controller.php

 ?php
 class UserController extends UserAppController {

 function index()
 {

 }

 function register()
 {

 }

 function login()
 {
 $this-render('login', 'ajax');
 }

 function logout()
 {

 }}

 ?
 ** Under function login, I have commented this out and left it in to
 test, neither work

 // /app/plugins/user/views/login.thtml

 pHi/p
 **This is what I want to update my div with


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Yet another Ajax-link question

2007-03-26 Thread Samuel DeVore

make sure that your defauly layout includes the prototype/
scriptalicious stuff, and that it is actually loding


On 3/26/07, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:

 Oh yeah, this is the source in the page after it is rendered:
 div id=testola/div
 a href=/user/login/  id=link191330890 onclick= return
 false;Log In/a
 script type=text/javascript
 Event.observe('link191330890', 'click', function(event){ new
 Ajax.Updater('mainContent','/user/login/', {asynchronous:true,
 evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) },
 false);
 /script

 On Mar 26, 11:48 am, Christopher E. Franklin, Sr.
 [EMAIL PROTECTED] wrote:
  I feel like an idiot for asking since there are so many posts in this
  group on Ajax-link questions but, I have already wasted 2 hours
  trying to find the answer.
 
  I was following a small tutorial to get Ajax working (the one with the
  stars =D ) and it didn't work.  So, I tried to do a little test and
  this is my real problem,
 
  I can use $ajax-link and get a link to show up.  Viewing the source,
  you can see the javascript being inserted after the link for an ajax
  call.  The problem is, when I click on the link, nothing happens.
  Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
  Firebug tells me that no XMLHTTPRequests were made at all.
 
  This leads me to believe that there is an error in my coding somewhere
  but, looking at the cake manual and other references, it seems that my
  code is correct.
 
  Maybe another pair of eyes can spot something that I am missing.
 
  Keep in mind that this is supposed to be a simple test for me to get
  the feel of how Ajax works with cakephp.
  I want to displayhttp://localhost/user/and get an Ajax link called
  Log In.  When I click Log In, it will callhttp://localhost/user/login/
  and I was expecting the result (pHi!/p) to update into my test div
  (testola).
  When I click login, it does nothing, no errors, no request calls,
  nothing.  See the (**) notes after each piece of code.
 
  I am at a loss here.  Sorry for the long post, I am trying to be
  thorough.
 
  The info:
  CakePHP :: 1.3.1
  Prototype :: 1.5.1_rc2
  Scriptaculous :: 1.7.1_beta1
  Firefox :: 2.0
  Internet Explorer :: 7.0
  PHP :: 5
  Apache :: 2
 
  Here is the ajax code I have:
 
  // /app/plugins/user/view/user/index.thtml
 
  div id=mainContent
  h1Welcome to the user plug-in/h1
  hr /
  ?php
  echo $ajax-div('testola');
  echo $ajax-divEnd('testola');
  $ajaxLoginOptions = array('update' = 'test');
  echo $ajax-link('Log In', '/user/login/', array('update' =
  'testola', 'url' = 'login/'), null, false);
  ?
  /div
  **I have tried this with the ajax-div and without just using a hard
  div tag.  I have also tried passing a variable with and without the
  url array key/value.  None work
 
  // /app/plugins/user/user_app_controller.php
 
  ?php
  class UserAppController extends AppController {
  public $helpers = array('Html', 'Javascript', 'Ajax');}
 
  ?
  **I have included the Javascript and Ajax helpers.  I have no problems
  loading js files from default.thtml
 
  // /app/plugins/user/controllers/user_controller.php
 
  ?php
  class UserController extends UserAppController {
 
  function index()
  {
 
  }
 
  function register()
  {
 
  }
 
  function login()
  {
  $this-render('login', 'ajax');
  }
 
  function logout()
  {
 
  }}
 
  ?
  ** Under function login, I have commented this out and left it in to
  test, neither work
 
  // /app/plugins/user/views/login.thtml
 
  pHi/p
  **This is what I want to update my div with


 



-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Data cleanup in Model

2007-03-26 Thread Michael Tuzi

@ianh

I followed your instructions, but I am now getting an SQL error during
validation! I don't understand how, why or where the query takes
place, but the error I get shows that a query ('__sanitize') is being
made to the db. I am using Zend's IDE that I purched a few years ago,
but it isn't possible for me to do much in the way of tracing when I'm
using CakePHP. I'll keep looking for why this call is made and where.
I have the standard code block:

if ( $this-Model-create()  $this-Model-save($this-data) )
{
$this-Session-setFlash('Message');
$this-redirect('url');
}
else {
$this-validateErrors($this-Model);
$this-Session-write('model', $this-data);
$this-set('model', $this-data);
$this-render();
exit();
}

so I don't believe my problem's in the controller.

Thanks,

Michael Tuzi


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Routing Techniques

2007-03-26 Thread fr3nch13

Ir Even better just bake it... if you can't bake it then:

(i haven't played with 1.2 yet, but unless it was drastically changed
from 1.1.x, this is how you i do it:)

change:
turn on admin routing, then:
http://www.domain.com/admin/controller/action

class ControllerController extends AppController
{
function admin_index()
{
$this-set('controller',$this-Model-findAll());
}
function admin_action()
{
$this-checkSession(); // a function in the AppController, app/
app_controller.php which checks the user is logged in and has
permissions
if(empty($this-data))
{

}
else
{
if($this-Model-save($this-data))
{
$this-Session-setFlash('Model is saved');
$this-redirect('/admin/controller/index');
}
}
}
}

You shouldn't even have to call this-render() at all.

Then you name your views:
app/views/controller/admin_index.thtml
app/views/controller/admin_action.thtml

(replace thtml for ctp in 1.2)

On Mar 25, 5:05 pm, Mariano Iglesias [EMAIL PROTECTED]
wrote:
 Or even better, no parameter needed:

 function admin_add()
 {
 return $this-setAction('add');

 }

 function add()
 {
 if (isset($this-params[CAKE_ADMIN]))
 {
 $this-render('admin_add');
 }

 }

 -MI

 ---

 Remember, smart coders answer ten questions for every question they ask.
 So be smart, be cool, and share your knowledge.

 BAKE ON!

 blog:http://www.MarianoIglesias.com.ar

 -Mensaje original-
 De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
 de Mariano Iglesias
 Enviado el: Domingo, 25 de Marzo de 2007 05:53 p.m.
 Para: cake-php@googlegroups.com
 Asunto: RE: Admin Routing Techniques

 No, setAction() will set the $controller-action to 'add' and therefore
 render() will render add.ctp

 But you can use a parameter:


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Yet another Ajax-link question

2007-03-26 Thread Samuel DeVore

can you post some more code in the bin  http://bin.cakephp.org  maybe
there is a simple typo that some fresh eyes might see.

Sam D

On 3/26/07, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:

 I did.  It is loading.  When it doesn't I get the error about the
 undefined function Event something or other.

 On Mar 26, 12:03 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
  make sure that your defauly layout includes the prototype/
  scriptalicious stuff, and that it is actually loding
 
  On 3/26/07, Christopher E. Franklin, Sr.
 
 
 
  [EMAIL PROTECTED] wrote:
 
   Oh yeah, this is the source in the page after it is rendered:
   div id=testola/div
   a href=/user/login/  id=link191330890 onclick= return
   false;Log In/a
   script type=text/javascript
   Event.observe('link191330890', 'click', function(event){ new
   Ajax.Updater('mainContent','/user/login/', {asynchronous:true,
   evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) },
   false);
   /script
 
   On Mar 26, 11:48 am, Christopher E. Franklin, Sr.
   [EMAIL PROTECTED] wrote:
I feel like an idiot for asking since there are so many posts in this
group on Ajax-link questions but, I have already wasted 2 hours
trying to find the answer.
 
I was following a small tutorial to get Ajax working (the one with the
stars =D ) and it didn't work.  So, I tried to do a little test and
this is my real problem,
 
I can use $ajax-link and get a link to show up.  Viewing the source,
you can see the javascript being inserted after the link for an ajax
call.  The problem is, when I click on the link, nothing happens.
Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
Firebug tells me that no XMLHTTPRequests were made at all.
 
This leads me to believe that there is an error in my coding somewhere
but, looking at the cake manual and other references, it seems that my
code is correct.
 
Maybe another pair of eyes can spot something that I am missing.
 
Keep in mind that this is supposed to be a simple test for me to get
the feel of how Ajax works with cakephp.
I want to displayhttp://localhost/user/andget an Ajax link called
Log In.  When I click Log In, it will callhttp://localhost/user/login/
and I was expecting the result (pHi!/p) to update into my test div
(testola).
When I click login, it does nothing, no errors, no request calls,
nothing.  See the (**) notes after each piece of code.
 
I am at a loss here.  Sorry for the long post, I am trying to be
thorough.
 
The info:
CakePHP :: 1.3.1
Prototype :: 1.5.1_rc2
Scriptaculous :: 1.7.1_beta1
Firefox :: 2.0
Internet Explorer :: 7.0
PHP :: 5
Apache :: 2
 
Here is the ajax code I have:
 
// /app/plugins/user/view/user/index.thtml
 
div id=mainContent
h1Welcome to the user plug-in/h1
hr /
?php
echo $ajax-div('testola');
echo $ajax-divEnd('testola');
$ajaxLoginOptions = array('update' = 'test');
echo $ajax-link('Log In', '/user/login/', array('update' =
'testola', 'url' = 'login/'), null, false);
?
/div
**I have tried this with the ajax-div and without just using a hard
div tag.  I have also tried passing a variable with and without the
url array key/value.  None work
 
// /app/plugins/user/user_app_controller.php
 
?php
class UserAppController extends AppController {
public $helpers = array('Html', 'Javascript', 'Ajax');}
 
?
**I have included the Javascript and Ajax helpers.  I have no problems
loading js files from default.thtml
 
// /app/plugins/user/controllers/user_controller.php
 
?php
class UserController extends UserAppController {
 
function index()
{
 
}
 
function register()
{
 
}
 
function login()
{
$this-render('login', 'ajax');
}
 
function logout()
{
 
}}
 
?
** Under function login, I have commented this out and left it in to
test, neither work
 
// /app/plugins/user/views/login.thtml
 
pHi/p
**This is what I want to update my div with
 
  --
  (the old fart) the advice is free, the lack of crankiness will cost you
 
  - its a fine line between a real question and an idiot
 
  http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/


 



-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

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

Re: how to do Multi-Row Edit ?

2007-03-26 Thread cc96ai

in your provided code,
we might to update helper.php

var $tags = array('link' = 'a href=%s %s%s/a',
'mailto' = 'a 
href=mailto:%s; %s%s/a',
'form' = 'form %s',
'input' = 'input 
name=data[%s][%s] %s/',
'hidden' = 'input type=hidden name=data[%s][%s] %s/',

I m not sure thats good idea or not



--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: A question on reusing ,parts'

2007-03-26 Thread nitsuj

Thanks for your help, I'll be looking into elements then.

On Mar 25, 3:06 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 elements :)

 On Mar 25, 12:13 pm, nitsuj [EMAIL PROTECTED] wrote:

  Hi everyone,
  I've just started trying to use cake, I've followed a few tutorials
  and readpartsof the manual.
  I'm now trying 'learning by doing', and have my first problem! While I
  am quite sure this question has been asked and answered here I can't
  find the answer.

  I would like to have my login box appear on every page of my site, and
  a few other 'parts' appear on multiple pages to.

  I have read about requestAction and elements. What should I be using?
  The manual has no search function so I have been browsing though and
  found a very small explanation about elements, but can't find much
  more.

  If anyone could point me in the right direction it would be much
  appreciated.

  Thanks in advance,

  Justin


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Yet another Ajax-link question

2007-03-26 Thread Christopher E. Franklin, Sr.

Well, I found a quick tutorial on cakebaker that I have tried and even
that doesn't seem to work.

It is a bare user plugin so I am just uploading it to this group as
test_user_plugin.zip.

The only thing you would need to change is the user_app_model.php
public $useTable = false;

Then you can just drop it into any cake framework you have and try it
out.  If you can get the ajax div to update, my problem may be deep
seated with my PHP installation I am guessing.

On Mar 26, 12:43 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
 can you post some more code in the bin  http://bin.cakephp.org maybe
 there is a simple typo that some fresh eyes might see.

 Sam D

 On 3/26/07, Christopher E. Franklin, Sr.



 [EMAIL PROTECTED] wrote:

  I did.  It is loading.  When it doesn't I get the error about the
  undefined function Event something or other.

  On Mar 26, 12:03 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
   make sure that your defauly layout includes the prototype/
   scriptalicious stuff, and that it is actually loding

   On 3/26/07, Christopher E. Franklin, Sr.

   [EMAIL PROTECTED] wrote:

Oh yeah, this is the source in the page after it is rendered:
div id=testola/div
a href=/user/login/  id=link191330890 onclick= return
false;Log In/a
script type=text/javascript
Event.observe('link191330890', 'click', function(event){ new
Ajax.Updater('mainContent','/user/login/', {asynchronous:true,
evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) },
false);
/script

On Mar 26, 11:48 am, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
 I feel like an idiot for asking since there are so many posts in this
 group on Ajax-link questions but, I have already wasted 2 hours
 trying to find the answer.

 I was following a small tutorial to get Ajax working (the one with the
 stars =D ) and it didn't work.  So, I tried to do a little test and
 this is my real problem,

 I can use $ajax-link and get a link to show up.  Viewing the source,
 you can see the javascript being inserted after the link for an ajax
 call.  The problem is, when I click on the link, nothing happens.
 Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
 Firebug tells me that no XMLHTTPRequests were made at all.

 This leads me to believe that there is an error in my coding somewhere
 but, looking at the cake manual and other references, it seems that my
 code is correct.

 Maybe another pair of eyes can spot something that I am missing.

 Keep in mind that this is supposed to be a simple test for me to get
 the feel of how Ajax works with cakephp.
 I want to displayhttp://localhost/user/andgetan Ajax link called
 Log In.  When I click Log In, it will callhttp://localhost/user/login/
 and I was expecting the result (pHi!/p) to update into my test div
 (testola).
 When I click login, it does nothing, no errors, no request calls,
 nothing.  See the (**) notes after each piece of code.

 I am at a loss here.  Sorry for the long post, I am trying to be
 thorough.

 The info:
 CakePHP :: 1.3.1
 Prototype :: 1.5.1_rc2
 Scriptaculous :: 1.7.1_beta1
 Firefox :: 2.0
 Internet Explorer :: 7.0
 PHP :: 5
 Apache :: 2

 Here is the ajax code I have:

 // /app/plugins/user/view/user/index.thtml

 div id=mainContent
 h1Welcome to the user plug-in/h1
 hr /
 ?php
 echo $ajax-div('testola');
 echo $ajax-divEnd('testola');
 $ajaxLoginOptions = array('update' = 'test');
 echo $ajax-link('Log In', '/user/login/', array('update' =
 'testola', 'url' = 'login/'), null, false);
 ?
 /div
 **I have tried this with the ajax-div and without just using a hard
 div tag.  I have also tried passing a variable with and without the
 url array key/value.  None work

 // /app/plugins/user/user_app_controller.php

 ?php
 class UserAppController extends AppController {
 public $helpers = array('Html', 'Javascript', 'Ajax');}

 ?
 **I have included the Javascript and Ajax helpers.  I have no problems
 loading js files from default.thtml

 // /app/plugins/user/controllers/user_controller.php

 ?php
 class UserController extends UserAppController {

 function index()
 {

 }

 function register()
 {

 }

 function login()
 {
 $this-render('login', 'ajax');
 }

 function logout()
 {

 }}

 ?
 ** Under function login, I have commented this out and left it in to
 test, neither work

 // /app/plugins/user/views/login.thtml

 pHi/p
 **This is what I want to update my div with

   --
   (the old fart) the advice is free, the lack of crankiness will cost you

   - its a fine line between a real question and an idiot

  

Re: Yet another Ajax-link question

2007-03-26 Thread Christopher E. Franklin, Sr.

Really wierd but, it's working now.  When I included scriptaculous
using $javascript-link(scriptaculous);, the script would include
the needed file by itself add a whole url in the src tag (example:
script src=http://localhost/js/builder.js; type=text/javascript).

I commented out the part where it included the files for giggles and
loaded them myself via more $javascript-link tags and viola!  It
worked.  No earthly idea why but, that solved it for me.

On Mar 26, 1:17 pm, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
 Well, I found a quick tutorial on cakebaker that I have tried and even
 that doesn't seem to work.

 It is a bare user plugin so I am just uploading it to this group as
 test_user_plugin.zip.

 The only thing you would need to change is the user_app_model.php
 public $useTable = false;

 Then you can just drop it into any cake framework you have and try it
 out.  If you can get the ajax div to update, my problem may be deep
 seated with my PHP installation I am guessing.

 On Mar 26, 12:43 pm, Samuel DeVore [EMAIL PROTECTED] wrote:

  can you post some more code in the bin  http://bin.cakephp.orgmaybe
  there is a simple typo that some fresh eyes might see.

  Sam D

  On 3/26/07, Christopher E. Franklin, Sr.

  [EMAIL PROTECTED] wrote:

   I did.  It is loading.  When it doesn't I get the error about the
   undefined function Event something or other.

   On Mar 26, 12:03 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
make sure that your defauly layout includes the prototype/
scriptalicious stuff, and that it is actually loding

On 3/26/07, Christopher E. Franklin, Sr.

[EMAIL PROTECTED] wrote:

 Oh yeah, this is the source in the page after it is rendered:
 div id=testola/div
 a href=/user/login/  id=link191330890 onclick= return
 false;Log In/a
 script type=text/javascript
 Event.observe('link191330890', 'click', function(event){ new
 Ajax.Updater('mainContent','/user/login/', {asynchronous:true,
 evalScripts:true, requestHeaders:['X-Update', 'mainContent']}) },
 false);
 /script

 On Mar 26, 11:48 am, Christopher E. Franklin, Sr.
 [EMAIL PROTECTED] wrote:
  I feel like an idiot for asking since there are so many posts in 
  this
  group on Ajax-link questions but, I have already wasted 2 hours
  trying to find the answer.

  I was following a small tutorial to get Ajax working (the one with 
  the
  stars =D ) and it didn't work.  So, I tried to do a little test and
  this is my real problem,

  I can use $ajax-link and get a link to show up.  Viewing the 
  source,
  you can see the javascript being inserted after the link for an ajax
  call.  The problem is, when I click on the link, nothing happens.
  Using FF2 or IE7.  I get no errors whatsoever (using Firebug).
  Firebug tells me that no XMLHTTPRequests were made at all.

  This leads me to believe that there is an error in my coding 
  somewhere
  but, looking at the cake manual and other references, it seems that 
  my
  code is correct.

  Maybe another pair of eyes can spot something that I am missing.

  Keep in mind that this is supposed to be a simple test for me to get
  the feel of how Ajax works with cakephp.
  I want to displayhttp://localhost/user/andgetanAjax link called
  Log In.  When I click Log In, it will 
  callhttp://localhost/user/login/
  and I was expecting the result (pHi!/p) to update into my test 
  div
  (testola).
  When I click login, it does nothing, no errors, no request calls,
  nothing.  See the (**) notes after each piece of code.

  I am at a loss here.  Sorry for the long post, I am trying to be
  thorough.

  The info:
  CakePHP :: 1.3.1
  Prototype :: 1.5.1_rc2
  Scriptaculous :: 1.7.1_beta1
  Firefox :: 2.0
  Internet Explorer :: 7.0
  PHP :: 5
  Apache :: 2

  Here is the ajax code I have:

  // /app/plugins/user/view/user/index.thtml

  div id=mainContent
  h1Welcome to the user plug-in/h1
  hr /
  ?php
  echo $ajax-div('testola');
  echo $ajax-divEnd('testola');
  $ajaxLoginOptions = array('update' = 'test');
  echo $ajax-link('Log In', '/user/login/', array('update' =
  'testola', 'url' = 'login/'), null, false);
  ?
  /div
  **I have tried this with the ajax-div and without just using a hard
  div tag.  I have also tried passing a variable with and without the
  url array key/value.  None work

  // /app/plugins/user/user_app_controller.php

  ?php
  class UserAppController extends AppController {
  public $helpers = array('Html', 'Javascript', 'Ajax');}

  ?
  **I have included the Javascript and Ajax helpers.  I have no 
  problems
  loading js files from default.thtml

  // /app/plugins/user/controllers/user_controller.php

  ?php
  

Re: how to do Multi-Row Edit ?

2007-03-26 Thread dima

CC96AI,

You're right about modifying the tag templates.

There would have to be more changes than the ones i mentioned above.
However, it's a starting point :).

As for it being a good idea, you can implement your own tags. Since
you're subclassing HtmlHelper you can redefine the $tags class
attribute to have your own templates. Also, you would need to modify
the rendering of those templates.

Dim



On Mar 26, 3:57 pm, cc96ai [EMAIL PROTECTED] wrote:
 in your provided code,
 we might to update helper.php

 var $tags = array('link' = 'a href=%s %s%s/a',
 'mailto' = 'a 
 href=mailto:%s; %s%s/a',
 'form' = 'form %s',
 'input' = 'input 
 name=data[%s][%s] %s/',
 'hidden' = 'input type=hidden name=data[%s][%s] %s/',

 I m not sure thats good idea or not


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Spam-protected, accessible forms?

2007-03-26 Thread Alex

Hi,

Since my site was attacked by spammers, I was working on a solution,
that generates some random input boxes inside my formula.
when these (hidden by several methods) were filled by an automated
spam-robot, the following action will not take place.
the other inputs had to be randomly renamed. the posted data would be
mapped to get the original inputs-name (saved via session).
this solution prevents spam robots from searching the whole web page
for input fields containing text, homepage or name/username and
filling it and does not use captchas (better accessibility).
but my solution required many heavy changes in the html and form
helper.
so has anybody got an idea, how to implement this into cake without
making the application unupdateable?
in general my helper have to change the html-code returned by the form
helper. the controller offers a function which maps the posted data
back.

Greetings,
Alex


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Email Component and UTF8 Subject

2007-03-26 Thread Alex


I opened a ticket for this topic:

https://trac.cakephp.org/ticket/2298#preview


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Spam-protected, accessible forms?

2007-03-26 Thread Grant Cox

So all you want is for your helper to have the same interface as the
Form/Html helper, but save the requested field names to the session
and generate new random field names which are passed to the real Form/
Html helper?

In that case, your helper can either have var $helpers =
array('Form','Html') and use $this-Form-input() etc
or it can actually extend the existing FormHelper, and call
parent::input() etc.

In both ways you may need to update your helper if the interface to
the existing helpers changes dramatically.  However, historically Cake
has remained backwards compatible for a fairly long time, so even if
you base this off the in-development Cake 1.2 I doubt you'll have any
problems updating your Cake core.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



modularity and MVC

2007-03-26 Thread DJ Spark

  I'd like to know if using requestAction in the view breaks (too
much) the MVC concept, or is it a good use?
  I've been doing due to the 'high' load of a website i'm working. An example:

?php echo $this-renderElement('listas/destaque-principal',
array('listas' =
$this-controller-requestAction('/listas/destaquePrincipal')) ); ?

  This will return an array with data , and i'll use that in the same
element i use elsewhere.

  Btw, i couldn't make caching work in cake, if I have an dinamic area
in it. The cache file includes some PHP, but (sometimes?) the final
HTML output had the tags exactly as cake:nocache (and not replaced
by the dynamic content)
The manual says:

 - To stop certain parts of a view from been cached you wrap them
with cake:nocache /cake:nocache
 - Cake automatically clears specific cache copies when changes are
made to the database

 And cake did not cleared the cache when the db was updated :\

  I'm using 1.1.13, i uncommented the core.php CACHE statement, and
the cache folder is writable.
 everything works fine except for these few quirks :

 thanks



-- 
[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?hl=en
-~--~~~~--~~--~--~---



Re: Setting time zone

2007-03-26 Thread Grant Cox

What version of PHP, and what OS?  As far as I am concerned, dealing
with timezones on PHP4 and Windows is just too much trouble - the
timezones need to be in a windows specific format ( 
http://bugs.php.net/bug.php?id=22418
) rather than the common TZ format.

If you have PHP5, just use date_default_timezone_set and
date_default_timezone_get.  If you have PHP4, try these in your app/
config/bootstrap.php:

if ( !function_exists('date_default_timezone_get') ){
// PHP  5.1
function date_default_timezone_get()
{
$env_tz = env(TZ);
if ( !empty($env_tz) ){
return $env_tz;
}

return false;
}
}

if ( !function_exists('date_default_timezone_set') ){
// PHP  5.1
function date_default_timezone_set( $zone )
{
// standard timezone format only actually works on linux, not
windows
if ( strpos(strtolower(env('OS')), 'win') !== false ){
// running on windows
return false;
}
putenv ('TZ='.$zone );
}
}



On Mar 27, 2:57 am, squidliberty [EMAIL PROTECTED] wrote:
 I live in the south-eastern US and I'm storing timestamps in my
 database. I need date() to reflect my time zone when viewing this
 data. Without access to php.ini, how can I do this for CakePHP?

 Ive tried adding putenv(TZ = America/New_York); and
 ini_set(date.timezone,America/New_York); in core.php but neither
 seemed to change my results.

 Thanks!


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Site wide variable.

2007-03-26 Thread BlenderStyle

To have a variable available in your views and elements try this in
your controller (or AppController):

function beforeRender()
{
  $this-set('variable', 'whatever you want');
}

In your views and elements you should be able to access $variable.

On Mar 22, 9:36 pm, dizz [EMAIL PROTECTED] wrote:
 Hello,

 I am trying to set a variable in my AppController to be accessed by
 all controllers. I have an element on all of my pages that displays
 last user logins.

 At first I was trying to use the User model in the AppController by
 using the $uses variable but for some reason the PageController was
 not overridden (but all other controllers worked fine). Then I was
 pointed to the requestAction method. I am now trying to set the
 variable using the requestAction method but it keeps on looping.

 Below is the code for my AppController

 function beforeFilter () {
 if ($this-action != 'login'  $this-action != 'logout'  
 $this-action != 'getLogins') {

 $this-checkSession();
 $this-set(user_data, $this-Session-read('User'));
 $this-set('login_data', 
 $this-requestAction('/users/getLogins',
 array('return')));
 }
 }

 Below is the code for my UsersController

 function getLogins () {
 $this-User-Login-findAll();
 }

 Any help would be greatly appreciated. Thanks,
 -Andrew


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



RE: modularity and MVC

2007-03-26 Thread Mariano Iglesias

Not at all, calling requestAction() from elements/view is perfectly
acceptable. Though you could also call it from the controller and set a var
for the view to get, but again, I see no issue on the way you are doing it
now (as a matter of fact much of The Bakery elements use this approach.)

Where do you have your cake:nocache statements? Remember that view (not
elements) allow those statements, while elements (in Cake 1.2) can also be
cached.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar

-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de DJ Spark
Enviado el: Lunes, 26 de Marzo de 2007 09:14 p.m.
Para: cake-php@googlegroups.com
Asunto: modularity and MVC

  I'd like to know if using requestAction in the view breaks (too
much) the MVC concept, or is it a good use?
  I've been doing due to the 'high' load of a website i'm working. An
example:

?php echo $this-renderElement('listas/destaque-principal',
array('listas' =
$this-controller-requestAction('/listas/destaquePrincipal')) ); ?


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Hierarchical Models and associations?

2007-03-26 Thread TekJansen

Is it possible to create a hierarchy of model classes? Cake doesn't
seem too happy when I try.

What I mean is that I have a table, let's say People. I've created
two models which use this table, let's say Man and Woman. The
reason they're different is that they have different validation rules,
business rules, controllers, etc.

So far so good, but now I have a child object type, say a Hat. A hat
belogsTo a Man OR a Woman through a person_id foreign key. I
assumed I could have the Man and Woman model classes extend a
Person class, which would extend AppModel and define the belongsTo
relationship. However this doesn't work.

Is there an easy solution to this type of problem? I want to avoid
separate ManHat and WomanHat models for obvious reasons. I also
want to avoid separate tables for Men and Women since they really are
the same thing.

Any advice is appreciated.
Best 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?hl=en
-~--~~~~--~~--~--~---



getLastInsertID - multiple user are entering data??

2007-03-26 Thread bingo

Hi,

I wanted to know how getLastInsertID works. I am especially concerned
when two different users are posting two different articles at the
exactly same time (although chances are extremely rare but is
possible), then what getLastInsertID returns..does it works within a
particular session or is global to whole application?

Thanks
bingo


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: getLastInsertID - multiple user are entering data??

2007-03-26 Thread Langdon Stevenson

Hi bingo

Nate made the comment a little while ago (in response to my question 
along similar lines) that getLastIntertID will do what it is meant to. 
I don't remember the details, however a quick search of this group 
should turn up the thread.

Given that no-one ever complains that getLastInsertID doesn't work, it 
seems likely to me that there is no issue.

Regards,
Langdon


bingo wrote:
 Hi,
 
 I wanted to know how getLastInsertID works. I am especially concerned
 when two different users are posting two different articles at the
 exactly same time (although chances are extremely rare but is
 possible), then what getLastInsertID returns..does it works within a
 particular session or is global to whole application?
 
 Thanks
 bingo

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: getLastInsertID - multiple user are entering data??

2007-03-26 Thread [EMAIL PROTECTED]

As I understand, it works on the last query performed by that user, so
you are always going to get the correct ID.
I've never had any trouble with it with a heavily used CRM/CMS system.

On Mar 27, 1:07 pm, bingo [EMAIL PROTECTED] wrote:
 Hi,

 I wanted to know how getLastInsertID works. I am especially concerned
 when two different users are posting two different articles at the
 exactly same time (although chances are extremely rare but is
 possible), then what getLastInsertID returns..does it works within a
 particular session or is global to whole application?

 Thanks
 bingo


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Hierarchical Models and associations?

2007-03-26 Thread TekJansen

One small correction - below, when I said I hoped I could define the
belongsTo relationship at some superclass level and have it
inherited by subclasses, I meant, at least for my hypothetical
example, the hasMany relationship.

thanks.

On Mar 26, 8:06 pm, TekJansen [EMAIL PROTECTED] wrote:
 I assumed I could have the Man and Woman model classes extend a
 Person class, which would extend AppModel and define the belongsTo
 relationship.


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Spam-protected, accessible forms?

2007-03-26 Thread jitka

Hi Alex,

I think You will want to review what AD7six has done - You can (at
least) grab some idea how this can be done without modification of
core helpers:
http://www.noswad.me.uk/MiBlog/Spam

Jitka


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Problem Redirecting to Servlet

2007-03-26 Thread g

Hi. Thanks to everybody who replied. I was able to fix the problem by
using single quotes. Hehe.

On Mar 12, 3:10 pm, Chris Lamb [EMAIL PROTECTED] wrote:
 Mariano Iglesias [EMAIL PROTECTED] wrote:
  This issue was solved some time ago:

 https://trac.cakephp.org/ticket/2060

 I looked at the API docs[0] which is currently at 1.1.113.4450, whilst
 the above ticket was fixed in 1.1.113.4462.

 Sorry for the confusion, I assumed a.c.o would be up to date :)

 Kind regards,

 --
  Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20

  signature.asc
 1KDownload


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Routing Techniques

2007-03-26 Thread R. Rajesh Jeba Anbiah

On Mar 27, 12:17 am, fr3nch13 [EMAIL PROTECTED] wrote:
 Ir Even better just bake it... if you can't bake it then:

 (i haven't played with 1.2 yet, but unless it was drastically changed
 from 1.1.x, this is how you i do it:)

 change:
 turn on admin routing, then:http://www.domain.com/admin/controller/action

 class ControllerController extends AppController
 {
 function admin_index()
 {
 $this-set('controller',$this-Model-findAll());
 }
 function admin_action()
 {
 $this-checkSession(); // a function in the AppController, app/
 app_controller.php which checks the user is logged in and has
 permissions
 snip

 FYI, I do not find checkSession anywhere in my 1.2. Looks like
that need to Auth component instead, but I couldn't yet figured out it
and it's doc.

--
  ?php echo 'Just another PHP saint'; ?
Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.com/


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: WithCake.com relaunched

2007-03-26 Thread Dr. Tarique Sani

On 3/25/07, jonathan.snook [EMAIL PROTECTED] wrote:
 There's still two main features that I need to add:
 1) RSS feeds for the job listing
 2) a way for people to contact you through the site

 I'll see about getting those in sometime within the week.

Tried it  - Nice :)

Tarique
-- 
=
PHP for E-Biz: http://sanisoft.com
Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---



Re: Data cleanup in Model

2007-03-26 Thread ianh

Hi,

Thanks for trying the code out - there are no SQL queries within the
__sanitize function and the error as described sounds *really* counter-
intuitive. What version of cake are you using out of interest?

In terms of your controller block, nothing obviously wrong there, you
may wish to consider splitting it into two so you can give better
error messages to users though; BTW, this is cake 1.1.12 code, cake
1.2 is slightly different and I haven't tested the __sanitize function
in 1.2.

if( $this-Model-validates($this-data))
{
  if($this-Model-create()  $this-Model-save($this-data))
  {
// send a success message
  }
  else
  {
// send a DB error message
  }
}
else
{
  // let users know their input failed to validate
}

With the controller code split up like that and __sanitize() called in
beforeValidate() it definately works on 1.1.12.

Simplest way to figure out whats going would be to stick a couple of
die(at line xxx) statements in to see where the call is made. At a
guess I would say in the beforeValidate() function of your app model?
If you want to persevere with this approach use my email to get in
touch and I'm happy to spend a bit of time looking at it with you.

Ianh

On Mar 26, 12:12 pm, Michael Tuzi [EMAIL PROTECTED] wrote:
 @ianh

 I followed your instructions, but I am now getting an SQL error during
 validation! I don't understand how, why or where the query takes
 place, but the error I get shows that a query ('__sanitize') is being
 made to the db. I am using Zend's IDE that I purched a few years ago,
 but it isn't possible for me to do much in the way of tracing when I'm
 using CakePHP. I'll keep looking for why this call is made and where.
 I have the standard code block:

 if ( $this-Model-create()  $this-Model-save($this-data) )
 {
 $this-Session-setFlash('Message');
 $this-redirect('url');}

 else {
 $this-validateErrors($this-Model);
 $this-Session-write('model', $this-data);
 $this-set('model', $this-data);
 $this-render();
 exit();

 }

 so I don't believe my problem's in the controller.

 Thanks,

 Michael Tuzi


--~--~-~--~~~---~--~~
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?hl=en
-~--~~~~--~~--~--~---