Re: adding file upload to existing form

2009-05-18 Thread Kyle Decot

How about if you show us your form code.

On May 17, 10:55 pm, mike mwu...@gmail.com wrote:
 hmm... but if I add the input type file, when I call the save method
 in the action, it tries to persist the object to the database and I
 get a sql error

 On May 8, 10:52 pm, Trevor Fitzgerald fitzt...@gmail.com wrote:



  You can do it by properly setting the encoding type of the form, then
  creating an input with type of file.  On the action page, print_r $_FILES
  to see if it's working correctly.  It should have uploaded the file to
  /tmp.  Then use PHP's move_uploaded_file to put it where you want it.  Save
  the new path and filename in the database.

  There are quite a few tutorials around for file uploads but hopefully that
  will point you in the right direction.  You won't need to create a separate
  model or anything.

  On Fri, May 8, 2009 at 10:26 PM, mike mwu...@gmail.com wrote:

   I want to add a file upload to an existing form.  I want to save the
   file somewhere in the file system, and maybe save a reference to it in
   the database.  seems simple enough, but all the examples I've found
   aren't exactly what I want.  I don't want to create a whole different
   model for the file upload.  Can someone point me in the right
   direction.

   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: Safari 4 Keeps Logging Me Out....

2009-05-18 Thread ChicagoPlanesTrains

Which platform? I've been using Safari 4 on Mac OS X (10.4.11) for a
month or two now with no issues. I'm using database sessions for both
development and production and have yet to be logged out
unexpectedly.

Which browsers/versions do you have working?

On May 17, 2:05 am, Kyle Decot kdec...@gmail.com wrote:
 I'm not sure if anyone else is experiencing this problem but Safari 4
 keeps logging me out. Sometimes it won't do it for almost 10 minutes
 and then other times it will do it immediately after logging in. Any
 ideas on how to fix this? I'm using DB for sessions by the way but
 have tried PHP and cake and am getting the same results.

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



My Views Folder can't be detected

2009-05-18 Thread eantz

I try to create something part by part. When I try to check that part,
the message The requested URL was not found on this server. If you
entered the URL manually please check your spelling and try again.
appeared in my browser..

for example : I create a blog. I save view.thml in /views/posts/.

I use xampp 1.6.7. Is my server goes wrong?

--~--~-~--~~~---~--~~
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: Safari 4 Keeps Logging Me Out....

2009-05-18 Thread Kyle Decot

I'm using Mac 10.5.7 I can't remember my app logging me out like this
in the past. It just started doing this about a month ago. I'm afraid
it's something that I modified, added or deleted from my code but I've
changed so much stuff lately, I'm not sure where to begin looking. Any
ideas on what I can do to diagnose the problem?

On May 17, 10:15 pm, ChicagoPlanesTrains myronhay...@gmail.com
wrote:
 Which platform? I've been using Safari 4 on Mac OS X (10.4.11) for a
 month or two now with no issues. I'm using database sessions for both
 development and production and have yet to be logged out
 unexpectedly.

 Which browsers/versions do you have working?

 On May 17, 2:05 am, Kyle Decot kdec...@gmail.com wrote:



  I'm not sure if anyone else is experiencing this problem but Safari 4
  keeps logging me out. Sometimes it won't do it for almost 10 minutes
  and then other times it will do it immediately after logging in. Any
  ideas on how to fix this? I'm using DB for sessions by the way but
  have tried PHP and cake and am getting the same results.
--~--~-~--~~~---~--~~
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: Safari 4 Keeps Logging Me Out....

2009-05-18 Thread Kyle Decot

Oh, I didn't see that you had asked which browsers I had working. I've
tested it on the following w/ no problems:

Firefox 3 (mac)
Camino  1.6 (mac)
Safari 3 (mac)

On May 18, 2:14 am, Kyle Decot kdec...@gmail.com wrote:
 I'm using Mac 10.5.7 I can't remember my app logging me out like this
 in the past. It just started doing this about a month ago. I'm afraid
 it's something that I modified, added or deleted from my code but I've
 changed so much stuff lately, I'm not sure where to begin looking. Any
 ideas on what I can do to diagnose the problem?

 On May 17, 10:15 pm, ChicagoPlanesTrains myronhay...@gmail.com
 wrote:



  Which platform? I've been using Safari 4 on Mac OS X (10.4.11) for a
  month or two now with no issues. I'm using database sessions for both
  development and production and have yet to be logged out
  unexpectedly.

  Which browsers/versions do you have working?

  On May 17, 2:05 am, Kyle Decot kdec...@gmail.com wrote:

   I'm not sure if anyone else is experiencing this problem but Safari 4
   keeps logging me out. Sometimes it won't do it for almost 10 minutes
   and then other times it will do it immediately after logging in. Any
   ideas on how to fix this? I'm using DB for sessions by the way but
   have tried PHP and cake and am getting the same results.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Notice (8): Undefined property: CakeErrorController::$js_vars

2009-05-18 Thread Braydenstyles

Notice (8): Undefined property: CakeErrorController::$js_vars [APP/
app_controller.php, line 103]

