Re: Searching non existent related models

2009-07-27 Thread byqsri

It doesnt work.
The resulted query is :
`User`.`name` = 'IS NULL'

On 27 Lug, 04:30, Dr. Loboto drlob...@gmail.com wrote:
 Probably something like this:

 $this-paginate['conditions'] = array(
     'OR' = array (
         'User.name' = 'IS NULL',
         'Recipe.id' = 'IS NULL'
     )
 );

 On Jul 24, 2:32 am, iFeghali igor.fegh...@gmail.com wrote:



  Hello All,

  Say I have a User hasMany Recipes. Now I want to search for all users
  with an empty name OR users that doesn't have any recipe. How do I
  turn that piece of code in what I want:

  $this-paginate['conditions'] = array('User.name' = 'IS NULL');
  $this-set('users', $this-paginate());

  Can I do that in a single query condition ?

  Thank you.- Nascondi testo citato

 - Mostra testo citato -
--~--~-~--~~~---~--~~
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: Searching non existent related models

2009-07-27 Thread byqsri

The solution is:
'User.name'  = NULL

On 27 Lug, 09:03, byqsri marco.rizze...@gmail.com wrote:
 It doesnt work.
 The resulted query is :
 `User`.`name` = 'IS NULL'

 On 27 Lug, 04:30, Dr. Loboto drlob...@gmail.com wrote:



  Probably something like this:

  $this-paginate['conditions'] = array(
      'OR' = array (
          'User.name' = 'IS NULL',
          'Recipe.id' = 'IS NULL'
      )
  );

  On Jul 24, 2:32 am, iFeghali igor.fegh...@gmail.com wrote:

   Hello All,

   Say I have a User hasMany Recipes. Now I want to search for all users
   with an empty name OR users that doesn't have any recipe. How do I
   turn that piece of code in what I want:

   $this-paginate['conditions'] = array('User.name' = 'IS NULL');
   $this-set('users', $this-paginate());

   Can I do that in a single query condition ?

   Thank you.- Nascondi testo citato

  - Mostra testo citato -- Nascondi testo citato

 - Mostra testo citato -
--~--~-~--~~~---~--~~
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: Searching non existent related models

2009-07-27 Thread Jaydeep Dave
try:

$this-paginate['conditions'] = array(
 'OR' = array (
 'User.name IS' = 'NULL',
 'Recipe.id IS' = ' NULL'
 )
 );
---

$this-paginate['conditions'] = array(
 'OR' = array (
 'User.name IS' = null,
 'Recipe.id IS' = null
 )
 );




$this-paginate['conditions'] = array(
 'OR' = array (
 'User.name' = null,
 'Recipe.id' = null
 )
 );

Jaydeep Dave

On Mon, Jul 27, 2009 at 12:33 PM, byqsri marco.rizze...@gmail.com wrote:


 It doesnt work.
 The resulted query is :
 `User`.`name` = 'IS NULL'

 On 27 Lug, 04:30, Dr. Loboto drlob...@gmail.com wrote:
  Probably something like this:
 
  $this-paginate['conditions'] = array(
  'OR' = array (
  'User.name' = 'IS NULL',
  'Recipe.id' = 'IS NULL'
  )
  );
 
  On Jul 24, 2:32 am, iFeghali igor.fegh...@gmail.com wrote:
 
 
 
   Hello All,
 
   Say I have a User hasMany Recipes. Now I want to search for all users
   with an empty name OR users that doesn't have any recipe. How do I
   turn that piece of code in what I want:
 
   $this-paginate['conditions'] = array('User.name' = 'IS NULL');
   $this-set('users', $this-paginate());
 
   Can I do that in a single query condition ?
 
   Thank you.- Nascondi testo citato
 
  - Mostra testo citato -
 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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
-~--~~~~--~~--~--~---



How to inheirt form other controllers?

2009-07-27 Thread Michael Gaiser
I want to have my UserAdmin controller inherit from my User controller
instead of AppController. but it cannot seem to find it. Is there a special
way to do this in cake or can I just use and include statment? Thanks.

~MJG

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



Element $html-link problem

2009-07-27 Thread DatacenterHellas

Hello all.

I try to create an Html / Css based menu with CakePHP

What I'm doing to create the menu elements is that :

?php e($html-link($html-tag('b','Home'),array
('controller'='controlls','action'='index'))); ?

And what I get is that

bHome/b

instead of

Home with bold

What can I do ? ? ?

Kind regards
Merianos Nikos
--~--~-~--~~~---~--~~
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: bread crumbs problem

2009-07-27 Thread leop

No ideas on this? I'm beginning to wonder if it's a bug.

L

On 17 July, 14:21, leo ponton@gmail.com wrote:
 Some time ago I use the bread crumb functionality of HtmlHelper
 without a great deal of difficulty.

 Now, a year or so on, I'm at it again. This time I'm developing in a
 full release (previously it was RC2 or RC3) and it doesn't seem to
 work. I don't have access to my previous code for reference.

 The symptoms are that when I addCrumb, the $html-_crumbs array
 appears to be created anew. The crumbs array seems to be going out of
 scope.

 The following code fragment from an_element.ctp:

 debug($html-_crumbs);
         $html-addCrumb($this-name,$this-params['url']['url']);
 debug($html-_crumbs);

 yields this output:

 Array
 (
 )

 Array
 (
     [0] = Array
         (
             [0] = Proposals
             [1] = proposals/view/5
             [2] =
         )

 )

 I'm a bit confused here and would appreciate any pointers to what I'm
 failing to do.
--~--~-~--~~~---~--~~
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 multilingual

2009-07-27 Thread Yannis

Hi guys,

I have been struggling to make my small cakephp cms multilingual.
I have been reading loads of articles on the net but nothing seems to
work 100%
Could someone please direct me to a correct study path, a book, an
article a tutorial, a hint or a clue
that could generate some results.

- I have set up my database with an i18n table and I have managed to
set the default language on the
core.php.
- I have also managed to switch the url to include the language
extension at the beginning
(although I'm still trying to make it redirect to the current page
when changed)
- I'm lacking a method to change languages so that the database can
fetch the direct translations
and also I cannot properly set up cakephp to read the po file (the po
generates an error when saving as well although it seems to keep the
changes)

Anyone please help. I'm willing to buy any book that may contain the
solution (although I think I have all 3? books
that have been written for cakephp)

Thanks
Yannis
--~--~-~--~~~---~--~~
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 inheirt form other controllers?

2009-07-27 Thread Jaydeep Dave
You can use that controller (Model) in app_controller.php;
var $uses = array('User', 'Curl', 'Services');  // etc ;)

---

In your end controller you can use something like

$this-User-Controller-method();// Dont know the exact snippet
... but search in google.


On Mon, Jul 27, 2009 at 3:52 PM, Michael Gaiser mjgai...@gmail.com wrote:

 I want to have my UserAdmin controller inherit from my User controller
 instead of AppController. but it cannot seem to find it. Is there a special
 way to do this in cake or can I just use and include statment? Thanks.

 ~MJG

 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: Cakephp multilingual

2009-07-27 Thread leop

Try this link: http://tinyurl.com/4w3d49 (p28n, the top to bottom
persistent internationalization tutorial.) That's what I used.

Switching languages can be awkward, depending on how and where you're
doing it. I'm looking out some examples for you - might be a little
while though as I'm working on something else.

The po error rings a bell. Are you using poedit? It was over a year
ago, but I had a similar problem and I think I had to trawl through
the file and clean it up by hand.

Have a look at http://univerd.com for a working example. If you then
have any specific questions I can then give you some sanitized code
fragments.

L

On 27 July, 11:42, Yannis ikasso...@gmail.com wrote:
 Hi guys,

 I have been struggling to make my small cakephp cms multilingual.
 I have been reading loads of articles on the net but nothing seems to
 work 100%
 Could someone please direct me to a correct study path, a book, an
 article a tutorial, a hint or a clue
 that could generate some results.

 - I have set up my database with an i18n table and I have managed to
 set the default language on the
 core.php.
 - I have also managed to switch the url to include the language
 extension at the beginning
 (although I'm still trying to make it redirect to the current page
 when changed)
 - I'm lacking a method to change languages so that the database can
 fetch the direct translations
 and also I cannot properly set up cakephp to read the po file (the po
 generates an error when saving as well although it seems to keep the
 changes)

 Anyone please help. I'm willing to buy any book that may contain the
 solution (although I think I have all 3? books
 that have been written for cakephp)

 Thanks
 Yannis
--~--~-~--~~~---~--~~
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: Pagination helper - showing empty pages

2009-07-27 Thread Alastair

On Jul 26, 1:36 am, brian bally.z...@gmail.com wrote:
 I think the condition on Region.name should be under the Region array.

 Have you tried debugging the output to see what the result array looks like?


Hi Brian,

I have done. When I debug a non-paginated recordset, I'm getting 52
records back. When I debug the paginator array, it shows a count of 74
although it only actually returning the correct amount of records.

--~--~-~--~~~---~--~~
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: Element $html-link problem

2009-07-27 Thread Günther Theilen

Hi,

you should add the fifth parameter to switch off escaping.
http://api.cakephp.org/class/html-helper#method-HtmlHelperlink

Something like this:
e($html-link($html-tag('b','Home'),array 
('controller'='controlls','action'='index'), null, null, false));

Regards
Guenther

DatacenterHellas wrote:
 Hello all.
 
 I try to create an Html / Css based menu with CakePHP
 
 What I'm doing to create the menu elements is that :
 
 ?php e($html-link($html-tag('b','Home'),array
 ('controller'='controlls','action'='index'))); ?
 
 And what I get is that
 
 bHome/b
 
 instead of
 
 Home with bold
 
 What can I do ? ? ?
 
 Kind regards
 Merianos Nikos
  


--~--~-~--~~~---~--~~
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: Cakephp multilingual

2009-07-27 Thread Yannis

Thank you very much leop!

The article you're referring to was actually one of the last ones I
read this morning.
Still cannot make it work with my app.
However it is quite informative. I am having a look right now on the
second link and
will get back here if I get more specific.

respectfully
Yannis

--~--~-~--~~~---~--~~
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: Element $html-link problem

2009-07-27 Thread mike karthauser

You can also do it by adding 'escape' ='false' in you link array

Mike Karthauser
Brightstorm limited
Tel: 07939252144

On 27 Jul 2009, at 12:27, Günther Theilen thei...@eqi.de wrote:


 Hi,

 you should add the fifth parameter to switch off escaping.
 http://api.cakephp.org/class/html-helper#method-HtmlHelperlink

 Something like this:
 e($html-link($html-tag('b','Home'),array
 ('controller'='controlls','action'='index'), null, null, false));

 Regards
 Guenther

 DatacenterHellas wrote:
 Hello all.

 I try to create an Html / Css based menu with CakePHP

 What I'm doing to create the menu elements is that :

 ?php e($html-link($html-tag('b','Home'),array
 ('controller'='controlls','action'='index'))); ?

 And what I get is that

 bHome/b

 instead of

 Home with bold

 What can I do ? ? ?

 Kind regards
 Merianos Nikos



 


--~--~-~--~~~---~--~~
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 inheirt form other controllers?

2009-07-27 Thread Graham Weldon

Try something like:

if (!class_exists('ParentController')) {
 App::import('Controller', 'ParentController');
}
class ChildController extends ParentController {
 // Imeplement controller as normal
}


Cheers,

Graham Weldon
e. gra...@grahamweldon.com
p. +61 407 017 293
w. http://grahamweldon.com

On 27/07/2009, at 8:22 PM, Michael Gaiser wrote:

 I want to have my UserAdmin controller inherit from my User  
 controller instead of AppController. but it cannot seem to find it.  
 Is there a special way to do this in cake or can I just use and  
 include statment? Thanks.

 ~MJG

 


--~--~-~--~~~---~--~~
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: Cakephp multilingual

2009-07-27 Thread Yannis

Is that your site .. multilingual works great. Well done!
OK let's try and follow this step by step. If you have the time I
would
appreciate it. Otherwise no worries maybe someone else can help on the
way.

** A **
So I have a table with articles and a table with i18n
I set the core.php: Configure::write('Config.language', 'eng');
so that when I add an article it gets saved on the i18n table as well.