Code
{
$this-set('meta_for_layout', Configure::read('meta'));
$this-set('js_vars_for_layout', $this-js_vars);


AppController::beforeRender() - APP/app_controller.php, line 103
Controller::render() - CORE/cake/libs/controller/controller.php, line
701
ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377
ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176
Object::dispatchMethod() - CORE/cake/libs/object.php, line 119
ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120
Object::cakeError() - CORE/cake/libs/object.php, line 204
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 148
require - APP/webroot/index.php, line 90
[main] - APP/index.php, line 25

help 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: passing arrays as arguments

2009-05-18 Thread Richard
CakePHP has the function a, which is an alias of array:
http://api.cakephp.org/file/basics.php#function-a

Is that along the lines of what you're looking at?

On Sun, May 17, 2009 at 8:11 PM, Bysa amin...@gmail.com wrote:




 On May 17, 8:00 pm, Marcelo Andrade mfandr...@gmail.com wrote:
  On Sun, May 17, 2009 at 10:46 AM, Bysa amin...@gmail.com wrote:
   wasn't it a good way to have a small mark for it (like jquery)? for
   example making array(arg1,arg2)  --  _(arg1,arg2)?
 
  This is not possible because the _() function
  already exists and is used to gettext i18n.
 
  Best regards.
 
  --
  MARCELO DE F. ANDRADE
  Belem, PA, Amazonia, Brazil
  Linux User #221105
 
  http://mfandrade.wordpress.com

 thanks for reply but i said that as an example. i know it used, the
 reason was just to clear my mean.
 there is a unused and small name in php and cake for sure so that we
 could use it for array passing, or for example make cake to parse a
 string like [arg1,arg2], i don't know look on it as an idea

 am i still wrong?

 thanks anyway
 


--~--~-~--~~~---~--~~
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 manage triple relation between Model in CAKEPHP?

2009-05-18 Thread byqsri

I describe you my situation:
My model is :
Teams, Template and Format
The triple relation can be expressed in this way:
Each team has access to a set of pairs template-format.
A template can be associated with some format.
In the table relative to this triple relation I have:

id
team-id
format-id
template-id

Then I have the models : Team,Format,Template



On 16 Mag, 13:54, j0n4s.h4rtm...@googlemail.com
j0n4s.h4rtm...@googlemail.com wrote:
 Like this?:

 Message HasOne User (From)
 Message HasOne ToUser (To)
 Message HasOne CcUser (Copy)

 In message.php:

         var $belongsTo = array(
                 'User' = array(
                         'className' = 'User',
                         'foreignKey' = 'user_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
                 'ToUser' = array(
                         'className' = 'User',
                         'foreignKey' = 'reciever_user_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
                 'CcUser' = array(
                         'className' = 'User',
                         'foreignKey' = 'cc_user_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 )
         );

 Else, maybe polymorphic behavior might help. Not sure what you want to
 achieve.

 On May 15, 6:36 pm, byqsri marco.rizze...@gmail.com wrote:

  I haven't understand .
  Can you make me and example?
  Many Thanks

  On 15 Mag, 17:56, AD7six andydawso...@gmail.com wrote:

   On May 15, 5:32 pm, marco.rizze...@gmail.com

   marco.rizze...@gmail.com wrote:
Hi
I have three model that have a triple relation between them.
How can I manage this triple relation between Model in CAKEPHP?

   via belongsTo, hasMany and a model for each table - the usual way.

   hth,

   AD


--~--~-~--~~~---~--~~
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: Launched a new cake app

2009-05-18 Thread Richard
Did you use signUpText as a msgid in your language files? I had this
previously when using generic labels for language strings, and the
corresponding language file for the environment set in the visitors web
browser was not available. You can solve this problem by setting the default
language - I've got the code to achieve this somewhere - ping me back if you
would like it and I'll have a look for it.

On Sun, May 17, 2009 at 6:52 PM, Miles J mileswjohn...@gmail.com wrote:


 @Faza - Yes I do the designs and code :p

 @Eber - Weird! My friend in austria had the same problem, I wonder how
 I can fix it.
 


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



Running a Controller Function from the Console

2009-05-18 Thread Ammad

Hello,
I was just wondering how we can run a function of a controller
using the console. Like normal PHP Scripts we can run the scripts
using the following syntax:

[COMMAND PROMPT] php test.php

Thanks,
Muhammad Ammad Saleem
--~--~-~--~~~---~--~~
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: Warning (2): Cannot modify header information - headers already sent by

2009-05-18 Thread paulos nikolo
Check for whitespaces in app_controller and the other controllers.This was
caused from copy-paste.
Think i may helped!

Cheers

2009/5/18 Braydenstyles brayden.sty...@gmail.com


 Warning (2): Cannot modify header information - headers already sent
 by (output started at /Users/braydenstyles/Sites/app/
 app_controller.php:112) [CORE/cake/libs/controller/controller.php,
 line 587]

 Code | Context
 $status =   Location: http://localhost/beta_users/login;

 header - [internal], line ??
 Controller::header() - CORE/cake/libs/controller/controller.php, line
 587
 Controller::redirect() - CORE/cake/libs/controller/controller.php,
 line 568
 AppController::checkAuth() - APP/app_controller.php, line 269
 AppController::beforeFilter() - APP/app_controller.php, line 141
 UsersController::beforeFilter() - APP/controllers/
 users_controller.php, line 49
 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 228
 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
 Object::requestAction() - CORE/cake/libs/object.php, line 102
 include - APP/views/layouts/default.ctp, line 246
 View::_render() - CORE/cake/libs/view/view.php, line 654
 View::renderLayout() - CORE/cake/libs/view/view.php, line 451
 View::render() - CORE/cake/libs/view/view.php, line 384
 Controller::render() - CORE/cake/libs/controller/controller.php, line
 744
 ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377
 ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176
 Object::dispatchMethod() - CORE/cake/libs/object.php, line 119
 ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120

 


--~--~-~--~~~---~--~~
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: last_login update

2009-05-18 Thread paulos nikolo
Yeah Andy i tried this but still nothing.Dunno what else i have to do.Thx
anyway for your idea!

2009/5/18 andy andy.baugh...@gmail.com


 I may be wrong, but I believe '$this-Auth-user()' would look for the
 function 'user()' within Auth rather than an array value. Have you
 tried '$this-Auth-user['id']' before calling saveField?

 On May 17, 5:43 am, paulos nikolo paulitosthe...@gmail.com wrote:
  Still nothing Faza.I am wondering if i have to do something else to get
 it
  work.I think -- if ($this-Auth-user()) doesnt seem to work.If i erase
  this line cake save the last_login but in a new row.
 
  2009/5/16 Faza f...@ansi.pl
 
 
 
   This is the code I'm using, works 100%.
 
   function login() {
  $this-layout = 'login';
  if ($this-Auth-user()) {
   $this-User-id = $this-Auth-user('id');
   $this-User-saveField('last_visit', 'now()');
  $gr =
   $this-User-Group-findById($this-Auth-user('group_id'));
  $this-Session-write('Auth.User.group',
 $gr['Group']['name']);
  $this-Session-write('Auth.User.password', );
  $this-redirect($this-Auth-redirect());
  }
  }
 
   Paulos23 pisze:
Hi Cake people,
I have spent much time in make this work but nothing.I am using auth
which is working ok and i want to update the last_login field in
 users
table.But i can't.Most of my attempts lead to create a new row in
table with an empty user contained the updated field.I have read all
of the previous  posts here but nothing help me.Can you tell me if I
do something wrong.Here i put my code:
 
app_controller:
 
class AppController extends Controller {
  var $components = array('Auth');
  function beforeFilter() {
  $this-Auth-loginAction = array('controller' =
 'users',
   'action'
= 'login');
  $this-Auth-logoutRedirect = array('controller' =
   'users',
'action' = 'login');
  $this-Auth-loginRedirect = array('controller' =
 'users',
   'action'
= 'index');
  $this-Auth-loginError=__('Invalid username or
   password',true);
  $this-Auth-authorize='controller';
  }
 
  function isAuthorized(){
 return true;
  }
}
 
users_controller: login action
 
function login() {
  $this-layout ='user_login';
  if ( $this-Auth-user() ) {
$user = $this-Auth-user();
 
  $this-User-id =
   $this-Auth-user('id');
//$user['User']['last_login'] = date ( 'Y-m-d
H:i:s' );
  $this-User-saveField('last_login',
   date('Y-m-d
H:i:s'));
  //$this-User-save('$user');
   
 //$this-User-last_login =
   date(Y-m-d H:i:s);
  }
 
}
 
When i have  if ( $this-Auth-user() ) {
$user = $this-Auth-user();
in my code nothing happened.If i comment it then the new row will be
added.
Any help would be so nice!
ty in advance,Paulos
 


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

2009-05-18 Thread Bogdan I. Bursuc

// routes.php
Router::connect('/:productType/:category/:season', 
 array('controller' = 'products', 'action' = 'index', 'season'
= null), 
 array('pass' = array('productType', 'category', 'season')));
 
// view:
 
echo $html-link('', array('controller' = 'products', 'action'
= 'index','productType' = $productType, 'category' =
$category));
 
// result:
a href=/Anvelope Noi/Scutere/:season/
 
// desired result:
a href=/Anvelope Noi/Scutere/

I need desired result, instead i get result ? Why is that ?


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

2009-05-18 Thread Marojahan M.T. Sigiro
hi guys... a view days ago as far as i know, my code ran well

i try to set a variable in custom app_controller class

$this-set('Auth',$this-Auth-user());

i did this because i plan to use that variable in views.

mybe like print_r($Auth)

now my code display warning that says..

*Notice* (8) javascript:void(0);: Undefined variable: Auth
[*APP\views\users\login.ctp*, line *3*]

does anyone know how to solve this problem?


-- 
---
I Don't Know Who/What I Am Yet, But I Know Who/What I Am Not!
--
Marojahan M.T. Sigiro
maroja...@gmail.com
GTalk : marojahan
Y! : ojak_s
http://ojakaja.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
-~--~~~~--~~--~--~---



2 before_filter function

2009-05-18 Thread Marojahan M.T. Sigiro
hi all,,

what i have to do, so both my before_filter function that found in
xxx_controller and app_controller executed?

-- 
---
I Don't Know Who/What I Am Yet, But I Know Who/What I Am Not!
--
Marojahan M.T. Sigiro
maroja...@gmail.com
GTalk : marojahan
Y! : ojak_s
http://ojakaja.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: passing arrays as arguments

2009-05-18 Thread Bysa

argh
i think yes it is.
i wonder why i didnt seen anyone use it when they were passing the
argument, and used the array() instead.

thanks for show me this.

On May 18, 11:53 am, Richard rclay...@gmail.com wrote:
 CakePHP has the function a, which is an alias of 
 array:http://api.cakephp.org/file/basics.php#function-a

 Is that along the lines of what you're looking at?

 On Sun, May 17, 2009 at 8:11 PM, Bysa amin...@gmail.com wrote:

  On May 17, 8:00 pm, Marcelo Andrade mfandr...@gmail.com wrote:
   On Sun, May 17, 2009 at 10:46 AM, Bysa amin...@gmail.com wrote:
wasn't it a good way to have a small mark for it (like jquery)? for
example making array(arg1,arg2)  --  _(arg1,arg2)?

   This is not possible because the _() function
   already exists and is used to gettext i18n.

   Best regards.

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

  http://mfandrade.wordpress.com

  thanks for reply but i said that as an example. i know it used, the
  reason was just to clear my mean.
  there is a unused and small name in php and cake for sure so that we
  could use it for array passing, or for example make cake to parse a
  string like [arg1,arg2], i don't know look on it as an idea

  am i still wrong?

  thanks anyway
--~--~-~--~~~---~--~~
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: 2 before_filter function

2009-05-18 Thread Paul R. Zwiers

Hello Marojahan,


Monday, May 18, 2009, 12:11:02 PM, you wrote:

what i have to do, so both my before_filter function that found in 
xxx_controller and app_controller executed?

 
 Put parent::beforeFilter(); in your WhateverController beforeFilter method, 
then the beforeFilter of AppController is called.
 

 -- Paul
  


--~--~-~--~~~---~--~~
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: Not fully understanding associations. Id showing instead of name.

2009-05-18 Thread number9

Yes it's a varchar and I utilised bake, I've got it working now by
setting recursive to 2 and amending the views to use the other models
field, I just wondered if there was a more efficient way of doing it
as I should imagine it is a common thing to do, but if not, not to
worry - thanks for the replies!



On May 16, 12:59 pm, j0n4s.h4rtm...@googlemail.com
j0n4s.h4rtm...@googlemail.com wrote:
 Is the name field a varchar255 not null or tinytext?
 Try using cake bake to create your starting environment and work from
 there

 On May 15, 5:38 pm, number9 xpozit...@gmail.com wrote:



  Actually I tried displayfield earlier when I was searching, but it
  didn't work, presumably because: The model will use name or title, by
  default. and I am trying to output name (so it should be doing that
  anyway).

  On May 15, 4:33 pm, number9 xpozit...@gmail.com wrote:

   OK, so I tried setting recursive to two again (didn't work earlier)
   and it worked!

   Is there a better method to do this for future reference as it seems
   to place a bit of a load of the database...

   On May 15, 4:12 pm, number9 xpozit...@gmail.com wrote:

Hi all,

Apologies for this newbish question, I've searched for hours trying to
resolve this with no joy so would appreciate it if you could point me
in the right direction.

I'm trying to setup a simple website (my first cakephp project, having
become OKish at PHP/MYSQL).

Basically there are three models so far, posts, categories and sites
(all of the databases follow cake naming conventions, with id as PK,
name and _id for FKs.

Posts belong to categories.

Posts also belong to sites.

Categories, and sites have one post.

I have used cake bake to generate the controllers and views. /posts/
works great, and it shows everything by name, the add works great in
terms of the relationships.

The problem I am having is, when I go to /categories/, it brings up
posts under that category and the category and site are showing up
as numbers rather than name (in the view they are category_id, and
site_id). I can get the category name to show up OK (because I think
that table is mapped).

What I don't understand is why the name is not showing in place of the
_id like everwhere else. How can I output database fields in another
model. It is probably something really simple, but I'm getting used to
the cake way of thinking.

Is it that the relationship is wrong? The query at the bottom shows
the names are being selected.

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



httpsocket and xml

2009-05-18 Thread Paulos23

Hi people,
I am wonder if there is an example of using httpsocket and xml.In my
app i want to have a page with a search textfield (and search button)
as well as a page with the results which i receive in XML format.In
particular i want to put a destination (town,country) and from this
site  http://www.geonames.org/export/ws-overview.html i want to
take the xml results and appear them in my results page.As it is
sensible i want to parse the receiver xml results.

Any help woulb be nice!
Paulos
--~--~-~--~~~---~--~~
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: last_login update

2009-05-18 Thread andy

If you print_r($this-Auth), what keys/values are included in the
array?

On May 18, 4:09 am, paulos nikolo paulitosthe...@gmail.com wrote:
 Yeah Andy i tried this but still nothing.Dunno what else i have to do.Thx
 anyway for your idea!

 2009/5/18 andy andy.baugh...@gmail.com



  I may be wrong, but I believe '$this-Auth-user()' would look for the
  function 'user()' within Auth rather than an array value. Have you
  tried '$this-Auth-user['id']' before calling saveField?

  On May 17, 5:43 am, paulos nikolo paulitosthe...@gmail.com wrote:
   Still nothing Faza.I am wondering if i have to do something else to get
  it
   work.I think -- if ($this-Auth-user()) doesnt seem to work.If i erase
   this line cake save the last_login but in a new row.

   2009/5/16 Faza f...@ansi.pl

This is the code I'm using, works 100%.

function login() {
       $this-layout = 'login';
       if ($this-Auth-user()) {
            $this-User-id = $this-Auth-user('id');
            $this-User-saveField('last_visit', 'now()');
           $gr =
$this-User-Group-findById($this-Auth-user('group_id'));
           $this-Session-write('Auth.User.group',
  $gr['Group']['name']);
           $this-Session-write('Auth.User.password', );
           $this-redirect($this-Auth-redirect());
       }
   }

Paulos23 pisze:
 Hi Cake people,
 I have spent much time in make this work but nothing.I am using auth
 which is working ok and i want to update the last_login field in
  users
 table.But i can't.Most of my attempts lead to create a new row in
 table with an empty user contained the updated field.I have read all
 of the previous  posts here but nothing help me.Can you tell me if I
 do something wrong.Here i put my code:

 app_controller:

 class AppController extends Controller {
       var $components = array('Auth');
       function beforeFilter() {
               $this-Auth-loginAction = array('controller' =
  'users',
'action'
 = 'login');
               $this-Auth-logoutRedirect = array('controller' =
'users',
 'action' = 'login');
               $this-Auth-loginRedirect = array('controller' =
  'users',
'action'
 = 'index');
               $this-Auth-loginError=__('Invalid username or
password',true);
               $this-Auth-authorize='controller';
       }

       function isAuthorized(){
      return true;
       }
 }

 users_controller: login action

 function login() {
               $this-layout ='user_login';
                       if ( $this-Auth-user() ) {
                         $user = $this-Auth-user();

                                               $this-User-id =
$this-Auth-user('id');
                         //$user['User']['last_login'] = date ( 'Y-m-d
 H:i:s' );
                               $this-User-saveField('last_login',
date('Y-m-d
 H:i:s'));
                               //$this-User-save('$user');

  //$this-User-last_login =
date(Y-m-d H:i:s);
                       }

     }

 When i have  if ( $this-Auth-user() ) {
                         $user = $this-Auth-user();
 in my code nothing happened.If i comment it then the new row will be
 added.
 Any help would be so nice!
 ty in advance,Paulos
--~--~-~--~~~---~--~~
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 cakePHP

2009-05-18 Thread Aivaras
Hey,

if you want to use Auth info in your views it is very simple.

Try this in your view: pr($session-read('Auth.User')); //assuming User is
your login model, otherwise try pr($session-read('Auth'));

Hope you find this handy,
Faifas


On Mon, May 18, 2009 at 12:59, Marojahan M.T. Sigiro maroja...@gmail.comwrote:


 hi guys... a view days ago as far as i know, my code ran well

 i try to set a variable in custom app_controller class

 $this-set('Auth',$this-Auth-user());

 i did this because i plan to use that variable in views.

 mybe like print_r($Auth)

 now my code display warning that says..

 *Notice* (8): Undefined variable: Auth [*APP\views\users\login.ctp*, line *3*]

 does anyone know how to solve this problem?


 --
 ---
 I Don't Know Who/What I Am Yet, But I Know Who/What I Am Not!
 --
 Marojahan M.T. Sigiro
 maroja...@gmail.com
 GTalk : marojahan
 Y! : ojak_s
 http://ojakaja.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: My Views Folder can't be detected

2009-05-18 Thread fain182

in cakephp the view has extension .ctp.. you should put the view in
/view/posts/view.ctp

On Mon, May 18, 2009 at 5:26 AM, eantz eantz.z...@gmail.com wrote:

 I try to create something part by part. When I try to check that part,
 the message The requested URL was not found on this server. If you
 entered the URL manually please check your spelling and try again.
 appeared in my browser..

 for example : I create a blog. I save view.thml in /views/posts/.

 I use xampp 1.6.7. Is my server goes wrong?

 




-- 
pietro

--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-18 Thread Aivaras
Hey,

actually the most annoying thing is that we cannot download separate parts
of Cake. It would be cool if advanced users could choose what do they need
for their project, just like mootools made in their download page. I
certainly understand that this is just *wishful thinking* because Cake's
core uses nearly everything :x

Anyway, upload component would be totally usable!

Also, switching from scriptaculous + prototype to jQuery would be awesome.
People would create and share plugins, which means that our lovely community
would become even bigger and ADmad would be even more mad (sorry AD :x)

Enjoy,
Faifas


On Sat, May 16, 2009 at 06:00, Brendon Kozlowski brendon...@hotmail.comwrote:


 Thought of another one.

 Paginate settings, and paginate call.  Why do they have the same
 name?  When learning how Cake works, although it's proper OOP to do
 so, it's a bit confusing to see:

 $this-paginate = array('contain' = 'User');
 $this-set('posts', $this-paginate());

 I think it would be clearer (from a name the variable what it is
 type of coding style) to use something like:
 $this-paginateOptions = array('contain' = 'User');

 Every time I see $this-paginate when skimming through code, I
 immediately see the method, completely forgetting it's also a
 property.  I hate that.  ;)
 


--~--~-~--~~~---~--~~
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: last_login update

2009-05-18 Thread paulos nikolo
it prints this

AuthComponent Object
(
[_loggedIn] =
[components] = Array
(
[0] = Session
[1] = RequestHandler
)

[authenticate] =
[authorize] = controller
[ajaxLogin] =
[userModel] = User
[userScope] = Array
(
)

[fields] = Array
(
[username] = username
[password] = password
)

[sessionKey] = Auth.User
[actionPath] =
[loginAction] = Array
(
[controller] = users
[action] = login
)

[loginRedirect] = Array
(
[controller] = users
[action] = index
)

[logoutRedirect] = Array
(
[controller] = users
[action] = login
)

[object] =
[loginError] = Invalid username or password
[authError] = You are not authorized to access that location.
[autoRedirect] = 1
[allowedActions] = Array
(
[0] = display
[1] = index
[2] = add
)

[actionMap] = Array
(
[index] = read
[add] = create
[edit] = update
[view] = read
[remove] = delete
[create] = create
[read] = read
[update] = update
[delete] = delete
)

[data] =
[params] = Array
(
[pass] = Array
(
)

[named] = Array
(
)

[controller] = users
[action] = login
[plugin] =
[form] = Array
(
)

[url] = Array
(
[url] = users/login
)

)

[_methods] = Array
(
[1] = index
[2] = view
[3] = add
[4] = delete
[5] = edit
[6] = change_status
[7] = login
[8] = logout
)

[_log] =
[enabled] = 1
[Session] = SessionComponent Object
(
[__active] = 1
[__started] = 1
[__bare] = 0
[valid] = 1
[error] =
[_userAgent] = 99eaa36d863fae669cb83f33c1ad01af
[path] = /my_cake/index.php
[lastError] =
[security] = high
[time] = 1242649223
[sessionTime] = 1242649233
[watchKeys] = Array
(
)

[id] =
[_log] =
[host] = localhost
[enabled] = 1
[cookieLifeTime] = 0
)

[RequestHandler] = RequestHandlerComponent Object
(
[ajaxLayout] = ajax
[enabled] = 1
[__responseTypeSet] =
[params] = Array
(
)

[__requestContent] = Array
(
[javascript] = text/javascript
[js] = text/javascript
[json] = application/json
[css] = text/css
[html] = Array
(
[0] = text/html
[1] = */*
)

[text] = text/plain
[txt] = text/plain
[csv] = Array
(
[0] = application/vnd.ms-excel
[1] = text/plain
)

[form] = application/x-www-form-urlencoded
[file] = multipart/form-data
[xhtml] = Array
(
[0] = application/xhtml+xml
[1] = application/xhtml
[2] = text/xhtml
)

[xhtml-mobile] = application/vnd.wap.xhtml+xml
[xml] = Array
(
[0] = application/xml
[1] = text/xml
)

[rss] = application/rss+xml
[atom] = application/atom+xml
[amf] = application/x-amf
[wap] = Array
(
[0] = text/vnd.wap.wml
[1] = text/vnd.wap.wmlscript
[2] = image/vnd.wap.wbmp
)

[wml] = text/vnd.wap.wml
[wmlscript] = text/vnd.wap.wmlscript
[wbmp] = image/vnd.wap.wbmp
[pdf] = application/pdf
[zip] = application/x-zip
[tar] = application/x-tar
)

[__acceptTypes] = Array
(
[0] = text/html
[1] = 

Re: Poll: what do you hate about CakePHP?

2009-05-18 Thread Henrique Machado
What about create a true poll for it?

First create a poll for all suggestions, after create a poll to vote on that
suggestions and voilá =)

Henrique Machado



2009/5/18 Aivaras faifas1...@gmail.com

 Hey,

 actually the most annoying thing is that we cannot download separate parts
 of Cake. It would be cool if advanced users could choose what do they need
 for their project, just like mootools made in their download page. I
 certainly understand that this is just *wishful thinking* because Cake's
 core uses nearly everything :x

 Anyway, upload component would be totally usable!

 Also, switching from scriptaculous + prototype to jQuery would be awesome.
 People would create and share plugins, which means that our lovely community
 would become even bigger and ADmad would be even more mad (sorry AD :x)

 Enjoy,
 Faifas



 On Sat, May 16, 2009 at 06:00, Brendon Kozlowski 
 brendon...@hotmail.comwrote:


 Thought of another one.

 Paginate settings, and paginate call.  Why do they have the same
 name?  When learning how Cake works, although it's proper OOP to do
 so, it's a bit confusing to see:

 $this-paginate = array('contain' = 'User');
 $this-set('posts', $this-paginate());

 I think it would be clearer (from a name the variable what it is
 type of coding style) to use something like:
 $this-paginateOptions = array('contain' = 'User');

 Every time I see $this-paginate when skimming through code, I
 immediately see the method, completely forgetting it's also a
 property.  I hate that.  ;)



 


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



Embed image in HTML mail tgrought Email component

2009-05-18 Thread Andraž

Hello!

How can I embed image in HTML mail send trough Email component?

Regards Andraž
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Auth-logout() doesn't logout a user?

2009-05-18 Thread Brian Lee

Hello,

I have a debug code that prints out values of
$this-Auth-user('id')
$this-Auth-user('name')
inside a controller's beforeRender().

When I login, it shows that I'm logged in as a person.
However, when I logout, it shows that I'm still logged in as the
person I was logged in.

This only happens with users who are not in the admin group.

I think I'm making very novice mistake here with login/out
implementation.
Can someone help me or suggest what could have gone wrong in my
implementation?

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: retrieving data from another table

2009-05-18 Thread Rick

What name are you trying to get?  Looks like you have Style.name
already available in your result.

If there is a Gender.name you are trying to see you can set the
recursive to a higher number before the find:

$this-Style-recursive = 2;

Or use the Containable behavior as mentioned above.




On May 17, 5:22 pm, justclint justcl...@gmail.com wrote:
 Im pulling the data successfully but Im trying to get the name value
 as opposed to the id value in a separate table.

 When I do debug I get this:
 (
     [Product] = Array
         (
             [id] = 21
             [color_id] = 3
             [image_thumb] = aw_ls_black.png
             [price] = 27.95
             [shipping_price] = 5.00
             [style_id] = 1
         )

     [Style] = Array
         (
             [id] = 1
             [name] = All Weather Longsleeve Compression Shirt
             [gender_id] = 2
             [category_id] = 2
             [material_id] = 2
             [application_id] = 2

 For sake of example I will just reference the gender_id. I need it to
 show the name not the id.

 I have the following tables/models.

 Products
 Styles
 Genders

 Product Model:
 class Product extends AppModel {

         var $name = 'Product';

         var $belongsTo = array(
                 'Style' = array(
                         'className' = 'Style',
                         'foreignKey' = 'style_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
 );

 }

 Styles Model:
 class Style extends AppModel {

         var $name = 'Style';

         var $belongsTo = array(
                 'Gender' = array(
                         'className' = 'Gender',
                         'foreignKey' = 'gender_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
                 'Category' = array(
                         'className' = 'Category',
                         'foreignKey' = 'category_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
                 'Material' = array(
                         'className' = 'Material',
                         'foreignKey' = 'material_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 ),
                 'Application' = array(
                         'className' = 'Application',
                         'foreignKey' = 'application_id',
                         'conditions' = '',
                         'fields' = '',
                         'order' = ''
                 )
         );

 }

 Gender Model:
         var $name = 'Gender';

         var $hasMany = array(

                 'Style' = array(
                         'className' = 'Style',
                         'foreignKey' = 'gender_id',
                         'dependent' = false,
                         'conditions' = '',
                         'fields' = '',
                         'order' = '',
                         'limit' = '',
                         'offset' = '',
                         'exclusive' = '',
                         'finderQuery' = '',
                         'counterQuery' = ''
                 )
         );

 }

 ?

 The page im trying to get this on is my product view page. Action
 looks like this:

         function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Invalid Product.', 
 true));
                         $this-redirect(array('action'='index'));
                 }

                 $this-set('product', $this-Product-read(null, $id));
         }

 Ive been playing with this for hours and I just cant seem to get it.

 If you need more info, please dont hesitate to ask.

 Your help is greatly appreciated.

 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: Auth-logout() doesn't logout a user?

2009-05-18 Thread Brian Lee

nvm.

I found what I did wrong.

I forgot to allow 'logout'.
Also, for my ACL tables, it let admin to do anything, whereas other
users were limited.

Problem solved :)



On May 18, 6:17 am, Brian Lee brianleeu...@gmail.com wrote:
 Hello,

 I have a debug code that prints out values of
 $this-Auth-user('id')
 $this-Auth-user('name')
 inside a controller's beforeRender().

 When I login, it shows that I'm logged in as a person.
 However, when I logout, it shows that I'm still logged in as the
 person I was logged in.

 This only happens with users who are not in the admin group.

 I think I'm making very novice mistake here with login/out
 implementation.
 Can someone help me or suggest what could have gone wrong in my
 implementation?

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



TreeBehaviour questions

2009-05-18 Thread Walther

I am using the tree behaviour in conjunction with the jQuery tree at
www.jstree.com to create a admin interface for a forum that allows
multiple and unlimited subforums.

It is working quite well.

The only problem is that jstree doesn't tell you how far a node has
been moved, but rather gives a reference node and tells you if the
item was moved after, before or inside the reference node (Inside
meaning it is now a subnode, after meaning that it moved upwards and
before meaning downwards).

My problem is how do I calculate the distance between two nodes (With
the same parent id) if I only know what the two nodes are? Currently I
am calculating the difference in lft values between the nodes, but it
does not always give correct values.

So, what is the recommended method for calculating the distance
between two nodes in a MPTT tree?
--~--~-~--~~~---~--~~
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: TreeBehaviour questions

2009-05-18 Thread AD7six



On May 18, 4:12 pm, Walther waltherl...@gmail.com wrote:
 I am using the tree behaviour in conjunction with the jQuery tree 
 atwww.jstree.comto create a admin interface for a forum that allows
 multiple and unlimited subforums.

 It is working quite well.

 The only problem is that jstree doesn't tell you how far a node has
 been moved, but rather gives a reference node and tells you if the
 item was moved after, before or inside the reference node (Inside
 meaning it is now a subnode, after meaning that it moved upwards and
 before meaning downwards).

 My problem is how do I calculate the distance between two nodes (With
 the same parent id) if I only know what the two nodes are? Currently I
 am calculating the difference in lft values between the nodes, but it
 does not always give correct values.

the lft and rght values alone do not give you the info you're looking
for.

 So, what is the recommended method for calculating the distance
 between two nodes in a MPTT tree?

$difference = $Model-find('count', array('conditions' = array
('parent_id' = $thisone, 'lft BETWEEN' = array($first['lft'], $last
['lft'])));

style.

hth,

AD
--~--~-~--~~~---~--~~
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 UNDEFINED VARIABLE

2009-05-18 Thread lakers fan

Hello,

I get an error undefined variable $left_content. This variable has been 
defined in beforeFilter() of app_controller.php. In beforeFilter(), the code is:

 

  $this-set(left_content,$left_content);


Somehow the variable is not passed on to the view files.. Any clues??

 

Thanks,

Bharani

_
Hotmail® goes with you. 
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
--~--~-~--~~~---~--~~
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: need to show debug only if admin - Configure::write('debug', 3); only if admin logged in

2009-05-18 Thread nurvzy

Try reversing it. debug:3 in the core and turn it off beforeRender if
you're NOT admin.


On May 17, 4:41 pm, JamesF usaexportexpe...@gmail.com wrote:
 hello all, i love cakephp's built in table that shows the sql queries
 that are running. my site is now live but i need a way to check under
 the hood without disrupting my users.

 here is what i put in the beforeRender function of my app_controller:

  function beforeRender(){

  if ($this-Auth-user('role') == 'admin'){

  Configure::write('debug', 2);
  } else {
  //
  }

 i have Configure::write('debug', 0) set in my core.php

 now this pulls up that sql table thing at the bottom of the screen but
 it is EMPTY. it says (default) 0 query took ms.

 anyone have a solution?
--~--~-~--~~~---~--~~
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: Safari 4 Keeps Logging Me Out....

2009-05-18 Thread ChicagoPlanesTrains

What is Session.checkAgent set to in your app/config/core.php? If it's
true, try setting it to false. I believe this has helped with random
log-out. Not sure if these were browser specific, but it might just do
the trick. Good luck!

  Any ideas on what I can do to diagnose the problem?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



'or' in paginate() where clause?

2009-05-18 Thread toby1kenobi

Hi all,

  Is it possible use 'or' in the conditions resulting from a call to
paginate? I have tried a whole load of variations (based on conditions
that work in a call to find('all'), but to no avail.

  Thanks in advance,

Toby
--~--~-~--~~~---~--~~
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: 'or' in paginate() where clause?

2009-05-18 Thread AD7six



On May 18, 5:26 pm, toby1kenobi toby.math...@gmail.com wrote:
 Hi all,

   Is it possible use 'or' in the conditions resulting from a call to
 paginate?

resulting? How are you getting paginate to give you conditions.

I have tried a whole load of variations (based on conditions
 that work in a call to find('all'), but to no avail.

like what.

AD
--~--~-~--~~~---~--~~
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: 'or' in paginate() where clause?

2009-05-18 Thread toby1kenobi

Thanks for the quick response! I was just about to follow up that post
and say that it's almost working, but not quite (and maybe the error
is mine).

Here's (a slightly simplified version of) my code:

$findParams = array(
'or' = array(
'MyItem.parent_content_item_id' = $myId,
'MyParentItem.id' = $anotherId,
'MyParentItem.id' = $yetAnotherId
));

$myItems = $this-paginate(null, $findParams);

This is returning results that satisfy the first and third 'or'
conditions, but not the second one ('MyParentItem.id' = $anotherId).
Am I missing something daft?

Toby

On May 18, 4:28 pm, AD7six andydawso...@gmail.com wrote:
 On May 18, 5:26 pm, toby1kenobi toby.math...@gmail.com wrote:

  Hi all,

    Is it possible use 'or' in the conditions resulting from a call to
  paginate?

 resulting? How are you getting paginate to give you conditions.

 I have tried a whole load of variations (based on conditions
  that work in a call to find('all'), but to no avail.

 like what.

 AD
--~--~-~--~~~---~--~~
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 UNDEFINED VARIABLE

2009-05-18 Thread dr. Hannibal Lecter

Hello,

1. NO NEED TO WRITE LIKE THIS IN THE SUBJECT
2. Are you overriding your beforeFilter() in your other controllers?
If true, are you calling parent::beforeFilter()? If not, do it now.
3. If step no.2 didn't help, did you try calling debug($this-
viewVars) in your view to see what's going on there?

On May 18, 4:41 pm, lakers fan lakersfa...@msn.com wrote:
 Hello,

     I get an error undefined variable $left_content. This variable has been 
 defined in beforeFilter() of app_controller.php. In beforeFilter(), the code 
 is:

   $this-set(left_content,$left_content);

 Somehow the variable is not passed on to the view files.. Any clues??

 Thanks,

 Bharani

 _
 Hotmail® goes with 
 you.http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_T...
--~--~-~--~~~---~--~~
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: TreeBehaviour questions

2009-05-18 Thread Walther

I think I might have just found a bug, or the condition is not
formated correctly.

CakePHP doesn't handle the between operator correctly (Converts it to
`lft BETWEEN` IN ('19', '1') instead of `lft` BETWEEN` '19' AND '1').

On May 18, 4:37 pm, AD7six andydawso...@gmail.com wrote:
 On May 18, 4:12 pm, Walther waltherl...@gmail.com wrote:

  I am using the tree behaviour in conjunction with the jQuery tree 
  atwww.jstree.comtocreate a admin interface for a forum that allows
  multiple and unlimited subforums.

  It is working quite well.

  The only problem is that jstree doesn't tell you how far a node has
  been moved, but rather gives a reference node and tells you if the
  item was moved after, before or inside the reference node (Inside
  meaning it is now a subnode, after meaning that it moved upwards and
  before meaning downwards).

  My problem is how do I calculate the distance between two nodes (With
  the same parent id) if I only know what the two nodes are? Currently I
  am calculating the difference in lft values between the nodes, but it
  does not always give correct values.

 the lft and rght values alone do not give you the info you're looking
 for.



  So, what is the recommended method for calculating the distance
  between two nodes in a MPTT tree?

 $difference = $Model-find('count', array('conditions' = array
 ('parent_id' = $thisone, 'lft BETWEEN' = array($first['lft'], $last
 ['lft'])));

 style.

 hth,

 AD
--~--~-~--~~~---~--~~
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: TreeBehaviour questions

2009-05-18 Thread Walther

Nope, no bug.

To use between you type  BETWEEN ? AND ? and not just BETWEEN.

Thanks for the help AD7six!

On May 18, 5:44 pm, Walther waltherl...@gmail.com wrote:
 I think I might have just found a bug, or the condition is not
 formated correctly.

 CakePHP doesn't handle the between operator correctly (Converts it to
 `lft BETWEEN` IN ('19', '1') instead of `lft` BETWEEN` '19' AND '1').

 On May 18, 4:37 pm, AD7six andydawso...@gmail.com wrote:

  On May 18, 4:12 pm, Walther waltherl...@gmail.com wrote:

   I am using the tree behaviour in conjunction with the jQuery tree 
   atwww.jstree.comtocreatea admin interface for a forum that allows
   multiple and unlimited subforums.

   It is working quite well.

   The only problem is that jstree doesn't tell you how far a node has
   been moved, but rather gives a reference node and tells you if the
   item was moved after, before or inside the reference node (Inside
   meaning it is now a subnode, after meaning that it moved upwards and
   before meaning downwards).

   My problem is how do I calculate the distance between two nodes (With
   the same parent id) if I only know what the two nodes are? Currently I
   am calculating the difference in lft values between the nodes, but it
   does not always give correct values.

  the lft and rght values alone do not give you the info you're looking
  for.

   So, what is the recommended method for calculating the distance
   between two nodes in a MPTT tree?

  $difference = $Model-find('count', array('conditions' = array
  ('parent_id' = $thisone, 'lft BETWEEN' = array($first['lft'], $last
  ['lft'])));

  style.

  hth,

  AD
--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-18 Thread dr. Hannibal Lecter

Here's another interesting kick in the Matt Groening.

Inability to use FormHelper::error() to show our own errors on the
fly, i.e. $form-error('Arse.biscuits', 'A pair of women's knickers is
missing'); regardless of whether I'm using a model to create a form or
not.

Workaround:

$form-validationErrors['Arse']['biscuits'] = 'Dancing like a mad
eejit is not an allowed action';
echo $form-error('Arse.biscuits');

But why?? Form error should be looking for an validation error message
only if I didn't provide one as a param. Am I the only one who finds
that logical?

On May 18, 2:27 pm, Henrique Machado henri@gmail.com wrote:
 What about create a true poll for it?

 First create a poll for all suggestions, after create a poll to vote on that
 suggestions and voilá =)

 Henrique Machado

 2009/5/18 Aivaras faifas1...@gmail.com

  Hey,

  actually the most annoying thing is that we cannot download separate parts
  of Cake. It would be cool if advanced users could choose what do they need
  for their project, just like mootools made in their download page. I
  certainly understand that this is just *wishful thinking* because Cake's
  core uses nearly everything :x

  Anyway, upload component would be totally usable!

  Also, switching from scriptaculous + prototype to jQuery would be awesome.
  People would create and share plugins, which means that our lovely community
  would become even bigger and ADmad would be even more mad (sorry AD :x)

  Enjoy,
  Faifas

  On Sat, May 16, 2009 at 06:00, Brendon Kozlowski 
  brendon...@hotmail.comwrote:

  Thought of another one.

  Paginate settings, and paginate call.  Why do they have the same
  name?  When learning how Cake works, although it's proper OOP to do
  so, it's a bit confusing to see:

  $this-paginate = array('contain' = 'User');
  $this-set('posts', $this-paginate());

  I think it would be clearer (from a name the variable what it is
  type of coding style) to use something like:
  $this-paginateOptions = array('contain' = 'User');

  Every time I see $this-paginate when skimming through code, I
  immediately see the method, completely forgetting it's also a
  property.  I hate that.  ;)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Installation Problem: CakePHP 1.2.3.8166 on CENTOS and database.php

2009-05-18 Thread TWIOF

Hello all,

I'm having a little trouble with a particular installation of cake
(1.2.3.8166) I have it running fine on my windows machine but on my
Centos machine I get a strange error when renaming the
database.php.sample to database.php

The messages appear but the wrapper and any associated bits an pieces
fail to load (including the validity of the db connection), no errors
in the logs - I'm stumped.

Anyone else has this problem?

Cheers

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



PHP array for use in javascript

2009-05-18 Thread Céryl

Hej all!

I've been trying to find a solution for this, and maybe I'm
approaching it wrong. This is the case:

For my site I need make graphs out of data in a table. I have picked
JQuery FLOT for making the graphs. However, FLOT needs data in a
jQuery array build like:

[[xaxis, yaxis]
[xaxis, yaxis]
[xaxis, yaxis]];

and then calls the plot graph function in FLOT to build it. These
functions (With the array currently hardcoded) are in my project in a
seperate .js file I load in my view.

However, When I get into my controller and get the relevant data, and
pass it to the view using Cake's Set, how can I get that (PHP)array
converted and passed to the javascript (.js file) that builds the
graph?


Has anybody any expierience or idea's with this? And if there are
graphing libraries that allow for on-the-fly graphs from a database,
that work better with Cake, please tell me! Now it's not to late to
switch!

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



Custom php.ini and .htaccess

2009-05-18 Thread Gabriel A. Gonzalez

Hi guys!
I using a custom php configuration on dreamhost and works fine with 
standalone php files.
But i can't get it working with cakephp(Cakephp works fine without the 
custom php.ini but i need it to increase te max upload size)

The thing is when i try to use the custom config with mod_rewrite I get 
a internal error.

in my .htaccess i have:

---
IfModule mod_rewrite.c
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
/IfModule

Options ExecCGI
AddHandler php5-cgi .php
Action php5-cgi /php5/php5.cgi
---

And the errors is:

--
Internal Server Error

The server encountered an internal error or misconfiguration and was 
unable to complete your request.

Please contact the server administrator, webmas...@domain.com and inform 
them of the time the error occurred, and anything you might have done 
that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while 
trying to use an ErrorDocument to handle the request.
--

And in the log get:

--
Request exceeded the limit of 10 internal redirects due to probable 
configuration error. Use 'LimitInternalRecursion' to increase the limit 
if necessary. Use 'LogLevel debug' to get a backtrace.
--

Probably is an error in the .htaccess config, but I can't solved it... 
any ideas?
Thanks a lot and sorry by mi english...

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



Update related model data

2009-05-18 Thread Jeroen

Hi,

Before I start: creating a user with an email gives no problem, but
updating a user, gives a validation error: 'email left blank'.

I have this array and I want to save the updated data
Array
(
[User] = Array
(
[firstname] = data[User][firstname]
[lastname] = data[User][lastname]
[address] = data[User][address]
[zip_code] = dat
[city] = data[User][city]
[country_id] = 149
[gender] = 2
[age] = 55
)

[Email] = Array
(
[0] = Array
(
[email] = vin...@zonnet.nl
)

)

)

I do the following things to update it:
$this-User-read(null, $this-authUser['User']['id']);
$this-User-Email-save($this-data)  $this-User-save($this-
data);
I couldn't even get saveAll method to work well.

The user saves well, but the email gives a validation error, that it
is empty (cannot be left blank).

The relationship is as follows: user has many emails.

What am I doing wrong? Cake thinks, the email is left blank, but in
fact it isn't.
--~--~-~--~~~---~--~~
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: need to show debug only if admin - Configure::write('debug', 3); only if admin logged in

2009-05-18 Thread Martin Westin

That might be undesirable since any notices or errors before
beforeRender will be in his output.

@JamesF:
Did you put the if-clause at the top of beforeFilter or at the bottom?
Your if will return false if Auth has not had a chance to do it's
thing. Check that you did NOT put it before Auth initializes.
(you will probably be missing the user table slq in your output in
this case but the rest should be there)



On May 18, 4:53 pm, nurvzy nur...@gmail.com wrote:
 Try reversing it. debug:3 in the core and turn it off beforeRender if
 you're NOT admin.

 On May 17, 4:41 pm, JamesF usaexportexpe...@gmail.com wrote:

  hello all, i love cakephp's built in table that shows the sql queries
  that are running. my site is now live but i need a way to check under
  the hood without disrupting my users.

  here is what i put in the beforeRender function of my app_controller:

   function beforeRender(){

   if ($this-Auth-user('role') == 'admin'){

   Configure::write('debug', 2);
   } else {
   //
   }

  i have Configure::write('debug', 0) set in my core.php

  now this pulls up that sql table thing at the bottom of the screen but
  it is EMPTY. it says (default) 0 query took ms.

  anyone have a solution?
--~--~-~--~~~---~--~~
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 UNDEFINED VARIABLE

2009-05-18 Thread brian

It's the underscores that are doing it; this has bitten me before.
Have a look at the source for Controller::set().

Try:

$this-set(compact('left_content'), false);

This is essentially the same as doing:

$this-set(array('left_content' = $left_content), false);

By passing in an array as the first param and also using a dummy param
in 2nd place, you aoid having Inflector munge your variable name.

On Mon, May 18, 2009 at 10:41 AM, lakers fan lakersfa...@msn.com wrote:
 Hello,
     I get an error undefined variable $left_content. This variable has been
 defined in beforeFilter() of app_controller.php. In beforeFilter(), the code
 is:

   $this-set(left_content,$left_content);

 Somehow the variable is not passed on to the view files.. Any clues??

 Thanks,
 Bharani

 
 Hotmail® goes with you. Get it on your BlackBerry or iPhone.
 


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

2009-05-18 Thread brian

Maybe it's because you're not passing 'season' to $html-link(), even
if null. Because it's defined in the route, I'll bet that the reverse
routing is thrown off when it's missing from the link creation.

On Mon, May 18, 2009 at 5:38 AM, Bogdan I. Bursuc
bogdanbursu...@gmail.com wrote:

 // routes.php
        Router::connect('/:productType/:category/:season',
         array('controller' = 'products', 'action' = 'index', 'season'
        = null),
         array('pass' = array('productType', 'category', 'season')));

        // view:

        echo $html-link('', array('controller' = 'products', 'action'
        = 'index','productType' = $productType, 'category' =
        $category));

        // result:
        a href=/Anvelope Noi/Scutere/:season/

        // desired result:
        a href=/Anvelope Noi/Scutere/

 I need desired result, instead i get result ? Why is that ?


 


--~--~-~--~~~---~--~~
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: PHP array for use in javascript

2009-05-18 Thread Martin Westin

Hi,
Try looking at JavascriptHelper::object()
http://api.cakephp.org/class/javascript-helper#method-JavascriptHelperobject

It will help you render a javascript object of any data you have in
php.

...or just parse out your data to a string yourself and set it as a
javascript variable. (= use php to dynamically create a hard-coded
javascript array)



On May 18, 6:10 pm, Céryl c.a.h.wilt...@student.tue.nl wrote:
 Hej all!

 I've been trying to find a solution for this, and maybe I'm
 approaching it wrong. This is the case:

 For my site I need make graphs out of data in a table. I have picked
 JQuery FLOT for making the graphs. However, FLOT needs data in a
 jQuery array build like:

 [[xaxis, yaxis]
 [xaxis, yaxis]
 [xaxis, yaxis]];

 and then calls the plot graph function in FLOT to build it. These
 functions (With the array currently hardcoded) are in my project in a
 seperate .js file I load in my view.

 However, When I get into my controller and get the relevant data, and
 pass it to the view using Cake's Set, how can I get that (PHP)array
 converted and passed to the javascript (.js file) that builds the
 graph?

 Has anybody any expierience or idea's with this? And if there are
 graphing libraries that allow for on-the-fly graphs from a database,
 that work better with Cake, please tell me! Now it's not to late to
 switch!

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



Forcing user to access her data only

2009-05-18 Thread Brian Lee

So, here is how my application works:

1. I have users (just like any other apps)
2. I have courses that each user can create

Upon login, user will view the list of courses that she created.
I got that to work.

However, now the problem is, I don't know the simple, neat way to
block user from accessing classes that she did not create. For
instance, Bob created courses that have IDs of 1, 2, 3. Jane has
courses with IDs of 4, 5, 6. How do I stop Bob from doing something
like localhost/courses/view/4 (trying to view Jane's course)? and
prevent Jane from doing the same for Bob's courses?

I am sure that there is very neat way to do it, because this is a
problem often comes up when developing web applications. I just want
to know the CakePHP way of doing this.

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: PHP array for use in javascript

2009-05-18 Thread brian

You could use the JavascriptHelper to create the array, or any other
block of JS code.

On Mon, May 18, 2009 at 12:10 PM, Céryl c.a.h.wilt...@student.tue.nl wrote:

 Hej all!

 I've been trying to find a solution for this, and maybe I'm
 approaching it wrong. This is the case:

 For my site I need make graphs out of data in a table. I have picked
 JQuery FLOT for making the graphs. However, FLOT needs data in a
 jQuery array build like:

 [[xaxis, yaxis]
 [xaxis, yaxis]
 [xaxis, yaxis]];

 and then calls the plot graph function in FLOT to build it. These
 functions (With the array currently hardcoded) are in my project in a
 seperate .js file I load in my view.

 However, When I get into my controller and get the relevant data, and
 pass it to the view using Cake's Set, how can I get that (PHP)array
 converted and passed to the javascript (.js file) that builds the
 graph?


 Has anybody any expierience or idea's with this? And if there are
 graphing libraries that allow for on-the-fly graphs from a database,
 that work better with Cake, please tell me! Now it's not to late to
 switch!

 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: Forcing user to access her data only

2009-05-18 Thread brian

You can either use ACL or, simpler, just check the User.id when
fetching the courses. You can either fetch the course by ID, then
check its user_id matches $this-Auth-user('id') (if you're using
Auth). Or, use find() instead of read() and add another condition:

'Course.id' = $id,
'Course.user_id' = $this-Auth-user('id')



On Mon, May 18, 2009 at 1:03 PM, Brian Lee brianleeu...@gmail.com wrote:

 So, here is how my application works:

 1. I have users (just like any other apps)
 2. I have courses that each user can create

 Upon login, user will view the list of courses that she created.
 I got that to work.

 However, now the problem is, I don't know the simple, neat way to
 block user from accessing classes that she did not create. For
 instance, Bob created courses that have IDs of 1, 2, 3. Jane has
 courses with IDs of 4, 5, 6. How do I stop Bob from doing something
 like localhost/courses/view/4 (trying to view Jane's course)? and
 prevent Jane from doing the same for Bob's courses?

 I am sure that there is very neat way to do it, because this is a
 problem often comes up when developing web applications. I just want
 to know the CakePHP way of doing this.

 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: Forcing user to access her data only

2009-05-18 Thread Gabriel A. Gonzalez

Hi Brian, i assume that each course have an user_id right? so when you 
list, edit or view the courses just use a condition to search all the 
courses of the current user... ex:

$cond = array('Course.user_id' = $Current_user_id);
$this-set('courses', $this-paginate('Course', $cond));

Brian Lee escribió:
 So, here is how my application works:

 1. I have users (just like any other apps)
 2. I have courses that each user can create

 Upon login, user will view the list of courses that she created.
 I got that to work.

 However, now the problem is, I don't know the simple, neat way to
 block user from accessing classes that she did not create. For
 instance, Bob created courses that have IDs of 1, 2, 3. Jane has
 courses with IDs of 4, 5, 6. How do I stop Bob from doing something
 like localhost/courses/view/4 (trying to view Jane's course)? and
 prevent Jane from doing the same for Bob's courses?

 I am sure that there is very neat way to do it, because this is a
 problem often comes up when developing web applications. I just want
 to know the CakePHP way of doing this.

 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: Running a Controller Function from the Console

2009-05-18 Thread Gwoo

requestAction should work.

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



Re: httpsocket and xml

2009-05-18 Thread Gwoo

What have you tried? There a re several examples in the test cases.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



TreeBehaviour Scope

2009-05-18 Thread Walther

Hi there

How does the TreeBehaviour scope work? I imagine that it is meant to
allow seperating of trees according to a certain external entity, and
thereby allow you to have more then one tree inside a single table.

But, it does not look like that is in fact what it is doing.

How do you go about creating more then one tree in a single table? In
my case I have Categories and Forums. Categories have many forums, and
forums can have many nested children forums.
--~--~-~--~~~---~--~~
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: httpsocket and xml

2009-05-18 Thread paulos nikolo
I didnt try anything yetbut i want some example code to help me start if
you know any

2009/5/18 Gwoo gwoo.cake...@gmail.com


 What have you tried? There a re several examples in the test cases.
 


--~--~-~--~~~---~--~~
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: need to show debug only if admin - Configure::write('debug', 3); only if admin logged in

2009-05-18 Thread JamesF

@Martin

even if i remove the conditional and set Configure::write('debug', 2)
in beforeFilter on its own...still no sql is shown. says
(default) 0 query took ms


On May 18, 12:22 pm, Martin Westin martin.westin...@gmail.com wrote:
 That might be undesirable since any notices or errors before
 beforeRender will be in his output.

 @JamesF:
 Did you put the if-clause at the top of beforeFilter or at the bottom?
 Your if will return false if Auth has not had a chance to do it's
 thing. Check that you did NOT put it before Auth initializes.
 (you will probably be missing the user table slq in your output in
 this case but the rest should be there)

 On May 18, 4:53 pm, nurvzy nur...@gmail.com wrote:

  Try reversing it. debug:3 in the core and turn it off beforeRender if
  you're NOT admin.

  On May 17, 4:41 pm, JamesF usaexportexpe...@gmail.com wrote:

   hello all, i love cakephp's built in table that shows the sql queries
   that are running. my site is now live but i need a way to check under
   the hood without disrupting my users.

   here is what i put in the beforeRender function of my app_controller:

    function beforeRender(){

    if ($this-Auth-user('role') == 'admin'){

    Configure::write('debug', 2);
    } else {
    //
    }

   i have Configure::write('debug', 0) set in my core.php

   now this pulls up that sql table thing at the bottom of the screen but
   it is EMPTY. it says (default) 0 query took ms.

   anyone have a solution?
--~--~-~--~~~---~--~~
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: retrieving data from another table

2009-05-18 Thread justclint

Hey Faza and Rick thanks for your reply. Yes, I am trying to get
Gender.name. So what Im trying to do is get my array to show up
something like:

[Product] = Array
(
[id] = 21
[color_id] = 3
[image_thumb] = aw_ls_black.png
[price] = 27.95
[shipping_price] = 5.00
[style_id] = 1
)

[Style] = Array
(
[id] = 1
[name] = All Weather Longsleeve Compression Shirt

   [Gender] = Array
   (
 [gender_id] = 2
 [gender_name] = Men
 )
[category_id] = 2
[material_id] = 2
[application_id] = 2

*Notice the sub array Gender under Style array

I tried doing the $this-Style-recursive = 1;  and $this-Product-
Style-recursive = 1;  in my products_controller as shown below but
still not getting the correct results.

function view($id = null) {
if (!$id) {
$this-Session-setFlash(__('Invalid Product.', true));
$this-redirect(array('action'='index'));
}
$this-Style-recursive = 1;
$this-set('product', $this-Product-read(null, $id));

}

And in my product/view Ive tried echo $product['Gender']['name']
$product['Style']['Gender.name'] but obviously its showing as an
unrecognized variable.

Im reading up on the containable right now as I've never used that
behavior before.

Any additional help would be great. Thanks guys!

On May 18, 6:19 am, Rick will...@gmail.com wrote:
 What name are you trying to get?  Looks like you have Style.name
 already available in your result.

 If there is a Gender.name you are trying to see you can set the
 recursive to a higher number before the find:

 $this-Style-recursive = 2;

 Or use the Containable behavior as mentioned above.

 On May 17, 5:22 pm, justclint justcl...@gmail.com wrote:

  Im pulling the data successfully but Im trying to get the name value
  as opposed to the id value in a separate table.

  When I do debug I get this:
  (
      [Product] = Array
          (
              [id] = 21
              [color_id] = 3
              [image_thumb] = aw_ls_black.png
              [price] = 27.95
              [shipping_price] = 5.00
              [style_id] = 1
          )

      [Style] = Array
          (
              [id] = 1
              [name] = All Weather Longsleeve Compression Shirt
              [gender_id] = 2
              [category_id] = 2
              [material_id] = 2
              [application_id] = 2

  For sake of example I will just reference the gender_id. I need it to
  show the name not the id.

  I have the following tables/models.

  Products
  Styles
  Genders

  Product Model:
  class Product extends AppModel {

          var $name = 'Product';

          var $belongsTo = array(
                  'Style' = array(
                          'className' = 'Style',
                          'foreignKey' = 'style_id',
                          'conditions' = '',
                          'fields' = '',
                          'order' = ''
                  ),
  );

  }

  Styles Model:
  class Style extends AppModel {

          var $name = 'Style';

          var $belongsTo = array(
                  'Gender' = array(
                          'className' = 'Gender',
                          'foreignKey' = 'gender_id',
                          'conditions' = '',
                          'fields' = '',
                          'order' = ''
                  ),
                  'Category' = array(
                          'className' = 'Category',
                          'foreignKey' = 'category_id',
                          'conditions' = '',
                          'fields' = '',
                          'order' = ''
                  ),
                  'Material' = array(
                          'className' = 'Material',
                          'foreignKey' = 'material_id',
                          'conditions' = '',
                          'fields' = '',
                          'order' = ''
                  ),
                  'Application' = array(
                          'className' = 'Application',
                          'foreignKey' = 'application_id',
                          'conditions' = '',
                          'fields' = '',
                          'order' = ''
                  )
          );

  }

  Gender Model:
          var $name = 'Gender';

          var $hasMany = array(

                  'Style' = array(
                          'className' = 'Style',
                          'foreignKey' = 'gender_id',
                          'dependent' = false,
                          'conditions' = '',
                          'fields' = '',
                          'order' = '',
                          'limit' = '',
                          'offset' = '',
                     

Re: Forcing user to access her data only

2009-05-18 Thread Brian Lee

But how does this prevent user from accessing a random course?

such as typing localhost/courses/view/123
and hoping to see what he gets for course_id 123.

I know that paginate would restrict what I would like to list;
however, that does not prevent the user from typing the actual url to
access (add, view, delete) the course with some random course number
that he/she did not create.

On May 18, 10:18 am, Gabriel A. Gonzalez gabriel...@gmail.com
wrote:
 Hi Brian, i assume that each course have an user_id right? so when you
 list, edit or view the courses just use a condition to search all the
 courses of the current user... ex:

 $cond = array('Course.user_id' = $Current_user_id);
 $this-set('courses', $this-paginate('Course', $cond));

 Brian Lee escribió:

  So, here is how my application works:

  1. I have users (just like any other apps)
  2. I have courses that each user can create

  Upon login, user will view the list of courses that she created.
  I got that to work.

  However, now the problem is, I don't know the simple, neat way to
  block user from accessing classes that she did not create. For
  instance, Bob created courses that have IDs of 1, 2, 3. Jane has
  courses with IDs of 4, 5, 6. How do I stop Bob from doing something
  like localhost/courses/view/4 (trying to view Jane's course)? and
  prevent Jane from doing the same for Bob's courses?

  I am sure that there is very neat way to do it, because this is a
  problem often comes up when developing web applications. I just want
  to know the CakePHP way of doing this.

  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: Forcing user to access her data only

2009-05-18 Thread Brian Lee

never mind. I get it!

Thanks!

On May 18, 12:05 pm, Brian Lee brianleeu...@gmail.com wrote:
 But how does this prevent user from accessing a random course?

 such as typing localhost/courses/view/123
 and hoping to see what he gets for course_id 123.

 I know that paginate would restrict what I would like to list;
 however, that does not prevent the user from typing the actual url to
 access (add, view, delete) the course with some random course number
 that he/she did not create.

 On May 18, 10:18 am, Gabriel A. Gonzalez gabriel...@gmail.com
 wrote:

  Hi Brian, i assume that each course have an user_id right? so when you
  list, edit or view the courses just use a condition to search all the
  courses of the current user... ex:

  $cond = array('Course.user_id' = $Current_user_id);
  $this-set('courses', $this-paginate('Course', $cond));

  Brian Lee escribió:

   So, here is how my application works:

   1. I have users (just like any other apps)
   2. I have courses that each user can create

   Upon login, user will view the list of courses that she created.
   I got that to work.

   However, now the problem is, I don't know the simple, neat way to
   block user from accessing classes that she did not create. For
   instance, Bob created courses that have IDs of 1, 2, 3. Jane has
   courses with IDs of 4, 5, 6. How do I stop Bob from doing something
   like localhost/courses/view/4 (trying to view Jane's course)? and
   prevent Jane from doing the same for Bob's courses?

   I am sure that there is very neat way to do it, because this is a
   problem often comes up when developing web applications. I just want
   to know the CakePHP way of doing this.

   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: Safari 4 Keeps Logging Me Out....

2009-05-18 Thread Kyle Decot

Awesome! I set it to false an it fixed the problem. Thanks so much!

On May 18, 11:03 am, ChicagoPlanesTrains myronhay...@gmail.com
wrote:
 What is Session.checkAgent set to in your app/config/core.php? If it's
 true, try setting it to false. I believe this has helped with random
 log-out. Not sure if these were browser specific, but it might just do
 the trick. Good luck!



   Any ideas on what I can do to diagnose the problem?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



link TO an image

2009-05-18 Thread foldiman

I'm stuck trying to construct a URL using the html helper that points
to an jpeg sitting in an 'uploads' folder in my webroot folder. I've
tried the following.

$html-link($html-image('/uploads/main_demo.jpg'), array($html-url('/
uploads/main_zoom.jpg', true)), array('title' = 'hello', 'escape' =
false, 'class' = 'mg_main'));

However, this creates the following URL which is obviously broken.

http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg

When I remove the 'true' option from the $html-url statement I get
this which is also wrong.

http://mysite/photos/mediagallery/uploads/main_zoom.jpg

And then I also noticed that when I go to the following url, Cake asks
for a controller which is of course missing.

http://mysite/uploads/main_zoom.jpg

So how can I just point the browser to this image?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Syntax errors running console script on production server

2009-05-18 Thread Jason

I have a working app that runs with no errors on my local machine.
When I upload it to my production server (DreamHost) the app works
fine in the browser, but I have a shell script that I run through the
console that gives me errors on the production server.

The errors I'm getting seem to have to do with class object syntax.
For example - this function declaration in my shell file:

private function _checkRules($text, $author_type, $rules) {

Produces this error

Parse error: syntax error, unexpected T_STRING, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/jasford/
feedmagnet.com/app/vendors/shells/import.php on line 72

but if I remove the word private from the front of the line it does
not return a syntax error.

Does anyone have any idea what could be going on here? I'm running PHP
5.2.9 locally (Entropy release 7) and PHP 5.2.6 on the remote server.

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



Datetime difference

2009-05-18 Thread Céryl

Hej all!

Since my good advice just ago, I got to another bottleneck.

I have a form in which the user selects two times (a start- and an end-
time). The form works perfectly and the times get stored in the table
as hh:mm:ss.

However, I have a 3th row in the database that must hold the elapsed
time between the two form-inputted times. I want the computer to
calculate this. I figured I must do this in in the controller, I can
of course even do after the $this-Model-save() action with a
saveField, just before the redirect.

However, I cannot seem to find a good example of making that function.
I'm not sure how i get my timestamp back from the form, if they are
simply substractable and how to store it back in the table.

If it makes matters easier, elapsed time can be stored as an integer
holding seconds between times in the table, I can probably calculate
those back in elapsed minutes/hours in a later view of the table.

Any idea's or links to examples of working with Timestamps? It always
boggles me!

--~--~-~--~~~---~--~~
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 create a unique ACL for multiples apps?

2009-05-18 Thread Thiago Sathler

Hi Celso,

perhaps I could be wrong, but i think this:

GLOBAL DATABASE
User
Group
Aro

APP DATABASE
aco
aros_acos

In APP-Model file, the var $useTable is useful.

will it work?



On 14 maio, 14:38, Celso cels...@gmail.com wrote:
 How create a unique ACL for multiples apps? Because we have many apps
 to migrate to CakePHP, these apps actually uses a unique ugly auth
 for all apps...

 Thanks,
 Celso

--~--~-~--~~~---~--~~
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: PHP array for use in javascript

2009-05-18 Thread Céryl

Worked almost a charm... Still, I ended up writing a this codeblock to
manually make-up the output the way I want it:

$i=0;
$output = [;
foreach($data as $key=$val){
if ($i != 0) {$output .= , ;}

$output .= [.$key., .$val.];
$i++;
}
$output .= ];
echo $output;

It makes the array look like the string [[x,y],[x,y]...[x,y]] whith
which I used Codeblock to generate the javaCode. Thanks all!


On 18 mei, 19:08, brian bally.z...@gmail.com wrote:
 You could use the JavascriptHelper to create the array, or any other
 block of JS code.

 On Mon, May 18, 2009 at 12:10 PM, Céryl c.a.h.wilt...@student.tue.nl wrote:

  Hej all!

  I've been trying to find a solution for this, and maybe I'm
  approaching it wrong. This is the case:

  For my site I need make graphs out of data in a table. I have picked
  JQuery FLOT for making the graphs. However, FLOT needs data in a
  jQuery array build like:

  [[xaxis, yaxis]
  [xaxis, yaxis]
  [xaxis, yaxis]];

  and then calls the plot graph function in FLOT to build it. These
  functions (With the array currently hardcoded) are in my project in a
  seperate .js file I load in my view.

  However, When I get into my controller and get the relevant data, and
  pass it to the view using Cake's Set, how can I get that (PHP)array
  converted and passed to the javascript (.js file) that builds the
  graph?

  Has anybody any expierience or idea's with this? And if there are
  graphing libraries that allow for on-the-fly graphs from a database,
  that work better with Cake, please tell me! Now it's not to late to
  switch!

  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: link TO an image

2009-05-18 Thread brian

Do you have a route beginning with 'uploads'? You could just construct
a regular img tag  link (ie. without the helper), seeing as you want
to avoid any controllers that Router might think you're pointing to.

On Mon, May 18, 2009 at 3:50 PM, foldiman vi...@vinceallen.com wrote:

 I'm stuck trying to construct a URL using the html helper that points
 to an jpeg sitting in an 'uploads' folder in my webroot folder. I've
 tried the following.

 $html-link($html-image('/uploads/main_demo.jpg'), array($html-url('/
 uploads/main_zoom.jpg', true)), array('title' = 'hello', 'escape' =
 false, 'class' = 'mg_main'));

 However, this creates the following URL which is obviously broken.

 http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg

 When I remove the 'true' option from the $html-url statement I get
 this which is also wrong.

 http://mysite/photos/mediagallery/uploads/main_zoom.jpg

 And then I also noticed that when I go to the following url, Cake asks
 for a controller which is of course missing.

 http://mysite/uploads/main_zoom.jpg

 So how can I just point the browser to this image?
 


--~--~-~--~~~---~--~~
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: link TO an image

2009-05-18 Thread justclint

Are you placing the folder upload somewhere in the webroot folder?

If not, you would want to create your upload folder in the webroot
folder. If they are images getting uploaded you might make a folder
structure like:

webroot/img/photos/mediagallery/uploads/

Then your image helper would look something like:

$html-link($html-image('photos/mediagallery/uploads/main_demo.jpg'),
array($html-url('
photos/mediagallery/uploads/main_zoom.jpg')), array('title' =
'hello', 'escape' =
false, 'class' = 'mg_main'));

Hope this helps.





On May 18, 12:50 pm, foldiman vi...@vinceallen.com wrote:
 I'm stuck trying to construct a URL using the html helper that points
 to an jpeg sitting in an 'uploads' folder in my webroot folder. I've
 tried the following.

 $html-link($html-image('/uploads/main_demo.jpg'), array($html-url('/
 uploads/main_zoom.jpg', true)), array('title' = 'hello', 'escape' =
 false, 'class' = 'mg_main'));

 However, this creates the following URL which is obviously broken.

 http://mysite/photos/mediagallery/http://mysite/uploads/main_zoom.jpg

 When I remove the 'true' option from the $html-url statement I get
 this which is also wrong.

 http://mysite/photos/mediagallery/uploads/main_zoom.jpg

 And then I also noticed that when I go to the following url, Cake asks
 for a controller which is of course missing.

 http://mysite/uploads/main_zoom.jpg

 So how can I just point the browser to this image?
--~--~-~--~~~---~--~~
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: api.cakephp.org still broken

2009-05-18 Thread brian

On Sun, May 17, 2009 at 8:59 PM, Mr-Yellow meisteryel...@gmail.com wrote:

 They might be, I'm an asshole for sure :-)

No need to explain. We get it.

 Thing is I wasn't the person who decided I wanted to work for fame and
 recognition. I'm on the cash side of things rather then the open-
 source side of things, I realise open source people do it for
 different reasons, but really that's their problem. I can't be held
 responsible for their being no cash to motivate movement on fixes.

So, what are you doing using open source code?

BTW, how quickly did MS fix all those problems with IE6? Oh, that's
right--they never bothered.

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



returning or exiting from methods of controllers

2009-05-18 Thread Brian Lee


In methods of controllers, there are usually many checks for doing
the right thing.
For instance, I check if user is accessing the right data.

However, I'm wondering what is the best way to return or exit from
these methods when errors do occur. I've been using just simple return
statement, but is there anything that's more CakePHP-like and follow
the framework's design? or is simple return/exit statement good
enough?

--~--~-~--~~~---~--~~
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: Syntax errors running console script on production server

2009-05-18 Thread Jason

I've found a few other posts where people are having similar problems,
but all of them seem to be solving their problems by realizing that
they are running PHP4 on the production server. In my case, I am
definitely running PHP5 - and I don't have any errors using Cake
classes and methods through the browser interface. The issue only
surfaces when I'm running my shell script. In fact - one of my models
is being used by the shell script and a few standard controllers and
it is only throwing an error when run through the shell script.

- Jason

On May 18, 3:15 pm, Jason jasf...@gmail.com wrote:
 I have a working app that runs with no errors on my local machine.
 When I upload it to my production server (DreamHost) the app works
 fine in the browser, but I have a shell script that I run through the
 console that gives me errors on the production server.

 The errors I'm getting seem to have to do with class object syntax.
 For example - this function declaration in my shell file:

 private function _checkRules($text, $author_type, $rules) {

 Produces this error

 Parse error: syntax error, unexpected T_STRING, expecting
 T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/jasford/
 feedmagnet.com/app/vendors/shells/import.php on line 72

 but if I remove the word private from the front of the line it does
 not return a syntax error.

 Does anyone have any idea what could be going on here? I'm running PHP
 5.2.9 locally (Entropy release 7) and PHP 5.2.6 on the remote server.

 - Jason
--~--~-~--~~~---~--~~
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: Warning (2): Cannot modify header information - headers already sent by

2009-05-18 Thread Braydenstyles

thanks will search for the white spaces..

cheers
B

On May 18, 2:04 am, paulos nikolo paulitosthe...@gmail.com wrote:
 Check for whitespaces in app_controller and the other controllers.This was
 caused from copy-paste.
 Think i may helped!

 Cheers

 2009/5/18 Braydenstyles brayden.sty...@gmail.com



  Warning (2): Cannot modify header information - headers already sent
  by (output started at /Users/braydenstyles/Sites/app/
  app_controller.php:112) [CORE/cake/libs/controller/controller.php,
  line 587]

  Code | Context
  $status =       Location:http://localhost/beta_users/login;

  header - [internal], line ??
  Controller::header() - CORE/cake/libs/controller/controller.php, line
  587
  Controller::redirect() - CORE/cake/libs/controller/controller.php,
  line 568
  AppController::checkAuth() - APP/app_controller.php, line 269
  AppController::beforeFilter() - APP/app_controller.php, line 141
  UsersController::beforeFilter() - APP/controllers/
  users_controller.php, line 49
  Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 228
  Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 213
  Object::requestAction() - CORE/cake/libs/object.php, line 102
  include - APP/views/layouts/default.ctp, line 246
  View::_render() - CORE/cake/libs/view/view.php, line 654
  View::renderLayout() - CORE/cake/libs/view/view.php, line 451
  View::render() - CORE/cake/libs/view/view.php, line 384
  Controller::render() - CORE/cake/libs/controller/controller.php, line
  744
  ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377
  ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176
  Object::dispatchMethod() - CORE/cake/libs/object.php, line 119
  ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120
--~--~-~--~~~---~--~~
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: Datetime difference

2009-05-18 Thread Gabriel A. Gonzalez

You could calculate the time difference on the fly with mysql TIMEDIFF 
function 
[http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff]
 
instead of store it in the db
And this [http://www.gidnetwork.com/b-16.html] may help to store the 
time difference.

Céryl escribió:
 Hej all!

 Since my good advice just ago, I got to another bottleneck.

 I have a form in which the user selects two times (a start- and an end-
 time). The form works perfectly and the times get stored in the table
 as hh:mm:ss.

 However, I have a 3th row in the database that must hold the elapsed
 time between the two form-inputted times. I want the computer to
 calculate this. I figured I must do this in in the controller, I can
 of course even do after the $this-Model-save() action with a
 saveField, just before the redirect.

 However, I cannot seem to find a good example of making that function.
 I'm not sure how i get my timestamp back from the form, if they are
 simply substractable and how to store it back in the table.

 If it makes matters easier, elapsed time can be stored as an integer
 holding seconds between times in the table, I can probably calculate
 those back in elapsed minutes/hours in a later view of the table.

 Any idea's or links to examples of working with Timestamps? It always
 boggles me!

 

   


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



Content Categorization with CakePHP ?

2009-05-18 Thread the...@gmail.com

Hey.
I am pretty confused with CakePHP's Tree, I actually do not have a
clue how to categorize my content with tree. I tried a few ways,
almost did it, but still having trouble with it.
Maybe someone could write a tutorial or link me to a tutorial outside
cakePHP's bakery.
Thankyou.

--~--~-~--~~~---~--~~
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: retrieving data from another table

2009-05-18 Thread justclint

Ok, im not sure what I was doing wrong but it was just as simple as
you mentioned. I just added $this-Product-recursive = 2; and viola,
everything was fetched properly.

Thanks a million!

On May 18, 11:55 am, justclint justcl...@gmail.com wrote:
 Hey Faza and Rick thanks for your reply. Yes, I am trying to get
 Gender.name. So what Im trying to do is get my array to show up
 something like:

 [Product] = Array
         (
             [id] = 21
             [color_id] = 3
             [image_thumb] = aw_ls_black.png
             [price] = 27.95
             [shipping_price] = 5.00
             [style_id] = 1
         )

     [Style] = Array
         (
             [id] = 1
             [name] = All Weather Longsleeve Compression Shirt

            [Gender] = Array
                (
                  [gender_id] = 2
                  [gender_name] = Men
                  )
             [category_id] = 2
             [material_id] = 2
             [application_id] = 2

 *Notice the sub array Gender under Style array

 I tried doing the $this-Style-recursive = 1;  and 
 $this-Product-Style-recursive = 1;  in my products_controller as shown 
 below but

 still not getting the correct results.

 function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Invalid Product.', 
 true));
                         $this-redirect(array('action'='index'));
                 }
                 $this-Style-recursive = 1;
                 $this-set('product', $this-Product-read(null, $id));

 }

 And in my product/view Ive tried echo $product['Gender']['name']
 $product['Style']['Gender.name'] but obviously its showing as an
 unrecognized variable.

 Im reading up on the containable right now as I've never used that
 behavior before.

 Any additional help would be great. Thanks guys!

 On May 18, 6:19 am, Rick will...@gmail.com wrote:

  What name are you trying to get?  Looks like you have Style.name
  already available in your result.

  If there is a Gender.name you are trying to see you can set the
  recursive to a higher number before the find:

  $this-Style-recursive = 2;

  Or use the Containable behavior as mentioned above.

  On May 17, 5:22 pm, justclint justcl...@gmail.com wrote:

   Im pulling the data successfully but Im trying to get the name value
   as opposed to the id value in a separate table.

   When I do debug I get this:
   (
       [Product] = Array
           (
               [id] = 21
               [color_id] = 3
               [image_thumb] = aw_ls_black.png
               [price] = 27.95
               [shipping_price] = 5.00
               [style_id] = 1
           )

       [Style] = Array
           (
               [id] = 1
               [name] = All Weather Longsleeve Compression Shirt
               [gender_id] = 2
               [category_id] = 2
               [material_id] = 2
               [application_id] = 2

   For sake of example I will just reference the gender_id. I need it to
   show the name not the id.

   I have the following tables/models.

   Products
   Styles
   Genders

   Product Model:
   class Product extends AppModel {

           var $name = 'Product';

           var $belongsTo = array(
                   'Style' = array(
                           'className' = 'Style',
                           'foreignKey' = 'style_id',
                           'conditions' = '',
                           'fields' = '',
                           'order' = ''
                   ),
   );

   }

   Styles Model:
   class Style extends AppModel {

           var $name = 'Style';

           var $belongsTo = array(
                   'Gender' = array(
                           'className' = 'Gender',
                           'foreignKey' = 'gender_id',
                           'conditions' = '',
                           'fields' = '',
                           'order' = ''
                   ),
                   'Category' = array(
                           'className' = 'Category',
                           'foreignKey' = 'category_id',
                           'conditions' = '',
                           'fields' = '',
                           'order' = ''
                   ),
                   'Material' = array(
                           'className' = 'Material',
                           'foreignKey' = 'material_id',
                           'conditions' = '',
                           'fields' = '',
                           'order' = ''
                   ),
                   'Application' = array(
                           'className' = 'Application',
                           'foreignKey' = 'application_id',
                           'conditions' = '',
                           'fields' = '',
                           'order' = ''
                   )
           );

   }

   Gender Model:
           var $name = 'Gender';

           var $hasMany = array(

                   'Style' = 

Re: Poll: what do you hate about CakePHP?

2009-05-18 Thread Aivaras
You are definitely right indeed.

Faifas


On Mon, May 18, 2009 at 18:54, dr. Hannibal Lecter lecter...@gmail.comwrote:


 Here's another interesting kick in the Matt Groening.

 Inability to use FormHelper::error() to show our own errors on the
 fly, i.e. $form-error('Arse.biscuits', 'A pair of women's knickers is
 missing'); regardless of whether I'm using a model to create a form or
 not.

 Workaround:

 $form-validationErrors['Arse']['biscuits'] = 'Dancing like a mad
 eejit is not an allowed action';
 echo $form-error('Arse.biscuits');

 But why?? Form error should be looking for an validation error message
 only if I didn't provide one as a param. Am I the only one who finds
 that logical?

 On May 18, 2:27 pm, Henrique Machado henri@gmail.com wrote:
  What about create a true poll for it?
 
  First create a poll for all suggestions, after create a poll to vote on
 that
  suggestions and voilá =)
 
  Henrique Machado
 
  2009/5/18 Aivaras faifas1...@gmail.com
 
   Hey,
 
   actually the most annoying thing is that we cannot download separate
 parts
   of Cake. It would be cool if advanced users could choose what do they
 need
   for their project, just like mootools made in their download page. I
   certainly understand that this is just *wishful thinking* because
 Cake's
   core uses nearly everything :x
 
   Anyway, upload component would be totally usable!
 
   Also, switching from scriptaculous + prototype to jQuery would be
 awesome.
   People would create and share plugins, which means that our lovely
 community
   would become even bigger and ADmad would be even more mad (sorry AD :x)
 
   Enjoy,
   Faifas
 
   On Sat, May 16, 2009 at 06:00, Brendon Kozlowski 
 brendon...@hotmail.comwrote:
 
   Thought of another one.
 
   Paginate settings, and paginate call.  Why do they have the same
   name?  When learning how Cake works, although it's proper OOP to do
   so, it's a bit confusing to see:
 
   $this-paginate = array('contain' = 'User');
   $this-set('posts', $this-paginate());
 
   I think it would be clearer (from a name the variable what it is
   type of coding style) to use something like:
   $this-paginateOptions = array('contain' = 'User');
 
   Every time I see $this-paginate when skimming through code, I
   immediately see the method, completely forgetting it's also a
   property.  I hate that.  ;)
 


--~--~-~--~~~---~--~~
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: Content Categorization with CakePHP ?

2009-05-18 Thread brian

On Mon, May 18, 2009 at 4:52 PM, the...@gmail.com the...@gmail.com wrote:

 Hey.
 I am pretty confused with CakePHP's Tree, I actually do not have a
 clue how to categorize my content with tree. I tried a few ways,
 almost did it, but still having trouble with it.
 Maybe someone could write a tutorial or link me to a tutorial outside
 cakePHP's bakery.
 Thankyou.

Maybe you could explain what kind of data you have, along with at
least a *hint* of what you want 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
-~--~~~~--~~--~--~---



Re: Installing CakePHP to mediatemple(dv) issue

2009-05-18 Thread Brett Wilton

Check your apache2 setup has mod_rewrite installed and your directory
permissions.

If you still have trouble with MT Centos setup I'd suggest asking the
MT framework forum as a number of people use Cake on DV.


http://wiltonsoftware.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
-~--~~~~--~~--~--~---



saveAll Edit - Creates instead of Updating even with passed IDs

2009-05-18 Thread Tim

This passes the ID for the Promotion properly but not for the
associated title and body:

-
$this-Promotion-id = $id; // Set the IDs so we update rows instead
of creating new ones.
$current = $this-Promotion-find('first', array('conditions' = array
('Promotion.id' = $id),'fields' = array('title_id','body_id')));
$this-Promotion-Title-id = $current['Promotion']['title_id'];
$this-Promotion-Body-id = $current['Promotion']['body_id'];
-

Any ideas?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Submit/Cancel problem

2009-05-18 Thread Nancy

So, I added a submit and a cancel button to my ajax form and it
doesn't matter which you press, it always returns the submit button,
not the cancel.

The view code has this at the bottom (I stopped using helpers to see
if raw HTML would help, it didn't):
input name=Submit value=submit type=submit
input name=Cancel value=cancel type=submit

In the controller (admin_edit) function, I'm dumping out the contents
of $this-params['form'] and it always shows

Array
(
[Submit] = submit
)

Even if you press the cancel button.  Am I doing something wrong?

Thanks!

Nancy

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



Routing oddities

2009-05-18 Thread doze

Hello,

I'm having some problems with my routing, let's go straight to
business:

When accessing this url: http://localhost/somecompany/home

1. With route setup:

Router::connect('/:company/:controller/*');

Result:
Works ok, get's routed to /app/controllers/home_controller.php

2. With route setup:

Router::connect('/:company/:controller/*', array(), array
('company' = '[A-Z][a-z][0-9]'));

Result:
Fails, get's routed to /app/controllers/somecompany_controller.php

Question:
Why it fails when I set regexp check to the company parameter?


When accessing this url: http://localhost/somecompany/

1. With route setup:

Router::connect('/:company/*', array('controller' = 'home'));

Result:
Works ok, get's routed to /app/controllers/home_controller.php

2. With route setup:

Router::connect('/:company/:controller/*');
Router::connect('/:company/*', array('controller' = 'home'));

Result:
Fails, get's routed to /app/controllers/controller.php

Question:
Why it doesn't take the second route and find to home controller?


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: need to show debug only if admin - Configure::write('debug', 3); only if admin logged in

2009-05-18 Thread JamesF

i think what this issue is coming down to is me working off an alias
of my live site and keeping that in debug modethis is probably for
the best since my site is live now and i shouldn't be mucking around
while people are using it.

On May 18, 2:51 pm, JamesF usaexportexpe...@gmail.com wrote:
 @Martin

 even if i remove the conditional and set Configure::write('debug', 2)
 in beforeFilter on its own...still no sql is shown. says
 (default) 0 query took ms

 On May 18, 12:22 pm, Martin Westin martin.westin...@gmail.com wrote:

  That might be undesirable since any notices or errors before
  beforeRender will be in his output.

  @JamesF:
  Did you put the if-clause at the top of beforeFilter or at the bottom?
  Your if will return false if Auth has not had a chance to do it's
  thing. Check that you did NOT put it before Auth initializes.
  (you will probably be missing the user table slq in your output in
  this case but the rest should be there)

  On May 18, 4:53 pm, nurvzy nur...@gmail.com wrote:

   Try reversing it. debug:3 in the core and turn it off beforeRender if
   you're NOT admin.

   On May 17, 4:41 pm, JamesF usaexportexpe...@gmail.com wrote:

hello all, i love cakephp's built in table that shows the sql queries
that are running. my site is now live but i need a way to check under
the hood without disrupting my users.

here is what i put in the beforeRender function of my app_controller:

 function beforeRender(){

 if ($this-Auth-user('role') == 'admin'){

 Configure::write('debug', 2);
 } else {
 //
 }

i have Configure::write('debug', 0) set in my core.php

now this pulls up that sql table thing at the bottom of the screen but
it is EMPTY. it says (default) 0 query took ms.

anyone have a solution?
--~--~-~--~~~---~--~~
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: Routing oddities

2009-05-18 Thread brian

On Mon, May 18, 2009 at 7:40 PM, doze doze...@gmail.com wrote:

 Hello,

 I'm having some problems with my routing, let's go straight to
 business:

 When accessing this url: http://localhost/somecompany/home

 1. With route setup:

    Router::connect('/:company/:controller/*');

    Result:
    Works ok, get's routed to /app/controllers/home_controller.php

 2. With route setup:

    Router::connect('/:company/:controller/*', array(), array
 ('company' = '[A-Z][a-z][0-9]'));

    Result:
    Fails, get's routed to /app/controllers/somecompany_controller.php

    Question:
    Why it fails when I set regexp check to the company parameter?

That regexp will catch only a string constructed of a single uppercase
letter, followed by a single lowercase letter, followed by a single
digit. Try:

[A-Za-z0-9]+

This incorporates the 3 character types in a single set.The + says to
match one or more characters.

 When accessing this url: http://localhost/somecompany/

 1. With route setup:

    Router::connect('/:company/*', array('controller' = 'home'));

    Result:
    Works ok, get's routed to /app/controllers/home_controller.php

 2. With route setup:

    Router::connect('/:company/:controller/*');
    Router::connect('/:company/*', array('controller' = 'home'));

    Result:
    Fails, get's routed to /app/controllers/controller.php

    Question:
    Why it doesn't take the second route and find to home controller?

That one I'm unsure of as I never use the ':controller' placeholder.

--~--~-~--~~~---~--~~
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: Syntax errors running console script on production server

2009-05-18 Thread brian

Maybe the server has a version 4.x CLI installed as well as a 5.x
Apache module. If you have terminal access, type: php -v

On Mon, May 18, 2009 at 5:11 PM, Jason jasf...@gmail.com wrote:

 I've found a few other posts where people are having similar problems,
 but all of them seem to be solving their problems by realizing that
 they are running PHP4 on the production server. In my case, I am
 definitely running PHP5 - and I don't have any errors using Cake
 classes and methods through the browser interface. The issue only
 surfaces when I'm running my shell script. In fact - one of my models
 is being used by the shell script and a few standard controllers and
 it is only throwing an error when run through the shell script.

 - Jason

 On May 18, 3:15 pm, Jason jasf...@gmail.com wrote:
 I have a working app that runs with no errors on my local machine.
 When I upload it to my production server (DreamHost) the app works
 fine in the browser, but I have a shell script that I run through the
 console that gives me errors on the production server.

 The errors I'm getting seem to have to do with class object syntax.
 For example - this function declaration in my shell file:

 private function _checkRules($text, $author_type, $rules) {

 Produces this error

 Parse error: syntax error, unexpected T_STRING, expecting
 T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/jasford/
 feedmagnet.com/app/vendors/shells/import.php on line 72

 but if I remove the word private from the front of the line it does
 not return a syntax error.

 Does anyone have any idea what could be going on here? I'm running PHP
 5.2.9 locally (Entropy release 7) and PHP 5.2.6 on the remote server.

 - Jason
 


--~--~-~--~~~---~--~~
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: Routing oddities

2009-05-18 Thread doze

I have done more tests with these and got little bit further, but
still having issues.. Here's the current state:

With these routes:

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

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

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

Following urls work:

localhost/somecompany/
localhost/somecompany/home
localhost/somecompany/home/test -- goes to test() method of
home_controller.php

But action parameters don't work (because they are not being cached by
the routes):

localhost/somecompany/home/test/1 --routes to-- app\controllers
\asd_controller.php

With these routes trying to also catch the parameters for action:

 Router::connect('/:company/:controller/:action/*', array('controller'
= 'home', 'action' = 'index'));

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

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

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

Following urls work:

localhost/asd/home
localhost/asd/home/test
localhost/asd/home/test/11

But the url:

localhost/asd/

get's routed to a null controller again, e.g. app\controllers
\controller.php

I'll update my progress as I go along, but please anyone post if you
know what's going on!

Thanks.


On May 19, 3:58 am, brian bally.z...@gmail.com wrote:
 On Mon, May 18, 2009 at 7:40 PM, doze doze...@gmail.com wrote:

  Hello,

  I'm having some problems with my routing, let's go straight to
  business:

  When accessing this url:http://localhost/somecompany/home

  1. With route setup:

     Router::connect('/:company/:controller/*');

     Result:
     Works ok, get's routed to /app/controllers/home_controller.php

  2. With route setup:

     Router::connect('/:company/:controller/*', array(), array
  ('company' = '[A-Z][a-z][0-9]'));

     Result:
     Fails, get's routed to /app/controllers/somecompany_controller.php

     Question:
     Why it fails when I set regexp check to the company parameter?

 That regexp will catch only a string constructed of a single uppercase
 letter, followed by a single lowercase letter, followed by a single
 digit. Try:

 [A-Za-z0-9]+

 This incorporates the 3 character types in a single set.The + says to
 match one or more characters.



  When accessing this url:http://localhost/somecompany/

  1. With route setup:

     Router::connect('/:company/*', array('controller' = 'home'));

     Result:
     Works ok, get's routed to /app/controllers/home_controller.php

  2. With route setup:

     Router::connect('/:company/:controller/*');
     Router::connect('/:company/*', array('controller' = 'home'));

     Result:
     Fails, get's routed to /app/controllers/controller.php

     Question:
     Why it doesn't take the second route and find to home controller?

 That one I'm unsure of as I never use the ':controller' placeholder.
--~--~-~--~~~---~--~~
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: returning or exiting from methods of controllers

2009-05-18 Thread brian

It depends. If the method is not an action, but a private method
called from within the controller (eg. $this-__whatever()) then
returning false is a good idea. It really depends on wht you want from
the method.

If it's an action (ie. called directly through the request) you're
better off setting an error msg--whether in Session-flash() or an
error variable--or redirecting (again, using flash to set a msg).

The usual way to set up an action's flow is to check if $this-data is
empty. If not, this is the 2nd request (a form has been submitted).
Generally, that check can go right at the top. But, in some cases, you
might want to do some checking whether it's the 1st or 2nd request. In
that case, do that first. If it fails, you might want to redirect.


function someAction($id = null)
{
/* this will be run for all requests/submissions
 */
if (!$id)
{
$this-Session-flash('ruh-roh!');

/* processing will stop after the following
 */
$this-redirect('somewhere else');
}

if (!empty($this-data))
{
/* deal with subimtted content
 */
$this-Something-create($this-data);

if ($this-Something-save())
{
/* set a msg and redirect so processing stops
 */
$this-Session-flash('done');
$this-redirect('somewhere else');
}
else
{
/* set error msg but do not redirect so further
 * processing can happen further down
 */
$this-Session-flash('ruh-roh again!');
}
}
else
{
/* first request, so grab some data
 */
$this-data = $this-Something-read(null, $id);
}

/* Grab some other data. If save failed for some reason,
 * this other data will still be set.
 */
$this-set('foo', $this-Something-Foo-findByBar('bar'));
}

On Mon, May 18, 2009 at 4:58 PM, Brian Lee brianleeu...@gmail.com wrote:


 In methods of controllers, there are usually many checks for doing
 the right thing.
 For instance, I check if user is accessing the right data.

 However, I'm wondering what is the best way to return or exit from
 these methods when errors do occur. I've been using just simple return
 statement, but is there anything that's more CakePHP-like and follow
 the framework's design? or is simple return/exit statement good
 enough?

 


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



Repopulating a form after an error

2009-05-18 Thread Jules

When a submitted form fails a validation rule, the form is presented
back to the user with their values intact.  This is obviously a good
thing, as the user doesn't have to fill the whole thing in again.

I have a form where I need to compare two of the submitted values to
make sure they're not the same.  I can't, as far as I know, use a
validation rule to compare two fields in the same form.  How can I
display the form back the user with their values intact?  Currently I
set a flash message, then redirect back to the form, but the user has
to fill the form in again.

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: Repopulating a form after an error

2009-05-18 Thread brian

Jules, have a look at my reply a moment ago to msg, 'returning or
exiting from methods of controllers'. The reason the form is
redisplayed empty is because you're redirecting. This causes a new
request to be made, so $this-data is empty and FormHelper has nothing
to fill in the form with.

If either validation or save fails, you usually want only to set a
flash msg without doing a redirect. This allows the rest of the action
to be processed, meaning that the form will simply be re-displayed.
Because $this-data still contains whatever the user submitted, the
form should contain the data.

As for comparing 2 fields:

var $validate = array(
'field1' = array(
'fieldComparison' = array(
'rule' = array('compareFieldValues', 'field2'),
'message' = 'field1 and field2 are the same!'
)
)
);

function compareFieldValues($field1 = array(), $other_field_name = null)
{
foreach ($field as $key = $value)
{
if ($value === $this-data[$this-name][$other_field_name])
{
return false;
}
else
{
continue;
}
}
return true;
}


On Mon, May 18, 2009 at 9:30 PM, Jules fattyju...@gmail.com wrote:

 When a submitted form fails a validation rule, the form is presented
 back to the user with their values intact.  This is obviously a good
 thing, as the user doesn't have to fill the whole thing in again.

 I have a form where I need to compare two of the submitted values to
 make sure they're not the same.  I can't, as far as I know, use a
 validation rule to compare two fields in the same form.  How can I
 display the form back the user with their values intact?  Currently I
 set a flash message, then redirect back to the form, but the user has
 to fill the form in again.

 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: Routing oddities

2009-05-18 Thread doze

Got it to work finally!! These are the final routes:

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

 Router::connect('/:company/:controller/:action/*', array('controller'
= 'home', 'action' = 'index'));

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

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

All I needed to do is to change the two first routes other way down.
Sweet!

Thanks for all the help and especially the great guys at #cakephp!!

Now to a next adventure.. :)

On May 19, 4:29 am, doze doze...@gmail.com wrote:
 I have done more tests with these and got little bit further, but
 still having issues.. Here's the current state:

 With these routes:

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

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

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

 Following urls work:

 localhost/somecompany/
 localhost/somecompany/home
 localhost/somecompany/home/test -- goes to test() method of
 home_controller.php

 But action parameters don't work (because they are not being cached by
 the routes):

 localhost/somecompany/home/test/1 --routes to-- app\controllers
 \asd_controller.php

 With these routes trying to also catch the parameters for action:

  Router::connect('/:company/:controller/:action/*', array('controller'
 = 'home', 'action' = 'index'));

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

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

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

 Following urls work:

 localhost/asd/home
 localhost/asd/home/test
 localhost/asd/home/test/11

 But the url:

 localhost/asd/

 get's routed to a null controller again, e.g. app\controllers
 \controller.php

 I'll update my progress as I go along, but please anyone post if you
 know what's going on!

 Thanks.

 On May 19, 3:58 am, brian bally.z...@gmail.com wrote:

  On Mon, May 18, 2009 at 7:40 PM, doze doze...@gmail.com wrote:

   Hello,

   I'm having some problems with my routing, let's go straight to
   business:

   When accessing this url:http://localhost/somecompany/home

   1. With route setup:

      Router::connect('/:company/:controller/*');

      Result:
      Works ok, get's routed to /app/controllers/home_controller.php

   2. With route setup:

      Router::connect('/:company/:controller/*', array(), array
   ('company' = '[A-Z][a-z][0-9]'));

      Result:
      Fails, get's routed to /app/controllers/somecompany_controller.php

      Question:
      Why it fails when I set regexp check to the company parameter?

  That regexp will catch only a string constructed of a single uppercase
  letter, followed by a single lowercase letter, followed by a single
  digit. Try:

  [A-Za-z0-9]+

  This incorporates the 3 character types in a single set.The + says to
  match one or more characters.

   When accessing this url:http://localhost/somecompany/

   1. With route setup:

      Router::connect('/:company/*', array('controller' = 'home'));

      Result:
      Works ok, get's routed to /app/controllers/home_controller.php

   2. With route setup:

      Router::connect('/:company/:controller/*');
      Router::connect('/:company/*', array('controller' = 'home'));

      Result:
      Fails, get's routed to /app/controllers/controller.php

      Question:
      Why it doesn't take the second route and find to home controller?

  That one I'm unsure of as I never use the ':controller' placeholder.
--~--~-~--~~~---~--~~
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 would I hide and default a foreign field in a relationship

2009-05-18 Thread Jorge Garifuna

I'm creating an application with the following two tables:

posts:
- id
- title
- body

comments:
- id
- post_id
- comment

I was able to bake this app and all the links are working. Now I would
like to customize the app so that, when a comment is added from the
post:

- the post id (list) is not showing in the comment view
- the post id gets saved when the comment is saved
- the comment gets redirected to the post the comment originated from
after saving

Any source code samples to assist with these issues would be greatly
appreciated.

Jorge
--~--~-~--~~~---~--~~
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 would I hide and default a foreign field in a relationship

2009-05-18 Thread brian

On Mon, May 18, 2009 at 10:22 PM, Jorge Garifuna garif...@gmail.com wrote:

 I'm creating an application with the following two tables:

 posts:
 - id
 - title
 - body

 comments:
 - id
 - post_id
 - comment

 I was able to bake this app and all the links are working. Now I would
 like to customize the app so that, when a comment is added from the
 post:

 - the post id (list) is not showing in the comment view

Just delete it from your view. Bake creates very generic views and,
unless you change the templates, you'll generally need to clean them
up somewhat.

 - the post id gets saved when the comment is saved

$form-hidden('Comment.post_id')

Depending on how you're doing things, you may need to do:

$form-hidden('Comment.post_id', array('value' = $post_id))

... that's if you've set the $post_id var.

 - the comment gets redirected to the post the comment originated from
 after saving

$this-redirect(
array(
'controller' = 'Post',
'action' = 'view',
$post_id
)
);

Or, if you don't want the 'view' part in the URL, you might want
something like this:

$this-redirect(
array(
'controller' = 'Post',
'action' = 'view',
'id' = $post_id
)
);

In which case your route would be:

Router::connect(
'/posts/:id',
array('controller' = 'posts', 'action' = 'view'),
array('id' = '[0-9]+', 'pass' = array('id'))
);

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



Re: Notice (8): Undefined property: CakeErrorController::$js_vars

2009-05-18 Thread Dr. Loboto

It is obvious - no js_vars found in error controller class!
If you add new properties to controllers do not forget to define them
in AppController definition. Same for models. Same for helpers.
Otherwise you see such error.

On May 18, 2:22 pm, Braydenstyles brayden.sty...@gmail.com wrote:
 Notice (8): Undefined property: CakeErrorController::$js_vars [APP/
 app_controller.php, line 103]

 Code
     {
         $this-set('meta_for_layout', Configure::read('meta'));
         $this-set('js_vars_for_layout', $this-js_vars);

 AppController::beforeRender() - APP/app_controller.php, line 103
 Controller::render() - CORE/cake/libs/controller/controller.php, line
 701
 ErrorHandler::__outputMessage() - CORE/cake/libs/error.php, line 377
 ErrorHandler::missingController() - CORE/cake/libs/error.php, line 176
 Object::dispatchMethod() - CORE/cake/libs/object.php, line 119
 ErrorHandler::__construct() - CORE/cake/libs/error.php, line 120
 Object::cakeError() - CORE/cake/libs/object.php, line 204
 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 148
 require - APP/webroot/index.php, line 90
 [main] - APP/index.php, line 25

 help 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: Repopulating a form after an error

2009-05-18 Thread Jules

Thank you Brian, I wasn't aware that you could write a custom
validation function.

However, I've tried both methods, and am still having the same
problem.  In both cases, the form comes back with fresh data in it.

I have confirmed that the custom validation rule is firing.
--~--~-~--~~~---~--~~
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: Installation Problem: CakePHP 1.2.3.8166 on CENTOS and database.php

2009-05-18 Thread Brett Wilton

what version of PHP is the centos machine running ?

have you got all the required .htaccess files and mod_rewrite
installed in apache2 ?

-
http://wiltonsoftware.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: Application setup where each customer has own database

2009-05-18 Thread doze

Hello,

Just to let you know that I got this setup working.. Thank you very
very much for the help.

I'll write up some article about the setup as I think it can help
somebody other some day.

Thanks!



On May 18, 6:44 am, Dr. Loboto drlob...@gmail.com wrote:
  How do you define a link between Models that are not in the same
  database? Will Cake check the useDbConfig from the employee
  model automatically?

 Ordinal association. Cake will load associated model and get all
 necessary info from it.

  how can I make it work with urls like:
 www.domain.com/company1/controller/action
 www.domain.com/company2/controller/action

 Read about routing again and test it yourself. Looks like something
 like this may help you:

 Router::connect(
         '/:company/:controller/:action/*',      // company name, then 
 controller
 name, then action name, then any params
         array (),       // nothing to specify - controller and action already
 pointed
         array ('company' = 'a-zA-Z0-9')     // regexp for company name check
 (also can be omitted, I think)
 );

 But it may also require explicit map non company-specific URLs before
 this rule. Also there can be problems... And will be definitely...
 Search this group for named params and prefix routing (_after_ you
 check how it works yourself).

 On May 15, 11:18 pm,dozedoze...@gmail.com wrote:

  Thanks a lot for the answer! That kind of database selection is indeed
  perfect for me and much simpler.. don't have to do any custom db
  drivers. Thanks again!

  I have couple questions though, as this is the first time I'm using
  CakePHP and don't know much about it yet.

1. Can I link tables between database configs?

   Yes, but Cake will always run separate queries, no any joins.

  How do you define a link between Models that are not in the same
  database? I know that with useDbConfig I can tell CakePHP that which
  database to use for the model, but when I'm creating a link from users
  to employees table for example, how can I tell CakePHP that the
  employees table is in the other database? Or do I need to tell that
  even? Will Cake check the useDbConfig from the employee model
  automatically?

  E.g. would this simply work:

  class User extends AppModel {
          var $useDbConfig = 'commondb';
          var $name = 'User';
          var $hasOne = 'Employee';

  }

  class Employee extends AppModel {
          var $useDbConfig = 'companydb';
          var $name = 'Employee';

  }

  // get employee object from the user object
  $employee = $user-Employee;

  Then to another question...

   You can determine and save database name by something like this (I
   assume that routing with param 'company' is used):

  I tried to read about the routing in CakePHP, but I didn't quite get
  it.. so how can I make it work with urls like:

 www.domain.com/company1/controller/actionwww.domain.com/company2/cont...

  and take that first part of the url out to save as db name (with
  Configure::write like you pointed out) and then use the rest of the
  url to navigate normally to the controller / action. I could do it in
  the app/webroot/index.php before the $url parameter is passed to the
  dispatcher, but I'm guessing that would be the wrong way to do it. Can
  I do it with the routing somehow?

  These might be quite trivial things for more advanced CakePHP users,
  but for me as a newbie, I haven't quite grasped the idea yet..

  I'm definitely going to do some write up of the whole setup.

  On May 15, 5:44 am, Dr. Loboto drlob...@gmail.com wrote:

1. Can I link tables between database configs?

   Yes, but Cake will always run separate queries, no any joins.

2. How to automate the database table selection?

   Method on link you provided looks too complex for your situation. If
   each company have own databases with completely same structure, the
   only thing you need to do for company specific models is to select
   appropriate DB config.

   You can determine and save database name by something like this (I
   assume that routing with param 'company' is used):

   class AppController extends Controller {
           function constructClasses() {
                   // Save company name when we already know it but before 
   models are
   created
                   Configure::write(
                           'companyDB',
                           !empty($this-params['company']) ? 
   $this-params['company'] : false
                   );
                   parent::constructClasses();
           }

   }

   Mark all company-specific models like this:

   class CompanyProfile extends AppModel {
           var $specific = true;

   }

   And have such AppModel:

   class AppModel extends Model {
           var $specific = false;

           function __construct($id = false, $table = null, $ds = null) {
                   if ($this-specific) {
                           // Get saved company/database name
                           $dbName = 

can i use integer in model name

2009-05-18 Thread Chander Bhan

How can i use table raw_06 and model  can anyone help me
--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-18 Thread DanielMedia

+1 with Matt Curry on this:

Remove Model::recursive.  All find calls would return just the model
and if you wanted associated models you HAVE TO use Containable.

- Built in functionality for custom find types. Right now there are
some nice hacks that you can put into your AppModel to define your own
custom find types but this should work out of the box.

- The MEIO upload behavior (or something like it) could be added to
the core. That behavior has greatly simplified managing uploads for me
and is quite flexible.
--~--~-~--~~~---~--~~
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: Submit/Cancel problem

2009-05-18 Thread John Andersen

Please show the code in which you create the buttons, together with
the surrounding form code!
Then we may be able to assist you :)
   John

On May 19, 2:11 am, Nancy nancy.milli...@gmail.com wrote:
 So, I added a submit and a cancel button to my ajax form and it
 doesn't matter which you press, it always returns the submit button,
 not the cancel.

 The view code has this at the bottom (I stopped using helpers to see
 if raw HTML would help, it didn't):
     input name=Submit value=submit type=submit
     input name=Cancel value=cancel type=submit

 In the controller (admin_edit) function, I'm dumping out the contents
 of $this-params['form'] and it always shows

 Array
 (
     [Submit] = submit
 )

 Even if you press the cancel button.  Am I doing something wrong?

 Thanks!

 Nancy
--~--~-~--~~~---~--~~
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: Submit/Cancel problem

2009-05-18 Thread Gabriel A. Gonzalez

Use reset or button NOT submit type for the cancel button.

input name=Cancel value=cancel type=reset or input name=Cancel 
value=cancel type=button

Nancy escribió:
 So, I added a submit and a cancel button to my ajax form and it
 doesn't matter which you press, it always returns the submit button,
 not the cancel.

 The view code has this at the bottom (I stopped using helpers to see
 if raw HTML would help, it didn't):
 input name=Submit value=submit type=submit
 input name=Cancel value=cancel type=submit

 In the controller (admin_edit) function, I'm dumping out the contents
 of $this-params['form'] and it always shows

 Array
 (
 [Submit] = submit
 )

 Even if you press the cancel button.  Am I doing something wrong?

 Thanks!

 Nancy

 

   


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



  1   2   >