** B **
I guess the next step is to set up the po files.
I am using 3 languages: Greek, Russian, English
The way I see it since there are no final standards for language code
I could use any format (however stick to it)
So for greek: gre / english: eng / russian: rus
I create 3 directories under locale named: gre, eng, rus
then on each directory I create LC_MESSAGES
Then I go to console and have cake i18n extract a single file (all
merged) and copy this file to all 3 directories.
** After this step poedit still generates an error [:6: invalid
nplurals value / :6: field `Language-Team' still has initial default
value ]
** However the file is saved and data exists when re-opened
I Tried changing the core default language to gre (my only method at
the moment) but the translations from the po file do not apply
It seems that the method for the po construction used in the
http://tinyurl.com/4w3d49 differs from mine. He merges all
translations
into 1 file as I see it. And uses variable names on the cakephp files
and gives the actual text from the po files. How can I do that ??

** C **
Step 3 would be to set a way to change the language and reflect that
to the database queries as well on the correct po-file read.
This is where I get stuck. I have stored a few articles using distinct
locale values on the databases but don't know where to go to.
--~--~-~--~~~---~--~~
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: Edit record validation versus New record validation (Solved)

2009-07-27 Thread Rick

I think it only works if you are using the 'id' field in your table.
These tables are legacy tables that don't have an 'id' field as the
primary key.

So I guess in general you can say that isUnique only works if you have
a primary key of 'id'.

Do you agree?

Rick



On Jul 26, 9:18 am, euromark (munich) dereurom...@googlemail.com
wrote:
 isUnique also works for edit!!!
 it does check on id != ownId automatically...

 On 25 Jul., 23:20, Rick will...@gmail.com wrote:

  Found my own answer/solution with this custom validator.  I put this
  in my app_model and then can use it from any model.  You use it as a
  rule as you would any core validator:

  [code]
     var $validate = array(
         'partnumber' = array(
            'rule1' = 'validateUniqueness',
            'message' = 'This part number is not unique')
         )
  [/code]

  And the code is:

  [code]
          /**
           * Fails if given value for field is not unique for that field in 
  the
  table.
           *
           * @param type $fieldData - array(fieldname = fieldvalue)
           * @return type - true if unique.
           */
          function validateUniqueness($fieldData) {
                  $fields = array_keys($fieldData);
                  $fieldName = $fields[0];

                  $values = array_values($fieldData);
                  $fieldValue = $values[0];

                  // To determine whether we are going to insert (new) or 
  update
  (edit)
                  // get the current row ID.  If empty then this is a new 
  record
                  // if not then it is an edit record.

                  // If this is an edit then exclude the currentRow (the one 
  we are
                  // editing) from the uniqueness test by adding a condition.

                  $currentID = $this-getID();
                  if (!empty($currentID) or $currentID = 0) {
                          $rowID = 
  $this-data[$this-name][$this-primaryKey];
                          $condition = ' AND ' . $this-name . '.' . 
  $this-primaryKey !=
  '$rowID';
                  } else {
                          $condition = '';
                  }

                  if ($this-findCount($fieldName = '$fieldValue' 
  $condition, -1) 
  0) {
                          return false;
                  } else {
                          return true;
                  }
          }
  [/code]

  Rick


--~--~-~--~~~---~--~~
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: Searching non existent related models

2009-07-27 Thread iFeghali

Thank you Jaydeep. Now how do I do the same for a HABTM ? It is not
joined in the query by default.

On 27 jul, 05:25, Jaydeep Dave jaydipd...@gmail.com wrote:
 try:

 $this-paginate['conditions'] = array(
      'OR' = array (
          'User.name IS' = 'NULL',
          'Recipe.id IS' = ' NULL'
      )
  );

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



uploading file to directory

2009-07-27 Thread Farjad

i found $form-file() method to upload a file but i dont know how to
specify the path to which the file should b uploaded!

i call the method, i specify the path of file to be uploaded then
submit form but dont know where file goes

can anyone help and explain the process of file method and parameters
that it takes.
--~--~-~--~~~---~--~~
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: Cakephp multilingual

2009-07-27 Thread leop

The site is one I did a while back.

I will have access to the code when I get home - about 3-4 hours from
the timestamp on this comment.

I used poedit to do the extraction, not the console as, like you, I
found it very buggy.

The rest I'll check later and get back to you.

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



data SAVE when clicking back button - (wizard component)

2009-07-27 Thread toka...@gmail.com

Hi, anybody has tried saving data when going back in the wizard
component?

Wizard is working nice and is keeping data when going forward. I need
to save data when clicking the back button. Anybody knows how?

Imagine you put some data on STEP2 but you have not continued yet. you
go back to STEP1 and then to STEP2 and data from STEP2 were not saved
- naturally - you did not clicked continue to STEP3 yet.


so ...


I have added ONE line of code... it working ALMOST perfectly, but it
tells me not valid step ERROR in case I am returning from the LAST
step!
..
} elseif (isset($this-controller-params['form']['Previous'])  prev
($this-steps)) {
this-save();//MODIFIED - added ... performs save of data when going
to back-step
..
It only happens on last step. maybe it has something to do with array
pointers. Anybody tried that solution??

Thanks
Tomas


Component:
http://bakery.cakephp.org/articles/view/wizard-component-1-2-1
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Form fields repopulating with default data.

2009-07-27 Thread Shaun

I have a form field named user_first_name with no default value.  When
a user named Fred completes this field correctly, but enters invalid
data in another field such as user_password, user_first_name is
automatically repopulated with Fred so Fred doesn't need to write
his first name again.  Nice!

However, I also have a form field named user_birth_year with a default
value of .  Fred enters a valid birth year, but an invalid
password.  Rather than saving his correct birth year, the field is
automatically repopulated with .

How can this be avoided?  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: Cakephp multilingual

2009-07-27 Thread Yannis

I have managed to make the po files work.
All I did was rename them to default.po
and it worked. I'm still changing the language
through core.php though.

thank you very much leop

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



Dutch CakePHP get together

2009-07-27 Thread Primeminister

Message for dutch bakers:
http://www.cake-toppings.com/2009/07/23/koffie-met-cake/
Please leave a reply so that we now with how many we are...

Dates will be provided next week.
Cheers!
- Charlie
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



validates() not working on all functions...

2009-07-27 Thread number9

I'm using a validates function in a model in order to validate image
uploads. I want to validate the filetype, and also make it required.

I know cake has built in validation for these, but I could never get
it to work. The image upload component I am using uses an array,
accessible via $this-data['Img']['pic'].

The problem I am having, is that the /add/ function works great, but
when I use the image field (Img.pic) on another function (/
edit_image/) the validation function isn't applied.

Here is the model code:

function validates()
{

$image = $this-data['Img']['pic']['name'];
// Grab the file extension:
$path = pathinfo($image);
$filetype = $path['extension'];

if(!empty($image)) {

if (($filetype != 'JPG')  ($filetype != 'jpg')  ($filetype 
!=
'GIF')  ($filetype != 'gif')  ($filetype != 'JPEG')  ($filetype !
= 'jpeg'))
{
$this-invalidate('Img.pic');
}
}
else {
$this-invalidate('Img.pic');
}


$errors = $this-invalidFields();
return count($errors) == 0;
}

Is there something I have to include in the controller to make the
above happen automatically?

I would appreciate any guidance on this, I can include more code if
requested.

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: Searching non existent related models

2009-07-27 Thread Jaydeep Dave
Nevery used HAMBT
but u can try something like
http://www.nabble.com/Conditions-on-2-models-with-the-relationship-hasMany-td24387079.html


On Mon, Jul 27, 2009 at 6:22 PM, iFeghali igor.fegh...@gmail.com wrote:


 Thank you Jaydeep. Now how do I do the same for a HABTM ? It is not
 joined in the query by default.

 On 27 jul, 05:25, Jaydeep Dave jaydipd...@gmail.com wrote:
  try:
 
  $this-paginate['conditions'] = array(
   'OR' = array (
   'User.name IS' = 'NULL',
   'Recipe.id IS' = ' NULL'
   )
   );

 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: How to inheirt form other controllers?

2009-07-27 Thread Michael Gaiser
When I try that, I end up with this error

*Fatal error*: Class 'LocationController' not found in *
C:\wamp\www\theinconnu\app\controllers\locationmanager_controller.php* on
line *6

*So for the parent controller name, do I use 'Location' or
'LocationController'?

On Mon, Jul 27, 2009 at 12:31 PM, Graham Weldon gra...@grahamweldon.comwrote:


 Try something like:

 if (!class_exists('ParentController')) {
 App::import('Controller', 'ParentController');
 }
 class ChildController extends ParentController {
 // Imeplement controller as normal
 }


 Cheers,

 Graham Weldon
 e. gra...@grahamweldon.com
 p. +61 407 017 293
 w. http://grahamweldon.com

 On 27/07/2009, at 8:22 PM, Michael Gaiser wrote:

  I want to have my UserAdmin controller inherit from my User
  controller instead of AppController. but it cannot seem to find it.
  Is there a special way to do this in cake or can I just use and
  include statment? Thanks.
 
  ~MJG
 
  


 


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



Re: Changing field type in scaffold form

2009-07-27 Thread Marcelo Andrade

2009/7/24 Antônio Marco idelfonso.alme...@gmail.com:

 Hi, folks!

 FACTS:

 [1] I'm using scaffolding;
 [2] I have a table wich contains a INT2 column named LEVEL. This
 column accepts only values IN (0, 1, 2, 3, 4, 5, 6);
 [3] When the scaffold form is shown, the LEVEL field is a simple *
 TEXT type * field.

 My question is:

 Would be possible to change a * TEXT type * field to a * SELECT type *
 field by manipulating the $this-viewVars OR setting up something in
 the related model OR something else?

I'm not sure, but I think is not possible.  Flexibility is the price
to pay when using scaffold.

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



Strange afterFind notice

2009-07-27 Thread Hols Kay

Good afternoon!

I have a view (rates/index.ctp) that displays data from my model
(models/rate.php). I make a small edit to the data before I send it to
the view, as below:

function afterFind($results) {
foreach ($results as $key = $val) {

if($val['Rate']['daily'] = 0) {
$results[$key]['Rate']['daily'] = Not 
Available;
}
else {
$results[$key]['Rate']['daily'] = 
$results[$key]['Rate']
['daily'];
}
}
return $results;
}

For some reason this gives me the following notice on index.ctp:

Undefined index:  Rate [APP\models\rate.php, line 16]

(line 16 is if($val['Rate']['daily'] = 0) { )

The logic in the afterFind callback works exactly the way it's
supposed to, and 'Not Available' shows up where the value of daily is
0, so there's clearly not an actual problem with the assignment. But
still, the notice...

What is Cake trying to tell me?

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



Re: uploading file to directory

2009-07-27 Thread brian

Farjad, you should read this:

http://www.php.net/manual/en/features.file-upload.php

The easiest thing to do is to debug($this-data) in your action so you
can see how the array is laid out (and if it's correct).

The file is probably in /tmp and you'll still need to move  save the
file from there.


On Mon, Jul 27, 2009 at 9:02 AM, Farjadhabib.far...@gmail.com wrote:

 i found $form-file() method to upload a file but i dont know how to
 specify the path to which the file should b uploaded!

 i call the method, i specify the path of file to be uploaded then
 submit form but dont know where file goes

 can anyone help and explain the process of file method and parameters
 that it takes.
 


--~--~-~--~~~---~--~~
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: data SAVE when clicking back button - (wizard component)

2009-07-27 Thread toka...@gmail.com

Hi, I got it working after some time of debuging the component.

I have changed _getExpectedStep() function a bit... see comments below
what was added and why.

Now it saves data when going back on all steps !!

Tomas



/**
 * Finds the first incomplete step (i.e. step data not saved in
Session).
 * MODIFIED by Tomas - if using save on BACK button, last step is
saved as well
 * so this function needed to be modified to return last step as the
expected one
 * in case that we already have all steps completed, but not submited
totaly.
 * -- this function must return expected step for stepValidation.
until this change
 * it was not returning anything, and back step was not valid.
 *
 * @return string $step or false if complete
 * @access protected
 */
function _getExpectedStep() {
$steps_done = 0;MODIFIED - added
foreach ($this-steps as $step) {

//debug($this-Session-read($this-_sessionKey.$step));
if (!$this-Session-check($this-_sessionKey.$step)) 
{
$this-config('expectedStep', $step);
return $step;
} else {
$steps_done++;//MODIFIED - added
}
//MODIFIED - added if().
//in case that all steps are completed = return last 
step as the
expected one
if($steps_done == sizeof($this-steps)){
return end($this-steps);
}
}
return false;
}




On Jul 27, 3:49 pm, toka...@gmail.com toka...@gmail.com wrote:
 Hi, anybody has tried saving data when going back in the wizard
 component?

 Wizard is working nice and is keeping data when going forward. I need
 to save data when clicking the back button. Anybody knows how?

 Imagine you put some data on STEP2 but you have not continued yet. you
 go back to STEP1 and then to STEP2 and data from STEP2 were not saved
 - naturally - you did not clicked continue to STEP3 yet.

 so ...

 I have added ONE line of code... it working ALMOST perfectly, but it
 tells me not valid step ERROR in case I am returning from the LAST
 step!
 ..} elseif (isset($this-controller-params['form']['Previous'])  prev

 ($this-steps)) {
 this-save();//MODIFIED - added ... performs save of data when going
 to back-step
 ..
 It only happens on last step. maybe it has something to do with array
 pointers. Anybody tried that solution??

 Thanks
 Tomas

 Component:http://bakery.cakephp.org/articles/view/wizard-component-1-2-1
--~--~-~--~~~---~--~~
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 inheirt form other controllers?

2009-07-27 Thread brian

On Mon, Jul 27, 2009 at 10:32 AM, Michael Gaisermjgai...@gmail.com wrote:
 When I try that, I end up with this error

 Fatal error: Class 'LocationController' not found in
 C:\wamp\www\theinconnu\app\controllers\locationmanager_controller.php on
 line 6

You might have to include the path:

http://api.cakephp.org/class/app#method-Appimport

 So for the parent controller name, do I use 'Location' or
 'LocationController'?

Location would be the name of the model. If your class file says
class LocationController ... at the top, that's the name to use.
Although it really should be LocationsController.

But I wonder if you'd be better off without importing one controlller
into another. You began by mentioning something called UserAdmin,
which suggests that you could just stick with Users and admin routing.
Where does this LocationController fit in?

--~--~-~--~~~---~--~~
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 write one single query for fetching data from two tables

2009-07-27 Thread RWS - Bharat Maheriya
Hello

you can define model association between agent and device and perform find
operation  with condition agents.verified=1only..CakePHP association perfom
internal joining and give you expected result. you can try out with this...

Thanks


On Wed, Jul 22, 2009 at 7:17 PM, mona poojapinj...@gmail.com wrote:


 How to write the folowing query in cakephp

  $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid = agents.uid and agents.verified=1
 limit 100;

 Followin is my controller file

 class AgentsController extends AppController {
var $name = 'Agents';
var $helpers =
 array('Html','Form','Xml','Text','Javascript','Ajax');
var $uses = array( 'Agent','Device');
var $components = array('RequestHandler');


function admin_exportDevice(){
$this-_adminOnly();
$export = trim($this-data['deviceExport']['export']);
if($export=='Full'){
   $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid =   agents.uid and agents.verified=1
 limit 100;
  $qry = mysql_query($sql);
$this-set('qry', $qry);
$this-set('filename', 'Full'.date(Ymd).'.xml');
$this-layout='ajax';

$sql1 = Update devices set export=1 where export=0;
$query = mysql_query($sql1);
}
 else{
   $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid = agents.uid and agents.verified=1
 and devices.export=0 limit 2;
$qry = mysql_query($sql);
$this-set('qry', $qry);
$this-set('filename', 'Incremental'.date(Ymd).'.xml');
$this-layout='ajax';
$sql1 = Update devices set export=1 where export=0;
$query = mysql_query($sql1);

  }
}
 }
 


--~--~-~--~~~---~--~~
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 inheirt form other controllers?

2009-07-27 Thread Michael Gaiser
Well, my users and locations use the same setup. I have split up my normal
controller into 2 parts so I can have different permissions and functions.
ie, I don't want normal users to be able to delete user records, only
admins. So instead of having all my functions have an admin test, which
would seem to be ignoring the ACL stuff.

With the 2 controllers, I can set the user controller to just have the
standard user functions, but then have the UsersAdmin controller require
that the user is an admin to access it. It also allows for separate
functions so that the user can edit their account settings, but with limited
access. Only the Admin can edit the username and stuff like that. If there
is a better way to be using the Auth component, I would love to hear it, but
having the controller split into normal/admin seems to be the only way I
found to make it work. And since there is a ton of shared code between them,
I wanted to have the admin inherit from the normal, then add in the
additional functionality.

So that's where I am right now. I hope that sheds some light on what I am
trying to accomplish.

~Michael

On Mon, Jul 27, 2009 at 4:46 PM, brian bally.z...@gmail.com wrote:


 On Mon, Jul 27, 2009 at 10:32 AM, Michael Gaisermjgai...@gmail.com
 wrote:
  When I try that, I end up with this error
 
  Fatal error: Class 'LocationController' not found in
  C:\wamp\www\theinconnu\app\controllers\locationmanager_controller.php on
  line 6

 You might have to include the path:

 http://api.cakephp.org/class/app#method-Appimport

  So for the parent controller name, do I use 'Location' or
  'LocationController'?

 Location would be the name of the model. If your class file says
 class LocationController ... at the top, that's the name to use.
 Although it really should be LocationsController.

 But I wonder if you'd be better off without importing one controlller
 into another. You began by mentioning something called UserAdmin,
 which suggests that you could just stick with Users and admin routing.
 Where does this LocationController fit in?

 


--~--~-~--~~~---~--~~
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: uploading file to directory

2009-07-27 Thread Vijay Kumbhar
Hello Farjad,

There is a file uploading component in the cakephp.

Please check the following links,

http://bakery.cakephp.org/articles/view/file-upload-component-w-automagic-model-optional

http://www.reversefolds.com/articles/show/filehandler


On Mon, Jul 27, 2009 at 9:02 PM, brian bally.z...@gmail.com wrote:


 Farjad, you should read this:

 http://www.php.net/manual/en/features.file-upload.php

 The easiest thing to do is to debug($this-data) in your action so you
 can see how the array is laid out (and if it's correct).

 The file is probably in /tmp and you'll still need to move  save the
 file from there.


 On Mon, Jul 27, 2009 at 9:02 AM, Farjadhabib.far...@gmail.com wrote:
 
  i found $form-file() method to upload a file but i dont know how to
  specify the path to which the file should b uploaded!
 
  i call the method, i specify the path of file to be uploaded then
  submit form but dont know where file goes
 
  can anyone help and explain the process of file method and parameters
  that it takes.
  
 

 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

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



Which Server OS to choose

2009-07-27 Thread Kau-Boy

I bought a new root server as my hoster has a very bad support on the
managed servers. Now I have to choose a good OS to run a Webserver for
my first big CakePHP project.

So I want to ask the community which OS to choose. I have to say, that
I am not a linux expert The only OS I have used is Ubuntu Desktop. I
am very happy how easy it is to apt-get install a new software. But
how about update to a new version of PHP or MySQL. What are the
arguments for or against Ubuntu and which OS would you suggest?

Here is a list of OS' I can choose from:

openSUSE 11
CentOS 5
Debian 4.0 (etch)
Ubuntu 8.04 LTS
Ubuntu 6.06 LTS

I hope that this post will also help others, who have to decide which
OS to choose!
--~--~-~--~~~---~--~~
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 write one single query for fetching data from two tables

2009-07-27 Thread Vijay Kumbhar
Yes , RWS - Bharat Maheriya  is right.

If you are writing queries for joins in the fabulous framework like cakephp
then what is the need to us the framwork.
Cakephp has a good feature of associations so please use that to join the
tables.
You have to write custom queries only few times  it is negligible.

So my suggestion is dont break the rules of the framework.

On Mon, Jul 27, 2009 at 11:33 AM, RWS - Bharat Maheriya 
rws.bha...@gmail.com wrote:

 Hello

 you can define model association between agent and device and perform find
 operation  with condition agents.verified=1only..CakePHP association perfom
 internal joining and give you expected result. you can try out with this...

 Thanks



 On Wed, Jul 22, 2009 at 7:17 PM, mona poojapinj...@gmail.com wrote:


 How to write the folowing query in cakephp

  $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid = agents.uid and agents.verified=1
 limit 100;

 Followin is my controller file

 class AgentsController extends AppController {
var $name = 'Agents';
var $helpers =
 array('Html','Form','Xml','Text','Javascript','Ajax');
var $uses = array( 'Agent','Device');
var $components = array('RequestHandler');


function admin_exportDevice(){
$this-_adminOnly();
$export = trim($this-data['deviceExport']['export']);
if($export=='Full'){
   $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid =   agents.uid and agents.verified=1
 limit 100;
  $qry = mysql_query($sql);
$this-set('qry', $qry);
$this-set('filename', 'Full'.date(Ymd).'.xml');
$this-layout='ajax';

$sql1 = Update devices set export=1 where export=0;
$query = mysql_query($sql1);
}
 else{
   $sql = select
 devices.uid,devices.agent,devices.capabilities,devices.localcaps from
 devices,agents where devices.uid = agents.uid and agents.verified=1
 and devices.export=0 limit 2;
$qry = mysql_query($sql);
$this-set('qry', $qry);
$this-set('filename', 'Incremental'.date(Ymd).'.xml');
$this-layout='ajax';
$sql1 = Update devices set export=1 where export=0;
$query = mysql_query($sql1);

  }
}
 }



 



-- 
Thanks  Regards,
Vijayk.
Co-founder (www.weboniselab.com)

You Bring the Dreams, We'll Bring the Means

--~--~-~--~~~---~--~~
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: keep hitting mysql memory limit, even in Cake Shell when exporting large xml file

2009-07-27 Thread Walther

That is not a MySQL error but a PHP memory error probably related to
the opening and processing of the 50mb file.

You can use ini_set('memory_limit', '128M'); to change the memory
limit for the request (Change the 128M as required)

On Jul 27, 4:27 am, Dr. Loboto drlob...@gmail.com wrote:
 You should make sure, that you free memory between chunks requests.
 And do not try to output all this 25 Mb file at once, it also should
 be done chunk-by-chunk. Remember, that PHP do not have automatic
 garbage collector so you should unset no longer needed variables.

 On Jul 26, 10:02 pm, JamesF usaexportexpe...@gmail.com wrote:

  i have paginated the results and no matter how i chunk it it still
  fills up the mysqli result set and hits the memory limit. i need to be
  able to flush the result set between each iteration.

  On Jul 26, 6:33 am, Jaydeep Dave jaydipd...@gmail.com wrote:

   You can try something like this in your shell

   ?php

   ...
   ..

   $page = 1;

   while(1) {

            $records = $this-findAll(conditions' = array(bla bla bla),
   'fields' = 'Model.*' ,'limit' = 50, 'page' = $page);

            if($records) {
                 // Write Your XML in a File.
            }else{
                  break;
            }

           $page = $page + 50;

   }

   This will help you a lot.

   Regards,

   Jaydeep Dave

   On Sun, Jul 26, 2009 at 1:41 AM, majna majna...@gmail.com wrote:

Try with :
$mysqli = ConnectionManager::getDataSource('default');
$mysqli-disconnect();
$mysqli-connect();

debug($mysqli-connected);
debug($mysqli-connection);

On Jul 26, 7:55 am, JamesF usaexportexpe...@gmail.com wrote:
 MY PROBLEM:
 i am running into a wall with this one. basically i have a large xml
 file that i am rendering using XmlHelper. We are talking about a
 25-50mb file. This is basically a product data feed. I have tried
 quite a few methods to overcome the memory limit but no luck.

 MY ERROR:
 Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to
 allocate 53 bytes) in /home/username/usr/cakedev/cake/libs/model/
 datasources/dbo/dbo_mysqli.php on line 402

 WHAT I HAVE DONE TO TRY AND FIX IT:

 1) Initially i set this up to render through the web in one
 shotthis cause execution limit timeouts and memory errors.

 2)I broke up the data requests in seperate chunks of 500 records using
 internal method calls, like $listings = $this-getListings($start_id,
 $limit); This caused the same problem

 3) I set the whole thing up via the cake shell interface. It works
 great except for the fact that i keep running up against the same
 limit, even with staggered chunks of records in different method
 calls.

 MY GUESS:
 is that Cake is keeping an open connection with the database for the
 life of the script.

 MY SPECIFIC QUESTIONS:
 can i disconnect and reconnect from the database inside of the script?
 specifically can i do this in a cake shell script? will this solve my
 memory problem? am i going about this the wrong way entirely?

 thanks again anyone who has some advice!

   --
   Regards,

   Jaydeep Dave
   Mobile: +919898456445
   Email: jaydipd...@yahoo.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
-~--~~~~--~~--~--~---



How to remove items from $this-data

2009-07-27 Thread DavidH

Hi

I'm using CakePHP 1.2.3.8166 with PHP 5.2.9 on Apache 2.10

I'm hoping someone will give me a hand with what is essentially a PHP
question as oposed to a question about CakePHP.

I'm returning this data array from my add.ctp view:

Array
(
[Chart] = Array
(
[title] = Test Chart
[chart_type_id] = 1
[width] = 128
[height] = 128
)

[ChartsKpi] = Array
(
[1] = Array
(
[kpi_id] = 1
[kpi_colour_id] = 2
[width] = 5
)
[2] = Array
(
[kpi_id] = 2
[kpi_colour_id] = 3
[width] = 5
)
[3] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[4] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[5] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[6] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[16] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[17] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
...
)
)

You see all the sub arrays of [ChartsKpi] that have a kpi_id == 0? I
dont want to save those so I've a beforeSave callback in my ChartsKpi
model and I was trying to unset($this-data['ChartsKpi'][x]); but this
isn't working.

Is there an accepted way for taking data out of $this-data before
doing a save?

Thanks

David

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



Re: Which Server OS to choose

2009-07-27 Thread DavidH

My own preference is for OpenSuse 11. I was using Ubuntu (version 7.x
and then 8.x); but I had issues with authorization taking a long time.
This was annoying when saving files from Dreamweaver on my desktop
over ftp sessions to the server. In the end I got fed up with it and
switched (back to) SuSE.

On Jul 27, 5:42 pm, Kau-Boy bernhard...@gmail.com wrote:
 I bought a new root server as my hoster has a very bad support on the
 managed servers. Now I have to choose a good OS to run a Webserver for
 my first big CakePHP project.

 So I want to ask the community which OS to choose. I have to say, that
 I am not a linux expert The only OS I have used is Ubuntu Desktop. I
 am very happy how easy it is to apt-get install a new software. But
 how about update to a new version of PHP or MySQL. What are the
 arguments for or against Ubuntu and which OS would you suggest?

 Here is a list of OS' I can choose from:

 openSUSE 11
 CentOS 5
 Debian 4.0 (etch)
 Ubuntu 8.04 LTS
 Ubuntu 6.06 LTS

 I hope that this post will also help others, who have to decide which
 OS to choose!
--~--~-~--~~~---~--~~
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 Ajax to dynamically update a select box

2009-07-27 Thread j0sch

I am trying to use a select box to update another select box using
ajax.  I have two tables: locations and nodes, and Locations hasMany
Nodes and Nodes belongsTo Locations.  I want a locations select box to
update the nodes select box with all the nodes that are at that
location.
I've been to multiple forums with great tutorials explaining how this
works, but I follow their directions exactly and it never works.
I am brand new to any type of AJAX development, and I have only been
developing with CakePHP for a couple weeks now.

Here is the code:

In my controller:

function update_select() {
if(!empty($this-data)) {
$locationId = $this-data['Location']['id'];
$options = $this-Iface-Node-find('list', 
array('conditions'=array
('Node.location_id'=$locationId)));
$this-set('options', $options);
$this-render('update_select');
}
}

In my view:

?php echo $form-input('Location.id', array
('type'='select','options'=$locations, 'id' = 'LocationId',
'label'='Location')); ?
?php echo $form-input('Node.id', array('type'='select', 'options'=
$nodes,'id' = 'NodeId', 'label'='Node')); ?

In my update_select.ctp:

?php foreach ($options as $i = $option): ?
option value=?php echo $i; ??php echo $option; ?/option
?php endforeach; ?


(I have Ajax and Javascript helpers, RequestHandler component, and
prototype all defined)

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



Bypassing Security Salt

2009-07-27 Thread Steppio

Hi there,
I was wondering if anybody knows a way to bypass the salting that the
Security component automatically gives to a password?

The problem is that i have a database of old passwords and im
converting the site into a CakePHP site, however when im trying to log
in to the new site the password being returned by the debugger appears
to have been salted and therefore doesnt conform to my original, non-
salted sha1 password.

Any help would be greatly appreciated.

Thank you!

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



Router URLs: hyphens instead of underscores

2009-07-27 Thread Jamie

Yes, I know this issue has been raised in the past (a long while ago),
but there's been no satisfying answer yet.

Basically, best SEO practices say that we should be using hyphens
instead of underscores in our URLs, since search engines such as
Google have an easier time parsing my-page, rather than my_page,
as two separate words (and thus a distinct search term). Is it time
for Cake to look at allowing hyphens instead of underscores in URLs?

Before anyone says OMG you can just do this (as Nate suggested at
http://trac.cakephp.org/ticket/1727 ):

$_GET['url'] = str_replace(-, _, $_GET['url']);

that's fine for parsing incoming URLs, but it doesn't even come close
to providing a solution since links generated by the Cake router (i.e.
via the HtmlHelper etc.) use underscores instead of hyphens, and
that's that. So for those of us who want to use hyphens instead of
dashes, we need to enter manual URLs instead of using Cake's routing
capabilities. So, sure, we can translate incoming links, but we can't
generate the proper links in the first place.

Has anyone thought of a solution? Is the Cake team contemplating
adding support for multiple URL separators? Any home brew hacks out
there?

- Jamie
--~--~-~--~~~---~--~~
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: Bypassing Security Salt

2009-07-27 Thread Piotr Kilczuk

Hello,

 I was wondering if anybody knows a way to bypass the salting that the
 Security component automatically gives to a password?

 The problem is that i have a database of old passwords and im
 converting the site into a CakePHP site, however when im trying to log
 in to the new site the password being returned by the debugger appears
 to have been salted and therefore doesnt conform to my original, non-
 salted sha1 password.

I'll be experiencing similar things in next few days (basically I have
a IPB user database that I need to authenticate against). Does
http://book.cakephp.org/view/566/Change-Hash-Function help you?


Regards,
Piotr

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



HABTM and extra foreign keys

2009-07-27 Thread matias

Hi!
I have a problem. I want to link relational table of two habtm tables
with another one.
I have table `types` (id, name) that is habtm `characteristics` (id,
name). Their rel table is `characteristics_types` (id,
characteristic_id, type_id). I want to link each record from this
table with many records in 4th table `options` (id, name,
characteristics_types_id).
But it doesnt work. Cake says Undefined property:  Property::
$CharacteristicsType. Can somebody help me? please?

--~--~-~--~~~---~--~~
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: Router URLs: hyphens instead of underscores

2009-07-27 Thread Jamie

Alright, so what I just ended up doing was adding a bit of a hack to
cake/libs/router.php and app/config/bootstrap.php.

In the Router::url(), I changed the last line:

return $output . $extension . $_this-queryString($q, array(),
$escape) . $frag;

To this:

$url = str_replace('_', '-', $output . $extension . $_this-queryString
($q, array(), $escape) . $frag);
return $url;

Then I added this to the top of my bootstrap:

$_GET['url'] = str_replace('-', '_', $_GET['url']);

Total hack? You betcha. But it works for now.


On Jul 27, 10:56 am, Jamie jamie@gmail.com wrote:
 Yes, I know this issue has been raised in the past (a long while ago),
 but there's been no satisfying answer yet.

 Basically, best SEO practices say that we should be using hyphens
 instead of underscores in our URLs, since search engines such as
 Google have an easier time parsing my-page, rather than my_page,
 as two separate words (and thus a distinct search term). Is it time
 for Cake to look at allowing hyphens instead of underscores in URLs?

 Before anyone says OMG you can just do this (as Nate suggested 
 athttp://trac.cakephp.org/ticket/1727):

 $_GET['url'] = str_replace(-, _, $_GET['url']);

 that's fine for parsing incoming URLs, but it doesn't even come close
 to providing a solution since links generated by the Cake router (i.e.
 via the HtmlHelper etc.) use underscores instead of hyphens, and
 that's that. So for those of us who want to use hyphens instead of
 dashes, we need to enter manual URLs instead of using Cake's routing
 capabilities. So, sure, we can translate incoming links, but we can't
 generate the proper links in the first place.

 Has anyone thought of a solution? Is the Cake team contemplating
 adding support for multiple URL separators? Any home brew hacks out
 there?

 - Jamie
--~--~-~--~~~---~--~~
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 remove items from $this-data

2009-07-27 Thread j0sch

I know php has a built-in function called array_filter().  Check the
php manual ( http://us3.php.net/array_filter  ) to see if it does what
you want.
--~--~-~--~~~---~--~~
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: Bypassing Security Salt

2009-07-27 Thread Steppio

Yes thanks that helps a little, still a tad confusing though. I've
found a few more links that may be of interest to us both:

http://www.nabble.com/Auth-%3Eauthenticate-in-beforeFilter-causes-Auth-issues-td24231179.html
http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/

I'll keep looking, thanks for your help!

Ste

On Jul 27, 7:10 pm, Piotr Kilczuk kilc...@gmail.com wrote:
 Hello,

  I was wondering if anybody knows a way to bypass the salting that the
  Security component automatically gives to a password?

  The problem is that i have a database of old passwords and im
  converting the site into a CakePHP site, however when im trying to log
  in to the new site the password being returned by the debugger appears
  to have been salted and therefore doesnt conform to my original, non-
  salted sha1 password.

 I'll be experiencing similar things in next few days (basically I have
 a IPB user database that I need to authenticate against). 
 Doeshttp://book.cakephp.org/view/566/Change-Hash-Functionhelp you?

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



Re: Using Ajax to dynamically update a select box

2009-07-27 Thread j0sch

I forgot that this is also in my view:
-
?php
$options = array('url' = 'update_select', 'update' = 'NodeId');
echo $ajax-observeField('LocationId', $options);
?
-

I think that AJAX isn't working for me at all.  I also am trying to
submit an ajax form, but I can't get that working either.
--~--~-~--~~~---~--~~
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: Strange afterFind notice

2009-07-27 Thread Hols Kay

For anybody who might be having the same thing, the problem was due to
my failing to encapsulate my data :)

I needed a setter method to manipulate the results, just like in the
Cookbook ( http://book.cakephp.org/view/681/afterFind ), heh.
--~--~-~--~~~---~--~~
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: HABTM and extra foreign keys

2009-07-27 Thread DavidH

Hi Matias

What are the relationships between options and characteristic_types?
How have you defined that relationship in the models?

Where do you get that error message? I suspect the problem is
somewhere in the models.

David

On Jul 27, 6:36 pm, matias matias.ale...@gmail.com wrote:
 Hi!
 I have a problem. I want to link relational table of two habtm tables
 with another one.
 I have table `types` (id, name) that is habtm `characteristics` (id,
 name). Their rel table is `characteristics_types` (id,
 characteristic_id, type_id). I want to link each record from this
 table with many records in 4th table `options` (id, name,
 characteristics_types_id).
 But it doesnt work. Cake says Undefined property:  Property::
 $CharacteristicsType. Can somebody help me? please?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SecurityComponent::requireAuth : when?

2009-07-27 Thread Lucas Costa

Hello fellows, I think there's a lack of examples of the use of
SecurityComponent's requireAuth method.

What is indeed the purpose of this method?

What vulnerabilities does it cover?

Is it or how is it related to the AuthComponent?

Could you give some examples of the right use?

Thank you all.

Lucas Costa

--~--~-~--~~~---~--~~
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: SecurityComponent::requireAuth : when?

2009-07-27 Thread Jaydeep Dave
Hi Lucas,
I think it blocks the page using http authentication method (similar to
.htpasswd)



On Mon, Jul 27, 2009 at 10:34 AM, Lucas Costa lucasrco...@gmail.com wrote:


 Hello fellows, I think there's a lack of examples of the use of
 SecurityComponent's requireAuth method.

 What is indeed the purpose of this method?

 What vulnerabilities does it cover?

 Is it or how is it related to the AuthComponent?

 Could you give some examples of the right use?

 Thank you all.

 Lucas Costa

 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: How to remove items from $this-data

2009-07-27 Thread Jaydeep Dave
Create a function in your controller:
private function filter_my_data()
{
   unset($this-data['ChartsKpi'][x]);
}

// And use it in your add/edit functions


function add() {
   if(!empty($this-data)) {
   $this-filter_my_data();
   ...
   ... // Save Data
   }
}

On Mon, Jul 27, 2009 at 8:51 AM, DavidH djhollingwo...@gmail.com wrote:


 Hi

 I'm using CakePHP 1.2.3.8166 with PHP 5.2.9 on Apache 2.10

 I'm hoping someone will give me a hand with what is essentially a PHP
 question as oposed to a question about CakePHP.

 I'm returning this data array from my add.ctp view:

 Array
 (
[Chart] = Array
(
[title] = Test Chart
[chart_type_id] = 1
[width] = 128
[height] = 128
)

[ChartsKpi] = Array
(
[1] = Array
(
[kpi_id] = 1
[kpi_colour_id] = 2
[width] = 5
)
[2] = Array
(
[kpi_id] = 2
[kpi_colour_id] = 3
[width] = 5
)
[3] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[4] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[5] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[6] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[16] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
[17] = Array
(
[kpi_id] = 0
[kpi_colour_id] =
[width] =
)
 ...
)
 )

 You see all the sub arrays of [ChartsKpi] that have a kpi_id == 0? I
 dont want to save those so I've a beforeSave callback in my ChartsKpi
 model and I was trying to unset($this-data['ChartsKpi'][x]); but this
 isn't working.

 Is there an accepted way for taking data out of $this-data before
 doing a save?

 Thanks

 David

 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: Bypassing Security Salt

2009-07-27 Thread Miles J

Just set the configure salt to empty.
--~--~-~--~~~---~--~~
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: uploading file to directory

2009-07-27 Thread Miles J

Or you can test out my robust uploader plugin :]

http://www.milesj.me/resources/script/uploader-plugin
--~--~-~--~~~---~--~~
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 HBTM tables. (included image)

2009-07-27 Thread Carlos Suarez Fontalvo

Excuse me, but, nobody has answer me. It's anyone here can help me?.
tnx 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
-~--~~~~--~~--~--~---



Deleting items and their children if they belongTo

2009-07-27 Thread Taff

I'm luvin cakephp at the moment, in particular how fast things get
done, and all the hidden functionality that automagically happens. I
was wondering if there is a simple way to do the following:

I have baked a few controllers, models and views, but if I delete an
item using threads/delete/3 is there an easy way of deleting all the
posts (with an thread_id of 3) that belongTo the thread with an id
of 3, which I have defined as hasMany posts, or do I need to do it
manually?

Thanks for any pointers!
Taff

--~--~-~--~~~---~--~~
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: Session/Cookie problem with Facebook JS + PHP

2009-07-27 Thread Eric

Just as a followup, I have had no side effects using localhost.com ...
and it definitely did not work using localhost

On Jul 21, 7:10 am, rchavik rcha...@gmail.com wrote:
 I agree.

 A better way would be to stage your application with myapp.com (or
 whatever name you want), and set that in your hosts file.

 You'll need to adjust your Facebook App setting and your apache
 configuration to reflect this change.

 On Jul 21, 6:56 pm, Smelly Eddie ollit...@gmail.com wrote:



  Something is wrong

  removing localhost from your hosts file may have  a negative impact on
  any applications that expect localhost, a de facto standard, to be the
  local loopback address. Besides that it should not affect cookies from
  another domain.

  Although the two may be related, I don't think you should declare
  victory yet.

  On Jul 20, 2:19 am, eric.winch...@gmail.com

  eric.winch...@gmail.com wrote:
   The bad news is I am an idiot.

   The good news is the solution is to not use LOCALHOST. I changed C:
   \Windows\System32\drivers\etc\hosts 'localhost' to 'localhost.com' and
   Facebook cookies work the way they should.

   On Jul 19, 11:12 pm, eric.winch...@gmail.com

   eric.winch...@gmail.com wrote:
More information:

I checked to be sure Facebook is instantiating correctly. I think
CakePHP is preventing the Facebook class from getting the cookie data.
Facebook::get_valid_fb_params() tries to access $_COOKIE but the only
thing in there is $_COOKIE['CAKEPHP']

There is a weird fix on the FB Wiki but tricking Cake to use
Facebook's session seems like the wrong thing to do.

Given this problem, I don't understand how this 
works:http://cutfromthenorth.com/integrating-facebook-connect-with-cakephps...

On Jul 19, 4:02 pm, eric.winch...@gmail.com

eric.winch...@gmail.com wrote:
 I'm attempting to use Facebook Connect with its PHP library.

 fb:login-button onlogin=update_login_box()/fb:login-button

 That gets the user logged in ok but then using the PHP libs:

 $facebook-get_loggedin_user() is always NULL. Anyone run into this?
 I'm wondering if it has something to do with Cake taking over the
 sessions and cookies.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem handling search form fior multiple values

2009-07-27 Thread NIghtmare327

I have a form I am using to do searches, and am having issues with the
return values from the form.  here is the code segment from the form:

= index.ctp =

?php
echo $form-button('Reset Form', array
('type'='reset', 'style'='width:200px;height:35px'));
echo $form-input('Search.keywords');
echo $form-input('Search.name',array('after'=__
('wildcard is *',true)));
//echo $form-input('Search.vendor_id');
echo $form-input('Search.vendor_id', array('type' =
'select', 'multiple'=true));
echo $form-submit('Search');
?

It shows me the multiple list, but when I print the passed values in
the controller, this is what I get:

Array ( [Search.vendor_id] = Array )

It appears I am getting the word Array back rather than the values of
the selected items.

Any thoughts on this matter?  let me know if you need to see more of
the source to see what is happening.  Just as some background, Vendors
is a lookup table for vendors based on vendor_id obviously.  I want to
be able to do a search based upon multiple vendors rather than just
1.  I have the search for one working, just not this one.  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
-~--~~~~--~~--~--~---



$session-flash() in view displaying a 1

2009-07-27 Thread Taff

Hey,

I baked a controller with the following snippet:

$this-Session-setFlash(__('List has been saved', true));

Why the underscores, and what does true denote, I couldn't find a
reference anywhere?

Also in my view

echo $session-flash();

is returning div id=flashMessage class=messageList has been
saved/div1

After an evening of huntingwhere on earth is that 1 being
generated, and how do I do away with it?

Thanks for any pointers!
Taff

--~--~-~--~~~---~--~~
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: Which Server OS to choose

2009-07-27 Thread Jaydeep Dave
I have used Fedora 9 (Desktop Edition)
Then I switched my complete system to Ubuntu Server Edition.

I liked Ubuntu. Server Edition is really light weight, fast and stable.



On Mon, Jul 27, 2009 at 9:03 AM, DavidH djhollingwo...@gmail.com wrote:


 My own preference is for OpenSuse 11. I was using Ubuntu (version 7.x
 and then 8.x); but I had issues with authorization taking a long time.
 This was annoying when saving files from Dreamweaver on my desktop
 over ftp sessions to the server. In the end I got fed up with it and
 switched (back to) SuSE.

 On Jul 27, 5:42 pm, Kau-Boy bernhard...@gmail.com wrote:
  I bought a new root server as my hoster has a very bad support on the
  managed servers. Now I have to choose a good OS to run a Webserver for
  my first big CakePHP project.
 
  So I want to ask the community which OS to choose. I have to say, that
  I am not a linux expert The only OS I have used is Ubuntu Desktop. I
  am very happy how easy it is to apt-get install a new software. But
  how about update to a new version of PHP or MySQL. What are the
  arguments for or against Ubuntu and which OS would you suggest?
 
  Here is a list of OS' I can choose from:
 
  openSUSE 11
  CentOS 5
  Debian 4.0 (etch)
  Ubuntu 8.04 LTS
  Ubuntu 6.06 LTS
 
  I hope that this post will also help others, who have to decide which
  OS to choose!
 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: Bypassing Security Salt

2009-07-27 Thread Andras Kende

Hello,

You could try in your model:

  function hashPasswords($data){
 return $data;
  }


Andras

On Jul 27, 2009, at 1:53 PM, Steppio wrote:


 Hi there,
 I was wondering if anybody knows a way to bypass the salting that the
 Security component automatically gives to a password?

 The problem is that i have a database of old passwords and im
 converting the site into a CakePHP site, however when im trying to log
 in to the new site the password being returned by the debugger appears
 to have been salted and therefore doesnt conform to my original, non-
 salted sha1 password.

 Any help would be greatly appreciated.

 Thank you!

 Steppio
 


--~--~-~--~~~---~--~~
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 HBTM tables. (included image)

2009-07-27 Thread Jaydeep Dave
Brother, I don't know your problem.  But you can try this.
http://www.google.co.in/search?rlz=1C1CHNG_enIN333IN333sourceid=chromeie=UTF-8q=HBTM

On Mon, Jul 27, 2009 at 11:33 AM, Carlos Suarez Fontalvo 
eng.carlos.sua...@gmail.com wrote:


 Excuse me, but, nobody has answer me. It's anyone here can help me?.
 tnx a lot.
 



-- 
Regards,

Jaydeep Dave
Mobile: +919898456445
Email: jaydipd...@yahoo.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: Problem with HBTM tables. (included image)

2009-07-27 Thread Piotr Kilczuk

Hello,

 Excuse me, but, nobody has answer me. It's anyone here can help me?.
 tnx a lot.

In this case I'm pretty sure that you have to define additional HABTM
keys in TipoUsuario and Modulo - I mean:
joinTable, foreignKey, associationForeignKey. Just get one model
association working 1st, and then you'll get the pattern.

HTH


Regards,
Piotr

--~--~-~--~~~---~--~~
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: Deleting items and their children if they belongTo

2009-07-27 Thread Piotr Kilczuk

Hi,

 I have baked a few controllers, models and views, but if I delete an
 item using threads/delete/3 is there an easy way of deleting all the
 posts (with an thread_id of 3) that belongTo the thread with an id
 of 3, which I have defined as hasMany posts, or do I need to do it
 manually?

Yes:
http://book.cakephp.org/view/78/Associations-Linking-Models-Together#hasMany-82
- see dependent attribute
http://book.cakephp.org/view/516/Deleting-Data#del-690


Regards,
Piotr

--~--~-~--~~~---~--~~
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: Cache not configured properly

2009-07-27 Thread Eric

Thanks - memcached was not installed correctly.

So it was defaulting back to file caching? I didn't realize you can
cache an individual variable with file caching like that. With no load
on the server, it was just as fast.

On Jul 26, 12:04 pm, euromark (munich) dereurom...@googlemail.com
wrote:
 i thought so

 with
 apt-get install php5-memcache

 + editing of php.ini

 BUT i found a typo
 extension=memcached.so  (/etc/php5/apache2/php.ini)
 should be
 extension=memcache.so  (/etc/php5/apache2/php.ini)

 then it works just fine:

 The MemcacheEngine is being used for caching. To change the config
 edit APP/config/core.php 

 On 26 Jul., 17:05, brian bally.z...@gmail.com wrote:



  On Sun, Jul 26, 2009 at 7:48 AM, euromark

  (munich)dereurom...@googlemail.com wrote:

   i doubt that your memcache is working^^
   actually, it falls back to file caching if memcache cannot be used:

   trigger_error('Cache not configured properly. Please check
   Cache::config(); in APP/config/core.php', E_USER_WARNING);
   $cache = Cache::config('default', array('engine' = 'File'));

   you can see that if you check out the default home page (home.ctp in
   cake)

   anyway.. in my case the problem seems to be that there is no
   Memcache class

   $memcache = new Memcache; $memcache-addServer('xxx.xx.xx.xx', 11211);
   $version = $memcache-getVersion(); print_r($memcache-getExtendedStats
   ()); $cacheKey = $memcache-get(cake_homepage); echo($cacheKey);
   echo brServer's version: .$version.br/\n;

   returns

   Fatal error: Class 'Memcache' not found in /home/web/test/comm/views/
   pages/homes.ctp on line 2

   any idea whats missing here?
   thx, mark

  memcached? Is it installed?http://www.danga.com/memcached/
--~--~-~--~~~---~--~~
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: $session-flash() in view displaying a 1

2009-07-27 Thread leafchild

I think you don't need echo

Just type:
?php $session-flash();  ?

I had this issue and after taking echo fixed the the issue.


On Jul 27, 1:04 pm, Taff taff.law...@googlemail.com wrote:
 Hey,

 I baked a controller with the following snippet:

 $this-Session-setFlash(__('List has been saved', true));

 Why the underscores, and what does true denote, I couldn't find a
 reference anywhere?

 Also in my view

 echo $session-flash();

 is returning div id=flashMessage class=messageList has been
 saved/div1

 After an evening of huntingwhere on earth is that 1 being
 generated, and how do I do away with it?

 Thanks for any pointers!
 Taff
--~--~-~--~~~---~--~~
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: Bypassing Security Salt

2009-07-27 Thread Miles J

You can create your own auth.php file in your components, then copy
and paste the original here. Once you have done that, you can
configure the Auth to work how you want it to, without overriding the
core one.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Display months in datetime fields in german

2009-07-27 Thread Bs

Hi,

is it somehow possible to display the months of a datetime field in a
view in german?

--~--~-~--~~~---~--~~
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: Which Server OS to choose

2009-07-27 Thread Kau-Boy

Thanks for your quick and good response.

I have a small virtual server with Ubuntu and I used the Plesk Panel
to create users and ftp accounts. But I also had some problems when
connecting as root and creating folders for the www-data user.

How easy can you install applications on openSUSE. The last Suse I
used was version 6.1 I think. How is the console-based YaST? Are there
always current versions of PHP and MySQL. And how about SVN and Git?
Can you get all the important libraries for web development without
needing to build them on your own? I rarely used configure, make
install.

Is there any good argument against Ubuntu?

On 27 Jul., 19:03, DavidH djhollingwo...@gmail.com wrote:
 My own preference is for OpenSuse 11. I was using Ubuntu (version 7.x
 and then 8.x); but I had issues with authorization taking a long time.
 This was annoying when saving files from Dreamweaver on my desktop
 over ftp sessions to the server. In the end I got fed up with it and
 switched (back to) SuSE.

 On Jul 27, 5:42 pm, Kau-Boy bernhard...@gmail.com wrote:

  I bought a new root server as my hoster has a very bad support on the
  managed servers. Now I have to choose a good OS to run a Webserver for
  my first big CakePHP project.

  So I want to ask the community which OS to choose. I have to say, that
  I am not a linux expert The only OS I have used is Ubuntu Desktop. I
  am very happy how easy it is to apt-get install a new software. But
  how about update to a new version of PHP or MySQL. What are the
  arguments for or against Ubuntu and which OS would you suggest?

  Here is a list of OS' I can choose from:

  openSUSE 11
  CentOS 5
  Debian 4.0 (etch)
  Ubuntu 8.04 LTS
  Ubuntu 6.06 LTS

  I hope that this post will also help others, who have to decide which
  OS to choose!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Weired cakePHP behavior!!

2009-07-27 Thread Abraham Boray

I'm doing ajax call on some models ,and the 1st code seems to be
workin' , but the second one is not !

I'm simply retrievin' data from database and print it in JSON format :

this is my view :
echo $javascript-object($category);

this code work perfectly
 Configure::write('debug', 0);
   $this-layout = 'ajax';
   $this-RequestHandler-setContent('json', 'text/javascript');
   $this-RequestHandler-respondAs('json');
   $this-Category-recursive = 2;
   $this-set('category', $this-paginate());


this code won't work!!!
Configure::write('debug', 0);
   $this-layout = 'ajax';
   $this-RequestHandler-setContent('json', 'text/javascript');
   $this-RequestHandler-respondAs('json');
   $this-set('category', $this-Category-read(null, 1));//here I'm
just getting the record with the id 1

it's  little confusing 4 me how can the first code work and the second
one not

regards
Abraham
--~--~-~--~~~---~--~~
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: Display months in datetime fields in german

2009-07-27 Thread Piotr Kilczuk

Hello,

 is it somehow possible to display the months of a datetime field in a
 view in german?

Sure.

Set Config.language to ger and in app/locale/ger/LC_MESSAGES/default.po:

msgid  July
msgstr Juli

msgid  June
msgstr Juni

etc.

If you don't want to do it like this, just copy core form helper to
app/views/helpers and edit the source.


Regards,
Piotr

--~--~-~--~~~---~--~~
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: Display months in datetime fields in german

2009-07-27 Thread Hols Kay

Look into PHP's setlocale and strftime functions, and create a helper
in Cake to format the date the way you like: 
http://uk2.php.net/manual/en/function.setlocale.php

Also see this thread: 
http://groups.google.com/group/cake-php/browse_thread/thread/6d130fdab7c0d45f

:)

On Jul 27, 10:22 pm, Bs sommerf...@hs-heilbronn.de wrote:
 Hi,

 is it somehow possible to display the months of a datetime field in a
 view in german?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Allow some html tags in Sanitize::html()

2009-07-27 Thread Arnau Alcázar Lleopart

Does anybody knows if there is any way to allow some html tags in
function Sanitize::html()?

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: Weired cakePHP behavior!!

2009-07-27 Thread Miles J

Well both those functions do completely opposite things, what exactly
are you trying to retrieve?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Need help with ACL

2009-07-27 Thread Sheetal

I am implementing ACL for an existing site.
There is a view file , the name of the view file is edit.ctp it is
under the folder  acl_aros.
This view file contains a single text box, and this value is used for
the 'alias' column in 'aros' table.

The name of the controller that has the 'save' function is
acl_aros_controller.php

The name of the model file in which I have written the validation for
the field is 'acl_aro.php'.
The validation says the text field cannot be empty and has to be min.
of 4 char.

But the problem here is data's are getting inserted, but it never uses
the validation in the model file. In simple words, it doesn't uses
that model file at all.  If I submit a form with empty text box, an
empty record is getting inserted.

What am I missing here? How should I tell the system to use this model
file so that validation check is done.

Please help me with this.
--~--~-~--~~~---~--~~
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: keep hitting mysql memory limit, even in Cake Shell when exporting large xml file

2009-07-27 Thread shabba

It seems like a PHP memory limit error rather than MySQL as Waither
said, PHP on a standard install has a limit of 64mb, I never find this
enough, especially dealing with largew datasets. Seting the memory
limit to 128 should suffice, either in the actual file, or in the
php.ini. Personally I raised the limit to 128mb for php and 512mb for
MySQL.

On Jul 26, 4:02 pm, JamesF usaexportexpe...@gmail.com wrote:
 i have paginated the results and no matter how i chunk it it still
 fills up the mysqli result set and hits the memory limit. i need to be
 able to flush the result set between each iteration.

 On Jul 26, 6:33 am, Jaydeep Dave jaydipd...@gmail.com wrote:

  You can try something like this in your shell

  ?php

  ...
  ..

  $page = 1;

  while(1) {

           $records = $this-findAll(conditions' = array(bla bla bla),
  'fields' = 'Model.*' ,'limit' = 50, 'page' = $page);

           if($records) {
                // Write Your XML in a File.
           }else{
                 break;
           }

          $page = $page + 50;

  }

  This will help you a lot.

  Regards,

  Jaydeep Dave

  On Sun, Jul 26, 2009 at 1:41 AM, majna majna...@gmail.com wrote:

   Try with :
   $mysqli = ConnectionManager::getDataSource('default');
   $mysqli-disconnect();
   $mysqli-connect();

   debug($mysqli-connected);
   debug($mysqli-connection);

   On Jul 26, 7:55 am, JamesF usaexportexpe...@gmail.com wrote:
MY PROBLEM:
i am running into a wall with this one. basically i have a large xml
file that i am rendering using XmlHelper. We are talking about a
25-50mb file. This is basically a product data feed. I have tried
quite a few methods to overcome the memory limit but no luck.

MY ERROR:
Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to
allocate 53 bytes) in /home/username/usr/cakedev/cake/libs/model/
datasources/dbo/dbo_mysqli.php on line 402

WHAT I HAVE DONE TO TRY AND FIX IT:

1) Initially i set this up to render through the web in one
shotthis cause execution limit timeouts and memory errors.

2)I broke up the data requests in seperate chunks of 500 records using
internal method calls, like $listings = $this-getListings($start_id,
$limit); This caused the same problem

3) I set the whole thing up via the cake shell interface. It works
great except for the fact that i keep running up against the same
limit, even with staggered chunks of records in different method
calls.

MY GUESS:
is that Cake is keeping an open connection with the database for the
life of the script.

MY SPECIFIC QUESTIONS:
can i disconnect and reconnect from the database inside of the script?
specifically can i do this in a cake shell script? will this solve my
memory problem? am i going about this the wrong way entirely?

thanks again anyone who has some advice!

  --
  Regards,

  Jaydeep Dave
  Mobile: +919898456445
  Email: jaydipd...@yahoo.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: Weired cakePHP behavior!!

2009-07-27 Thread Abraham Boray

Retrieve categories records ,very simple isn't it !
but the code seems it doesn't work !

On Jul 27, 10:59 pm, Miles J mileswjohn...@gmail.com wrote:
 Well both those functions do completely opposite things, what exactly
 are you trying to retrieve?
--~--~-~--~~~---~--~~
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: Weired cakePHP behavior!!

2009-07-27 Thread Miles J

$this-paginate() will grab all records based on your controllers
$paginate property.

$this-read() will update the $data property in your model with data
based on ID, and then return the $data.

Which are you trying to retrieve?

Why not just do $this-Category-find('list')?
--~--~-~--~~~---~--~~
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 inheirt form other controllers?

2009-07-27 Thread brian

Have a look at admin routing. You don't need to have separate
controllers for what you want to do.

On Mon, Jul 27, 2009 at 12:30 PM, Michael Gaisermjgai...@gmail.com wrote:
 Well, my users and locations use the same setup. I have split up my normal
 controller into 2 parts so I can have different permissions and functions.
 ie, I don't want normal users to be able to delete user records, only
 admins. So instead of having all my functions have an admin test, which
 would seem to be ignoring the ACL stuff.

 With the 2 controllers, I can set the user controller to just have the
 standard user functions, but then have the UsersAdmin controller require
 that the user is an admin to access it. It also allows for separate
 functions so that the user can edit their account settings, but with limited
 access. Only the Admin can edit the username and stuff like that. If there
 is a better way to be using the Auth component, I would love to hear it, but
 having the controller split into normal/admin seems to be the only way I
 found to make it work. And since there is a ton of shared code between them,
 I wanted to have the admin inherit from the normal, then add in the
 additional functionality.

 So that's where I am right now. I hope that sheds some light on what I am
 trying to accomplish.

 ~Michael

 On Mon, Jul 27, 2009 at 4:46 PM, brian bally.z...@gmail.com wrote:

 On Mon, Jul 27, 2009 at 10:32 AM, Michael Gaisermjgai...@gmail.com
 wrote:
  When I try that, I end up with this error
 
  Fatal error: Class 'LocationController' not found in
  C:\wamp\www\theinconnu\app\controllers\locationmanager_controller.php on
  line 6

 You might have to include the path:

 http://api.cakephp.org/class/app#method-Appimport

  So for the parent controller name, do I use 'Location' or
  'LocationController'?

 Location would be the name of the model. If your class file says
 class LocationController ... at the top, that's the name to use.
 Although it really should be LocationsController.

 But I wonder if you'd be better off without importing one controlller
 into another. You began by mentioning something called UserAdmin,
 which suggests that you could just stick with Users and admin routing.
 Where does this LocationController fit in?




 


--~--~-~--~~~---~--~~
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: Weired cakePHP behavior!!

2009-07-27 Thread phpcurious

I noticed that in the frist part of your codes you indicated that you
needed a recursion on the pagination, while the other, you only used
read function which reads only a specific row with no recursion.
That's just my guess where you are having trouble with.
To know more about recursion, http://book.cakephp.org/view/439/recursive


On Jul 28, 5:48 am, Abraham Boray abrahambo...@gmail.com wrote:
 I'm doing ajax call on some models ,and the 1st code seems to be
 workin' , but the second one is not !

 I'm simply retrievin' data from database and print it in JSON format :

 this is my view :
 echo $javascript-object($category);

 this code work perfectly
  Configure::write('debug', 0);
            $this-layout = 'ajax';
            $this-RequestHandler-setContent('json', 'text/javascript');
            $this-RequestHandler-respondAs('json');
            $this-Category-recursive = 2;
            $this-set('category', $this-paginate());

 this code won't work!!!
 Configure::write('debug', 0);
            $this-layout = 'ajax';
            $this-RequestHandler-setContent('json', 'text/javascript');
            $this-RequestHandler-respondAs('json');
            $this-set('category', $this-Category-read(null, 1));//here I'm
 just getting the record with the id 1

 it's  little confusing 4 me how can the first code work and the second
 one not

 regards
 Abraham
--~--~-~--~~~---~--~~
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: Download code for downloading a file

2009-07-27 Thread delocalizer

Just so this is searchable  on the record here at the cakephp group:
using ob_gzhandler in conjunction with ob_* functions like the
ob_clean and ob_end_clean in the code snippets in above posts can
cause headaches.
In particular, you might have output_handler set = ob_gzhandler in
your php.ini and not even realise it... this caused downloads to fail
completely for me (php-5.1.6 on CentOS 5.3). Seems to be an old php
bug (http://bugs.php.net/bug.php?id=34071  variations...).
Answer = if you want to use ob_gzhandler, invoke it at function level,
and not in conjunction with ob_clean.

On Jul 24, 6:34 pm, Vijay Kumbhar k.vidn...@gmail.com wrote:
 Hey Crazy,

 thanks a lot ... i will try this out.



 On Fri, Jul 24, 2009 at 1:56 PM, Crazy crazy...@gmail.com wrote:

  Will there be allot of file downloads?

  If there will be a big load on the site from file downloads,
  especially big files. Then it's not smart to handle it in cakephp.
  Especially if you want to support download accellerators/resume
  support

  On every request(someone that uses a download accelerator and makes 10
  requests), the cakephp framework is loaded.
  This is accually not needed, because it's a plain file download.
  Even if you want to check a couple of things in the database, it's
  better to do it manually.

  This ofcouse depends on the situation you're in.
  In my case, using cakephp this way would crash my server within 5
  minutes(if not faster)

  You can find the code I use here:

 http://pastebin.com/f179e1e49

  I've been using it for several years and transfer 15 to 20tb per month
  using that piece of code.

  /Crazy

  On Jul 24, 9:58 am, Vijay Kumbhar k.vidn...@gmail.com wrote:
   Yeah...

   Thanks rufus it works .

   only i changed this line,

   header('Content-Type: application/octet-stream'); to

   header(Content-Type: .$result['Application']['resume']).);

   that is the content type of the uploaded file coming from my database.

   Thanks again...

   On Fri, Jul 24, 2009 at 12:53 PM, Rufus rufusp...@gmail.com wrote:

Here is my code:

pdfDir is defined constant fyi

       function download($id = null) {

               if (!$id  empty($this-data)) {
                       $this-Session-setFlash(__('Invalid Invoice',
true));
                       $this-redirect(array('action'='index'));
               }

               Configure::write('debug', 0);
               $file = $this-Invoice-findById($id);
   if (file_exists(pdfDir.$file['Invoice']['file_name'])) {
       header('Content-Description: File Transfer');
       header('Content-Type: application/octet-stream');
       header('Content-Disposition: attachment; filename='.basename
(pdfDir.$file['Invoice']['file_name']));
       header('Content-Transfer-Encoding: binary');
       header('Expires: 0');
       header('Cache-Control: must-revalidate, post-check=0, pre-
check=0');
       header('Pragma: public');
       header('Content-Length: ' . filesize(pdfDir.$file['Invoice']
['file_name']));
       ob_clean();
       flush();
       readfile(pdfDir.$file['Invoice']['file_name']);
       exit;
   } else {
                       $this-Session-setFlash(__('File Does Not
  Exist',
true));
                       $this-redirect(array('action'='index'));
    }

       }

On Jul 24, 12:44 am, Vijay k.vidn...@gmail.com wrote:
 Hello All,

 I uploads the files to webroot/uploads folder from the file uploading
 component.

 Now I am trying to download that file from webroot/uploads folder but
 it is giving me 0 byte file.

 Code is as follows,

 function admin_download($id)
     {
         $this-adminchecksession();
             // you'll want to check the login status here ...

             $result = $this-Application-findById($id);

             Configure::write('debug', 0);
             $this-view = 'Media';

             /* MediaView is really irritating
              */
             //$name = $result['Application']['resume'];

             $ext = explode(. ,$result['Application']['resume']);

             $params = array(
                     'name' = $ext[0],
                     'download' = true,
                     'extension' = $ext[1],
                     'path' = APP.webroot/uploads.DS,
                     'mimeType' = array($result['Application']
 ['type'])
             );

             $this-set($params);

     }

 Please help me on this.

   --
   Thanks  Regards,
   Vijayk.
   Co-founder (www.weboniselab.com)

   You Bring the Dreams, We'll Bring the Means

 --
 Thanks  Regards,
 Vijayk.
 Co-founder (www.weboniselab.com)

 You Bring the Dreams, We'll Bring the Means
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 

Re: Bypassing Security Salt

2009-07-27 Thread Andras Kende

Yes, its overwrites cake's hashPassword function to not to salt the  
password put the code into usually user model
and see if the password is encrypted in the debug display...

Andras



On Jul 27, 2009, at 4:52 PM, Steppio wrote:


 @Miles J, thanks for the post but im using alot of cookies so i need
 the salt value set in core, just not used in the authentication
 process.

 @Andras Kende, thanks mate, do you know what it does?

 On Jul 27, 9:14 pm, Andras Kende and...@kende.com wrote:
 Hello,

 You could try in your model:

   function hashPasswords($data){
  return $data;
   }

 Andras

 On Jul 27, 2009, at 1:53 PM, Steppio wrote:



 Hi there,
 I was wondering if anybody knows a way to bypass the salting that  
 the
 Security component automatically gives to a password?

 The problem is that i have a database of old passwords and im
 converting the site into a CakePHP site, however when im trying to  
 log
 in to the new site the password being returned by the debugger  
 appears
 to have been salted and therefore doesnt conform to my original,  
 non-
 salted sha1 password.

 Any help would be greatly appreciated.

 Thank you!

 Steppio
 


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