Need help converting this MySQL command into cakePHP find()

2009-05-05 Thread liaogz82

Hi all,

i need help to convert the following MySQL query to cakePHP find. I
have 2 tables: subscribers and subscriber_contacts. One subscriber has
many subscriber_contacts. The following is the MySQL query:

SELECT s.* FROM subscribers s, subscriber_contacts sc where s.id =
sc.subscriber_id and sc.contact_no like '03-20934662%';

So question here: how to convert the above MySQL command into a find()?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using Minify

2009-05-05 Thread Miles J

http://www.milesj.me/blog/read/32/cssjsasset-compression-in-cakephp
--~--~-~--~~~---~--~~
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: Help me respect MVC Paradigm please

2009-05-05 Thread Ernesto

I forgot to mention that, before saving any order, i need to check
that the order is not empty (has one item at least)

On 5 Mag, 17:22, brian  wrote:
> Maybe this would work.
>
> function beforeSave()
> {
>         if (isset($this->data['Items_Order']) && 
> !empty($this->data['Items_Order']))
>         {
>                 $this->data['Items'] = array();
>
>                 foreach($this->data['Items_Order'] as $order)
>                 {
>                         for($i = 0; $i < $order['quantity']; $i++)
>                         {
>                                 $this->data['Items'][] = array('Code' => 
> $order['Code']);
>                         }
>                 }
>                 unset($this->data['Items_Order']);
>         }
>         return true;
>
>
>
> }
> On Tue, May 5, 2009 at 10:47 AM, Ernesto  wrote:
>
> > Hello.
>
> > i'm working on 2 models:
>
> > Order --> hasMany --> Item
>
> > my view "orders/add" returns a data array like this
>
> > Array(
> >        [Order] => array(
> >                [Code] => XXX
> >                [Customer] => 5
> >        )
> >        [Items_Order] => array(
> >                [0] => array(
> >                        [Code] => Item1
> >                        [Quantity] => 3
> >                )
> >                [1] => array(
> >                        [Code] => Item2
> >                        [Quantity] => 2
> >                )
> >        )
> > )
>
> > Item.Quantity it's just a convenience field. It isn't stored in DB and
> > his only purpose is to shorten user inputs, allowing more than one
> > item-input per form line.
>
> > So... my goal is to obtain an array like this (starting from the
> > previous posted array)
>
> > Array(
> >        [Order] => array(
> >                [Code] => XXX
> >                [Customer] => 5
> >        )
> >        [Items] => array(
> >                [0] => array(
> >                        [Code] => Item1
> >                )
> >                [1] => array(
> >                        [Code] => Item1
> >                )
> >                [2] => array(
> >                        [Code] => Item1
> >                )
> >                [3] => array(
> >                        [Code] => Item2
> >                )
> >                [4] => array(
> >                        [Code] => Item2
> >                )
> >        )
> > )
>
> > and save it using Order->saveAll.
>
> > but... i'm having some troubles...
>
> > how should i validate Item.Quantity??
>
> > Where's the best place to do that "array spread"??
>
> > Any help will be very appreciated
--~--~-~--~~~---~--~~
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: Help me respect MVC Paradigm please

2009-05-05 Thread Ernesto

i already did something similar, but it doesn't work as intended
because data in Item model remains the same as before spread

On 5 Mag, 17:22, brian  wrote:
> Maybe this would work.
>
> function beforeSave()
> {
>         if (isset($this->data['Items_Order']) && 
> !empty($this->data['Items_Order']))
>         {
>                 $this->data['Items'] = array();
>
>                 foreach($this->data['Items_Order'] as $order)
>                 {
>                         for($i = 0; $i < $order['quantity']; $i++)
>                         {
>                                 $this->data['Items'][] = array('Code' => 
> $order['Code']);
>                         }
>                 }
>                 unset($this->data['Items_Order']);
>         }
>         return true;
>
>
>
> }
> On Tue, May 5, 2009 at 10:47 AM, Ernesto  wrote:
>
> > Hello.
>
> > i'm working on 2 models:
>
> > Order --> hasMany --> Item
>
> > my view "orders/add" returns a data array like this
>
> > Array(
> >        [Order] => array(
> >                [Code] => XXX
> >                [Customer] => 5
> >        )
> >        [Items_Order] => array(
> >                [0] => array(
> >                        [Code] => Item1
> >                        [Quantity] => 3
> >                )
> >                [1] => array(
> >                        [Code] => Item2
> >                        [Quantity] => 2
> >                )
> >        )
> > )
>
> > Item.Quantity it's just a convenience field. It isn't stored in DB and
> > his only purpose is to shorten user inputs, allowing more than one
> > item-input per form line.
>
> > So... my goal is to obtain an array like this (starting from the
> > previous posted array)
>
> > Array(
> >        [Order] => array(
> >                [Code] => XXX
> >                [Customer] => 5
> >        )
> >        [Items] => array(
> >                [0] => array(
> >                        [Code] => Item1
> >                )
> >                [1] => array(
> >                        [Code] => Item1
> >                )
> >                [2] => array(
> >                        [Code] => Item1
> >                )
> >                [3] => array(
> >                        [Code] => Item2
> >                )
> >                [4] => array(
> >                        [Code] => Item2
> >                )
> >        )
> > )
>
> > and save it using Order->saveAll.
>
> > but... i'm having some troubles...
>
> > how should i validate Item.Quantity??
>
> > Where's the best place to do that "array spread"??
>
> > Any help will be very appreciated
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



About the db connection established by CakePHP

2009-05-05 Thread Aitch

Hi, i put some stress test on Cake-based prj this morning. I found
that, when the request num reaches a certain num, the db connection
just lost when the data pushed into db. I tried to catch the error,
but failed. I'm wondering wehtere there is anyone faced the same
problem with me ever before?

My Hardware spec:

   IBX x-4** series server
   16GB Ram
   Raid0 Conf

My Software env:

   CentOS 5.3
   PHP 5.1.6
   MySQL 5.0 [ with my-huge.cnf ]
   Cache Engine : APC
   CakePHP 1.2.8 stable

My Stress Machine:
Intel Centrino 2.0 GHz
Dell D630 ATG with 4GB
   JMeter with 10 threads loop 100

The Error rate is: 2.41%

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



problem after changing servers

2009-05-05 Thread CakeMan

Hi,

I had change my website to one server to another. my website is in
Cakephp1.1. It was working fine at the old server however when i shift
it to another new server the css and images are not loading. The path
for images was "img/imagename.jpg"  BUT it is not working however if i
change it to "app/webroot/img/imagename.jpg" then it starts showing
the images.

I have fully working website so i have to do change in all my pages to
do this change which i don't want to do.

Pls help

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: Fatal error: Call to undefined function __l()

2009-05-05 Thread John Andersen

Just browsed the source at CakePHP and the erroneous code is not
present there, but at line 422 it reads:

 'loginError' => __('Login failed. Invalid username or password.',
true),

So I suggest that you correct the Auth component yourself (you have an
old version of CakePHP) or upgrade to a newer version.
Enjoy,
   John

On May 6, 8:15 am, Braydenstyles  wrote:
> Hi Folks,
>
> to give you some insight this website was on a server before both live
> and local both with secured logins before you get to the website and
> i'm trying desperately to get it up again locally
>
> Running: Mac Book Pro Intel with leopard MAMP Pro
>
> Get this message not sure what it means:
>
> Fatal error: Call to undefined function __l() in /Users/braydenstyles/
> Sites/cake/app/controllers/components/auth.php on line 360
>
> here is line 360
>
>  'loginError' => __l('Login failed. Invalid username or password.'),
>
> here is the full code
>
>  /* SVN FILE: $Id: auth.php 7945 2008-12-19 02:16:01Z gwoo $ */

[snip a lot of code]
--~--~-~--~~~---~--~~
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: $time->timeAgoInWords() not displaying plural times

2009-05-05 Thread John Andersen

No, as I haven't a clue where to do it (as of now), but feel free to
do it :)
Enjoy,
   John

On May 5, 11:22 pm, Miles J  wrote:
> Thanks that worked, have you put in a support ticket for this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Fatal error: Call to undefined function __l()

2009-05-05 Thread Braydenstyles

Hi Folks,

to give you some insight this website was on a server before both live
and local both with secured logins before you get to the website and
i'm trying desperately to get it up again locally

Running: Mac Book Pro Intel with leopard MAMP Pro

Get this message not sure what it means:

Fatal error: Call to undefined function __l() in /Users/braydenstyles/
Sites/cake/app/controllers/components/auth.php on line 360

here is line 360

 'loginError' => __l('Login failed. Invalid username or password.'),


here is the full code

http://www.cakephp.org)
 * Copyright 2005-2008, Cake Software Foundation, Inc. (http://
www.cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
(http://www.cakefoundation.org)
 * @link  http://www.cakefoundation.org/projects/info/cakephp
CakePHP(tm) Project
 * @package   cake
 * @subpackagecake.cake.libs.controllers.components
 * @since CakePHP(tm) v 1.0.0.2363
 * @version   $Revision: 8120 $
 * @modifiedby$LastChangedBy: gwoo $
 * @lastmodified  $Date: 2009-03-19 13:25:10 -0700 (Thu, 19 Mar 2009)
$
 * @license   http://www.opensource.org/licenses/mit-license.php
The MIT License
 */

App::import(array('Router', 'Security'));
/**
 * Authentication control component class
 *
 * Binds access control with user authentication and session
management.
 *
 * @package cake
 * @subpackage  cake.cake.libs.controller.components
 */
class AuthComponent extends Object {
/**
 * Maintains current user login state.
 *
 * @var boolean
 * @access private
 */
var $_loggedIn = false;
/**
 * Other components utilized by AuthComponent
 *
 * @var array
 * @access public
 */
var $components = array('Session', 'RequestHandler');
/**
 * A reference to the object used for authentication
 *
 * @var object
 * @access public
 */
var $authenticate = null;
/**
 * The name of the component to use for Authorization or set this to
 * 'controller' will validate against Controller::isAuthorized()
 * 'actions' will validate Controller::action against an
AclComponent::check()
 * 'crud' will validate mapActions against an AclComponent::check()
 * array('model'=> 'name'); will validate mapActions against model
$name::isAuthorize(user, controller, mapAction)
 * 'object' will validate Controller::action against
object::isAuthorized(user, controller, action)
 *
 * @var mixed
 * @access public
 */
var $authorize = false;
/**
 * The name of an optional view element to render when an Ajax request
is made
 * with an invalid or expired session
 *
 * @var string
 * @access public
 */
var $ajaxLogin = null;
/**
 * The name of the model that represents users which will be
authenticated.  Defaults to 'User'.
 *
 * @var string
 * @access public
 */
var $userModel = 'User';
/**
 * Additional query conditions to use when looking up and
authenticating users,
 * i.e. array('User.is_active' => 1).
 *
 * @var array
 * @access public
 */
var $userScope = array();
/**
 * Allows you to specify non-default login name and password fields
used in
 * $userModel, i.e. array('username' => 'login_name', 'password' =>
'passwd').
 *
 * @var array
 * @access public
 */
var $fields = array('username' => 'username', 'password' =>
'password');
/**
 * The session key name where the record of the current user is
stored.  If
 * unspecified, it will be "Auth.{$userModel name}".
 *
 * @var string
 * @access public
 */
var $sessionKey = null;
/**
 * If using action-based access control, this defines how the paths to
action
 * ACO nodes is computed.  If, for example, all controller nodes are
nested
 * under an ACO node named 'Controllers', $actionPath should be set to
 * "Controllers/".
 *
 * @var string
 * @access public
 */
var $actionPath = null;
/**
 * A URL (defined as a string or array) to the controller action that
handles
 * logins.
 *
 * @var mixed
 * @access public
 */
var $loginAction = null;
/**
 * Normally, if a user is redirected to the $loginAction page, the
location they
 * were redirected from will be stored in the session so that they can
be
 * redirected back after a successful login.  If this session value is
not
 * set, the user will be redirected to the page specified in
$loginRedirect.
 *
 * @var mixed
 * @access public
 */
var $loginRedirect = null;
/**
 * The the default action to redirect to after the user is logged
out.  While AuthComponent does
 * not handle post-logout redirection, a redirect URL will be returned
from AuthComponent::logout().
 * Defaults to AuthComponent::$loginAction.
 *
 * @var mixed
 * @access public
 * @see AuthComponent::$loginAction
 * @see AuthComponent::logout()
 */
var $logoutRedirect = null;
/**
 * The name of model or model object, or any other object has an
isAuthorized method.
 *
 * @var string

Using Minify

2009-05-05 Thread Dave Maharaj :: WidePixels.com

I am attempting to add the minify code as per the Bakery
http://bakery.cakephp.org/articles/view/minify-helper-for-cakephp
 
Stuck here
Use $minify->js() and $minify->css() functions in the layout. Both functions
require an array of asset names without their extensions.
 
My layouts have 
 
meta('icon');
echo $html->css('styles');
echo $html->css('typography');
  echo $scripts_for_layout;
 ?> 
 
and the views:
 
link(array('prototype', 'scriptaculous','effects'),
false); ?>
 
How to use the $minify->js() and $minify->css() , where? 

Thanks,

Dave 


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



Re: paragraph breaks removed on form save

2009-05-05 Thread park

That's exactly what I'm looking for!

Many thanks Brian!

brian wrote:
> Do you mean *line breaks*? Those are generally ignored by browsers. If
> you want the line breaks to be "preserved" (they're still there, just
> mostly useless in a browser) when displaying the content, you'll need
> to run it through nl2br(). Either that, or use a WYSIWYG widget to
> create proper paragraphs.
>
> http://www.php.net/manual/en/function.nl2br.php
>
> On Tue, May 5, 2009 at 10:05 PM, park  wrote:
> >
> > Hi,
> >
> > It seems that cake automatically removes paragraphs breaks from
> > textareas on form submission.
> >
> > So anything user inputs will end up one long paragraph.
> >
> > Is there a way to preserve the paragraph breaks?
> >
> > Thank you!
> > >
> >
--~--~-~--~~~---~--~~
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: paragraph breaks removed on form save

2009-05-05 Thread brian

Do you mean *line breaks*? Those are generally ignored by browsers. If
you want the line breaks to be "preserved" (they're still there, just
mostly useless in a browser) when displaying the content, you'll need
to run it through nl2br(). Either that, or use a WYSIWYG widget to
create proper paragraphs.

http://www.php.net/manual/en/function.nl2br.php

On Tue, May 5, 2009 at 10:05 PM, park  wrote:
>
> Hi,
>
> It seems that cake automatically removes paragraphs breaks from
> textareas on form submission.
>
> So anything user inputs will end up one long paragraph.
>
> Is there a way to preserve the paragraph breaks?
>
> Thank you!
> >
>

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



paragraph breaks removed on form save

2009-05-05 Thread park

Hi,

It seems that cake automatically removes paragraphs breaks from
textareas on form submission.

So anything user inputs will end up one long paragraph.

Is there a way to preserve the paragraph breaks?

Thank you!
--~--~-~--~~~---~--~~
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: $this->render causes openbase_dir restriction error ??

2009-05-05 Thread brian

Better to just set the $viewPath:

$this->viewPath = 'sections';
$this->render('view');

The above assumes there is a file at:

app/views/sections/view.ctp

Note that viewPath is relative from app/views. To render an element
view, for example, one can do:

$this->viewPath = 'elements/some_other_dir';
$this->render('some_element');

On Tue, May 5, 2009 at 9:53 PM, Dr. Loboto  wrote:
>
> Path '/sections/view' is absolute from filesystem root. If you want to
> render view from other controller, you should pass '../sections/view' -
>> a dir up, controller name (folder actually) and then view name.
>
> On May 5, 4:55 pm, Flipflops  wrote:
>> Hi
>>
>> I've got an action that based on on the parameters passed to it either
>> renders its default view or one of a number of alternate views based
>> on the values in $this->params['pass'];
>>
>> This is stripped back version of the action, $this->render('/sections/
>> view'); seeme to be what is causing the problem, but it is still
>> rendering the correct view file despite the errors.
>>
>> function view() {
>>                 $this->Node->recursive = -1;
>>                 $this->pass_count = count($this->params['pass']);
>>                 $this->pass_position = $this->pass_count - 1;
>>
>>                 $data = $this->view_sub();
>>                 $this->data = $data;
>>
>>                 if(!empty($data['Node']['model_placeholder'])){
>>
>>                         $section = ClassRegistry::init('Section');
>>                         $section_data = 
>> $section->view_section($this->params['pass'], $this-
>>
>> >pass_count, $this->pass_position);
>>
>>                         if(count($section_data) == 2){
>>                                 $this->data['Section'] = 
>> $section_data[0]['Section'];
>>                                 $this->set('subsections', $section_data[1]);
>>                                 $this->render('/sections/view');
>>                         }
>>                 } else {
>>                         // do nothing this will render the default view
>>                 }
>>         }
>>
>> The error I'm getting is:
>>
>> is_file() [function.is-file]: open_basedir restriction in effect. File
>> (/sections/view) is not within the allowed path(s): (/var/www/vhosts/
>> somedomain.com/subdomains/coastal/httpdocs:/tmp) [CORE/cake/libs/view/
>> view.php, line 792]
>>
>> Looking on Google about similar sounding errors I've tried to force
>> the path to views into bootstrap.php setting: $viewPaths = array(APP .
>> 'app' . DS . 'views' . DS );
>>
>> I'm sure its something obvious and I'm just being thick, any help
>> greatly appreciated (I'm using 1.2.1.8004)
>>
>> Cheers
> >
>

--~--~-~--~~~---~--~~
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: Same queries in different controllers

2009-05-05 Thread brian

You can create a method in each model and place the find details
there. Then, from the controllers:

$foo = $this->YourModel->yourMethod(...)

"Fat models, thin controllers", as the saying goes.

On Tue, May 5, 2009 at 7:42 PM, Nancy  wrote:
>
> I have a bunch of tables that are highly inter-related and I have them
> all being displayed, like an initial index view, from one controller.
> They're getting updated and the index of each table is refreshed via
> that table's controller (Ajax).   The bad part about this is that I
> have to keep the queries updated in two places, my main overview
> controller and then in each tables controller.  Is there a way to
> share a query code between controllers?
>
> 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: $this->render causes openbase_dir restriction error ??

2009-05-05 Thread Dr. Loboto

Path '/sections/view' is absolute from filesystem root. If you want to
render view from other controller, you should pass '../sections/view' -
> a dir up, controller name (folder actually) and then view name.

On May 5, 4:55 pm, Flipflops  wrote:
> Hi
>
> I've got an action that based on on the parameters passed to it either
> renders its default view or one of a number of alternate views based
> on the values in $this->params['pass'];
>
> This is stripped back version of the action, $this->render('/sections/
> view'); seeme to be what is causing the problem, but it is still
> rendering the correct view file despite the errors.
>
> function view() {
>                 $this->Node->recursive = -1;
>                 $this->pass_count = count($this->params['pass']);
>                 $this->pass_position = $this->pass_count - 1;
>
>                 $data = $this->view_sub();
>                 $this->data = $data;
>
>                 if(!empty($data['Node']['model_placeholder'])){
>
>                         $section = ClassRegistry::init('Section');
>                         $section_data = 
> $section->view_section($this->params['pass'], $this-
>
> >pass_count, $this->pass_position);
>
>                         if(count($section_data) == 2){
>                                 $this->data['Section'] = 
> $section_data[0]['Section'];
>                                 $this->set('subsections', $section_data[1]);
>                                 $this->render('/sections/view');
>                         }
>                 } else {
>                         // do nothing this will render the default view
>                 }
>         }
>
> The error I'm getting is:
>
> is_file() [function.is-file]: open_basedir restriction in effect. File
> (/sections/view) is not within the allowed path(s): (/var/www/vhosts/
> somedomain.com/subdomains/coastal/httpdocs:/tmp) [CORE/cake/libs/view/
> view.php, line 792]
>
> Looking on Google about similar sounding errors I've tried to force
> the path to views into bootstrap.php setting: $viewPaths = array(APP .
> 'app' . DS . 'views' . DS );
>
> I'm sure its something obvious and I'm just being thick, any help
> greatly appreciated (I'm using 1.2.1.8004)
>
> Cheers
--~--~-~--~~~---~--~~
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: Advice on working with dates

2009-05-05 Thread Miles J

This would be done in your controller, or your model.

// View
$form->input('userDate'); (example: 2/26/88)

// Controller
$this->data['Model']['date'] = date('Y-m-d', strtotime($this->data
['Model']['userDate']));
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Advice on working with dates

2009-05-05 Thread adam

I have a year or so experience with PHP and MySQL, but have never had
the pleasure of dealing with dates.  I need to be able to store a date
that a user inputs.  I want to use the date data type for MySQL, but I
am using a jQuery plugin for the form input, so I am getting a string.

Any advice on how I can convert the date from a string and back to a
string for displaying output?

Would the time helper be of use in this situation?

I've Google'd, but haven't found any resources (other than the api and
the manual) regarding the TimeHelper.  Any help would be appreciated.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Same queries in different controllers

2009-05-05 Thread Nancy

I have a bunch of tables that are highly inter-related and I have them
all being displayed, like an initial index view, from one controller.
They're getting updated and the index of each table is refreshed via
that table's controller (Ajax).   The bad part about this is that I
have to keep the queries updated in two places, my main overview
controller and then in each tables controller.  Is there a way to
share a query code between controllers?

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: Form validation for fields not in a model

2009-05-05 Thread Miles J

Just place it in the same validation as the user signup code, theres
no point in doing it somewhere else.

This is to check if a checkbox is checked, lol.

'agree' => array(
'rule' => array('comparison', '!=', 0),
'message' => 'Please check the box',
'on' => 'create'
),
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form validation for fields not in a model

2009-05-05 Thread Rangi

Hello,

I have a "sign up" form which asks the user for a username, password,
email, etc - all bits of data that will go into my model. The data
validation happens automatically based on rules defined in the model,
and error messages are automatically displayed if the user enters
invalid data it all just works like magic, it's great!

However I also have a checkbox labelled "I have read and accept the
Terms and Conditions". This bit of data is not going into the model,
so I'm not sure how to:

1. do the data validation on this field and
2. display an error message if the checkbox isn't ticked

I know how to solve this "manually" - I'd do the validation in the
controller and set a view variable like "$this->set("checked_terms",
false);", then in the view I'd look out for this variable and display
an error message.

But I'm sure there's a more elegant way of doing this I just can't
seem to find it (I've read the manual, googled and searched on this
forum).

Any ideas on how best to approach this type of problem much
appreciated!

Cheers,
Rangi
--~--~-~--~~~---~--~~
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: $time->timeAgoInWords() not displaying plural times

2009-05-05 Thread Miles J

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



Re: Telling PHP to put "&" NOT "&"

2009-05-05 Thread rartavia

I tested the JS escape Method, in JavaScript it works correctly and no
errors, but when I read $this->data in my controller fields that where
'escaped' appeared empty.
I did some research: escape Method kind of fails with non-ASCII
characters, however there are two alternatives encodeURIComponent and
encodeURI, both JavaScript native too.

In my case, seems to be working fine with encodeURIComponent.

Here is some reference:
http://www.w3.org/TR/uri-clarification/
http://xkr.us/articles/javascript/encode-compare/

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



Re: Telling PHP to put "&" NOT "&"

2009-05-05 Thread rartavia

Hi, thanks again.

I'm was not url-encoding my stuff. I dont know about jQuery having
urlEncode, it does have a serialize method but what it does is not
quite that, however, JavaScript it self has the escape/unescape
function that does that.

escape("This is my text & test") will return "This%20is%20my%20text
%20%26%20test"
unescape("This%20is%20my%20text%20%26%20test") will return "This is my
text & test"

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



Generate dynamic PDFs from Cake apps

2009-05-05 Thread Kevin Kaiser

Forgive me for the shameless promotion but I'm posting because I think
you guys might find this useful.

I'd like to spread the word to the PHP community about a new website
that we've launched called Online PDF Printer
(www.onlinepdfprinter.com).

It's a service that lets developers integrate dynamic PDF creation and
downloading into their web-enabled applications with just a few lines
of code.

All you have to do is sign up for an API key, upload your document
templates and POST data to our server. We handle everything else. A
stream of PDF data is passed back to your application and you can save
it as a file, prompt the user to download it right then and there or
push it into a database.

We'd love to have anybody and everybody come check out the site, sign
up for a free account and mess around with it.

Thanks!

-Kevin Kaiser
 SiteQuarters / Online PDF Printer

 kkai...@sitequarters.com
 supp...@onlinepdfprinter.com

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



find with group and two tables

2009-05-05 Thread Roman Brunnemann

Hi,

first of all I am a newbie so this might be a very easy question. But 
not for me ;-)

How can I retrieve data with the find method while grouping and 
retrieving the maximum value of a second table? The beginning of the 
Controller class:

class InvoicesController extends AppController {

var $name = 'Invoices';
var $helpers = array('Html', 'Form');
var $uses = array('Installation');

function index() {
$fields = array('Installation.name', 'MAX(Invoice.period_end)' );
$group = array('Installation.id');
   

   
$installations = $this->Installation->find('all', array (

'fields' => $fields,

'group' => $group ));
$this->set('installations', $installations );
}

When I call this I got the error message:

*SQL Error:* 1054: Unknown column 'Invoice.period_end' in 'field list' 
[*CORE/cake/libs/model/datasources/dbo_source.php*, line *525*]

Code  | Context 

$sql=   "SELECT `Installation`.`name`, MAX(`Invoice`.`period_end`), 
`Installation`.`id` FROM `tom_installations` AS `Installation`   WHERE 
`Installation`.`active` = 1  GROUP BY `Installation`.`id`  "
$error  =   "1054: Unknown column 'Invoice.period_end' in 'field list'"
$out=   null

|$out = null;|
|if ($error) {|
|trigger_error("SQL Error: {$this->error}", 
E_USER_WARNING);|

DboSource::showQuery() - CORE/cake/libs/model/datasources/dbo_source.php, line 
525
DboSource::execute() - CORE/cake/libs/model/datasources/dbo_source.php, line 201
DboSource::fetchAll() - CORE/cake/libs/model/datasources/dbo_source.php, line 
337
DboSource::read() - CORE/cake/libs/model/datasources/dbo_source.php, line 647
Model::find() - CORE/cake/libs/model/model.php, line 1961
InvoicesController::index() - APP/controllers/invoices_controller.php, line 22
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 227
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 194
[main] - APP/webroot/index.php, line 88

*Query:* SELECT `Installation`.`name`, MAX(`Invoice`.`period_end`), 
`Installation`.`id` FROM `installations` AS `Installation` WHERE 
`Installation`.`active` = 1 GROUP BY `Installation`.`id`

So cake does not include the Invoice table in the sql query.

So how can I do this?

Thanks a lot in advance.

Best regards,
Roman

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



Web statistics with CAKEPHP

2009-05-05 Thread marco.rizze...@gmail.com

Hi
I have a web application with CakePHP
I would have some statistics about the use of web application.
It is not enough use the log file of the web server because I would
store the id of the logged user.
I would ask if exist an existing system in CakePHP to do it?
Many 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: big big big problem!!!!

2009-05-05 Thread James K

The built-in Auth component does all this. I would seriously consider
having a look there.

http://book.cakephp.org/view/172/Authentication

Also how do you have IIS configured? Are you using fastcgi or isapi?

- James

On May 4, 10:42 pm, henry  wrote:
> Hi everybody,
>
> Please give me help !!!  I made a CMS with cakephp, it 's work fine in
> IE6,IE7, Firefox and Opera, but doesn't work in Safari and Chrome.
>
> Steps:
>
> 1. display the login page, enter username and password. click log in.
> 2. display index page if username and password is right. In index
> page, save username and usertype into session.
> 3. check whether session(username) is empty when redirect any other
> page.
>
> Problem: i found the safari or chrome always create new session when
> redirect to other pages. So lost usename and usertype info in new
> session. Result is can't log in and always display the login page.
>
> Current Cakephp config:
>
> cake version:1.2.2.8120
> Web Server : IIS
> Database : mysql
>
> Core.php config:
> Configure::write('App.baseUrl', env('SCRIPT_NAME'). '?url=');
> Configure::write('Cache.check', true);
> Configure::write('Session.save', 'cake');
> Configure::write('Session.cookie', 'PHPSESSID');
> Configure::write('Session.timeout', '10');
> Configure::write('Session.start', true);
> Configure::write('Session.checkAgent', false);
> Configure::write('Security.level', 'low');
> Cache::config('default', array('engine' => 'File'));
>
> Please give me any idea to fix it. Thanks a lot in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread qwanta

Both 'selected'=> & 'default'=> seem to do the trick. Thanks!

On May 5, 6:44 am, andy  wrote:
> Seehttp://book.cakephp.org/view/199/options-selected. In the view,
> you will need to do something like this:
>
> $form->input('fieldname', array('options' => array($listvalue),
> 'selected' => 'desiredselectvalue') );
>
> On May 4, 3:56 pm, qwanta  wrote:
>
> > In the controller I do a find('list') to get an array ready for
> > populating a select box. I am quite stumped as to how I would set the
> > selected index of the select box in the view.
> > This is a case where the automagic situation (editing a record) is not
> > applicable - it is a log entry form and a new record each time.
>
> > 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: Setting pagination url problem - something to do with Routes ??

2009-05-05 Thread brian

It's also quite possible I'm wrong ;-)

On Tue, May 5, 2009 at 11:29 AM, Flipflops  wrote:
>
> Hi Brian
>
> Thanks, I'll give that a shot, it has been working fine until I came
> across this instance - but that line of code in routes has been
> carried around for a while so I've probably been relying on something
> that has been depreciated or where the API has changed... or maybe it
> should just never have worked !
>
> Cheers
>
> On May 5, 4:13 pm, brian  wrote:
>> You have the regexp in the wrong place. Try something like this:
>>
>> Router::connect(
>>         '/:whatever/*'
>>         array(
>>                 'controller' => 'nodes',
>>                 'action' => 'view'
>>         ),
>>         array(
>>                 'whatever' => '(?!admin|pages|users|photos)'
>>         )
>> );
>>
>> Untested, of course.
>>
>> On Tue, May 5, 2009 at 10:04 AM, Flipflops  wrote:
>>
>> > Hi
>>
>> > I'm trying to paginate a set of results but Cake isn't building the
>> > links properly, instead of the correct link the pagination helper is
>> > generating links that just output part of my routes config.
>>
>> > The pagination is working fine in some parts of my application so
>> > something like this is working fine where 'photos' is an actual
>> > controller and 'project_gallery' a method e.g. /photos/project_gallery/
>> > 16/page:1#album-image-gallery
>>
>> > But I want the following to be routed to my 'nodes' controller /
>> > seascapes/summer-seascapes - instead of generating /seascapes/summer-
>> > seascapes/page:2  the generated url is:
>>
>> > /(?!admin|pages|users|photos)(./summer/summer-seascapes/page:1)
>> > This line is  just spitting out a line from my routes.php file where
>> > there is a line that basically just catches urls and send them to the
>> > view action of my nodes controller:
>>
>> > Router::connect('(?!admin|pages|users|photos)(.*)', array('controller'
>> > => 'nodes', 'action' => 'view'));
>>
>> > In my view I am using $paginator->options(array('url' => $this-
>> >>passedArgs)); to try and set the url but that isn't working - I want
>> > to set the url myself and not have cake try and figure out what it is,
>> > which I guess is what isn't working - what I am doing wrong ?
>>
>> > Cheers
>>
>> > (I'm using 1.2.3.8166)
>>
>>
> >
>

--~--~-~--~~~---~--~~
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: quick tip: html helper - verbose linking + named anchor

2009-05-05 Thread brian

Moshin, that will work but will ignore any routes you might have. If
you use the array syntax for creating links, Cake will look at your
routes and create it from one of those, if there's a match. This can
be really handy.

On Mon, May 4, 2009 at 10:33 PM, Mohsin Kabir  wrote:
> I think it will be a solution
>
> $html->link('View More Photos','/listing/view/id#anchor');
>
> Thanks,
> Mohsin
>
> On Tue, May 5, 2009 at 7:44 AM, brian  wrote:
>>
>> You can also pass '#' as an extra param:
>>
>> $html->link(
>>        'View More Photos',
>>        array(
>>                'controller'=>'listings',
>>                'action'=>'view',
>>                $id
>>                '#' => 'anchor'
>>        )
>> );
>>
>> On Mon, May 4, 2009 at 5:55 PM, JamesF  wrote:
>> >
>> > hey there i'm a big fan of verbose linking but i was having a problem
>> > linking to a named anchor in the target page
>> > figured it out before i posted my question so figured i would share.
>> >
>> >
>> > code sans named anchor link:
>> > echo $html->link('View More Photos', array('controller'=>'listings',
>> > 'action'=>'view', $id);
>> >
>> > outputs : http://mysite.com/controller/action/id
>> >
>> > try this to link to the anchor:
>> >
>> > echo $html->link('View More Photos', array('controller'=>'listings',
>> > 'action'=>'view', $id . '#anchor');
>> >
>> > output: http://mysite.com/controller/action/id#anchor
>> >
>> > >
>> >
>>
>>
>
>
>
> --
> >
>

--~--~-~--~~~---~--~~
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: Setting pagination url problem - something to do with Routes ??

2009-05-05 Thread Flipflops

Hi Brian

Thanks, I'll give that a shot, it has been working fine until I came
across this instance - but that line of code in routes has been
carried around for a while so I've probably been relying on something
that has been depreciated or where the API has changed... or maybe it
should just never have worked !

Cheers

On May 5, 4:13 pm, brian  wrote:
> You have the regexp in the wrong place. Try something like this:
>
> Router::connect(
>         '/:whatever/*'
>         array(
>                 'controller' => 'nodes',
>                 'action' => 'view'
>         ),
>         array(
>                 'whatever' => '(?!admin|pages|users|photos)'
>         )
> );
>
> Untested, of course.
>
> On Tue, May 5, 2009 at 10:04 AM, Flipflops  wrote:
>
> > Hi
>
> > I'm trying to paginate a set of results but Cake isn't building the
> > links properly, instead of the correct link the pagination helper is
> > generating links that just output part of my routes config.
>
> > The pagination is working fine in some parts of my application so
> > something like this is working fine where 'photos' is an actual
> > controller and 'project_gallery' a method e.g. /photos/project_gallery/
> > 16/page:1#album-image-gallery
>
> > But I want the following to be routed to my 'nodes' controller /
> > seascapes/summer-seascapes - instead of generating /seascapes/summer-
> > seascapes/page:2  the generated url is:
>
> > /(?!admin|pages|users|photos)(./summer/summer-seascapes/page:1)
> > This line is  just spitting out a line from my routes.php file where
> > there is a line that basically just catches urls and send them to the
> > view action of my nodes controller:
>
> > Router::connect('(?!admin|pages|users|photos)(.*)', array('controller'
> > => 'nodes', 'action' => 'view'));
>
> > In my view I am using $paginator->options(array('url' => $this-
> >>passedArgs)); to try and set the url but that isn't working - I want
> > to set the url myself and not have cake try and figure out what it is,
> > which I guess is what isn't working - what I am doing wrong ?
>
> > Cheers
>
> > (I'm using 1.2.3.8166)
>
>
--~--~-~--~~~---~--~~
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: 404 Not Found

2009-05-05 Thread brian

Look in /app/tmp/logs. There should be both error and debug logs. Make
sure the webserver owns the tmp dir and all files within.

Unless it's a fatal error, Cake will generate a 404 if debug is set to
0. This is to keep error messages from being displayed publicly. If
it's fatal, you'll generally see the White Screen of Death (WSoD).

On Mon, May 4, 2009 at 11:38 PM, japaniel  wrote:
>
> Where does cake log the errors? I've kinda poked around for them but
> in anything that seemed like where logs would be kept there were files
> that were named empty and as you could imagine, were empty.
>
> While I would like to know what type of errors are being thrown, as it
> should help me trouble shoot the problem; the code should be good
> seeing as how I copied it from the plain text view given in the cook
> book.
>
> But in an attempt to swallow pride, namely mine, I will go through and
> replace the posts controller, model, and views to be in line with the
> code given in an attempt to correct this problem.
>
> On May 4, 6:22 am, DuncanBrown  wrote:
>> It sounds like it is an error in your code.
>>
>> If you set Configure::write('debug', 2); in config/core.php to1 or 2
>> cake will give you the error that is causing the problem.
>>
>> On May 4, 6:06 am, japaniel  wrote:
>>
>> > I have been reading through the posts here and there were some older
>> > posts that didn't seem to help me.
>>
>> > I am getting a 404 Not Found error when going to the myserver.local/
>> > posts/index in the blog tutorial.
>>
>> > I have a mac running leopard, but that shouldn't matter seeing as how
>> > i have all the needed things (apache, mysql, etc.) installed and are
>> > running fine.
>>
>> > when i go to myserver.local (which is a virtual host pointing to the
>> > cake/app/webroot dir i have the default cake page there with
>> > stylesheets and all.
>>
>> > but after going so far in the tutorial as to get to section 10.1.8
>> > Creating Post Views and it says
>>
>> > "At this point, you should be able to point your browser 
>> > tohttp://www.example.com/posts/index. You should see your view,
>> > correctly formatted with the title and table listing of the posts."
>>
>> > That is where i get the error.
>>
>> > I assumed that it was my apache config going all screwy. And, I
>> > suppose it still very well could.
>>
>> > The kicker is that the tab with my cake_blog/tutorial still has the
>> > cakephp favicon there not the apache feather.
>>
>> > here are a few sections of my httpd.conf file to show that it should
>> > be working
>>
>> > LoadModule alias_module libexec/apache2/mod_alias.so
>> > LoadModule rewrite_module libexec/apache2/mod_rewrite.so
>> > LoadModule bonjour_module     libexec/apache2/mod_bonjour.so
>> > LoadModule php5_module        libexec/apache2/libphp5.so
>>
>> > 
>> >     Options FollowSymLinks
>> >     AllowOverride All
>> >     Order allow,deny
>> >     Allow from all
>> > 
>>
>> > I am aware of the security risk of this last part but i was trying to
>> > see if this would fix it.
>>
>> > I am using virtual hosts and am not sure if that has anything to do
>> > with the setting of AllowOverride and am having troubles locating that
>> > anywhere on the "interwebs".
>>
>> > P.S. I do restart apache after each change to the httpd.conf file and
>> > then check to see if it is working.
> >
>

--~--~-~--~~~---~--~~
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: Help me respect MVC Paradigm please

2009-05-05 Thread brian
Maybe this would work.

function beforeSave()
{
if (isset($this->data['Items_Order']) && 
!empty($this->data['Items_Order']))
{
$this->data['Items'] = array();

foreach($this->data['Items_Order'] as $order)
{
for($i = 0; $i < $order['quantity']; $i++)
{
$this->data['Items'][] = array('Code' => 
$order['Code']);
}
}
unset($this->data['Items_Order']);
}
return true;
}

On Tue, May 5, 2009 at 10:47 AM, Ernesto  wrote:
>
> Hello.
>
> i'm working on 2 models:
>
> Order --> hasMany --> Item
>
> my view "orders/add" returns a data array like this
>
> Array(
>        [Order] => array(
>                [Code] => XXX
>                [Customer] => 5
>        )
>        [Items_Order] => array(
>                [0] => array(
>                        [Code] => Item1
>                        [Quantity] => 3
>                )
>                [1] => array(
>                        [Code] => Item2
>                        [Quantity] => 2
>                )
>        )
> )
>
> Item.Quantity it's just a convenience field. It isn't stored in DB and
> his only purpose is to shorten user inputs, allowing more than one
> item-input per form line.
>
> So... my goal is to obtain an array like this (starting from the
> previous posted array)
>
> Array(
>        [Order] => array(
>                [Code] => XXX
>                [Customer] => 5
>        )
>        [Items] => array(
>                [0] => array(
>                        [Code] => Item1
>                )
>                [1] => array(
>                        [Code] => Item1
>                )
>                [2] => array(
>                        [Code] => Item1
>                )
>                [3] => array(
>                        [Code] => Item2
>                )
>                [4] => array(
>                        [Code] => Item2
>                )
>        )
> )
>
> and save it using Order->saveAll.
>
> but... i'm having some troubles...
>
> how should i validate Item.Quantity??
>
> Where's the best place to do that "array spread"??
>
> Any help will be very appreciated
> >
>

--~--~-~--~~~---~--~~
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: Setting pagination url problem - something to do with Routes ??

2009-05-05 Thread brian

You have the regexp in the wrong place. Try something like this:

Router::connect(
'/:whatever/*'
array(
'controller' => 'nodes',
'action' => 'view'
),
array(
'whatever' => '(?!admin|pages|users|photos)'
)
);

Untested, of course.

On Tue, May 5, 2009 at 10:04 AM, Flipflops  wrote:
>
> Hi
>
> I'm trying to paginate a set of results but Cake isn't building the
> links properly, instead of the correct link the pagination helper is
> generating links that just output part of my routes config.
>
> The pagination is working fine in some parts of my application so
> something like this is working fine where 'photos' is an actual
> controller and 'project_gallery' a method e.g. /photos/project_gallery/
> 16/page:1#album-image-gallery
>
> But I want the following to be routed to my 'nodes' controller /
> seascapes/summer-seascapes - instead of generating /seascapes/summer-
> seascapes/page:2  the generated url is:
>
> /(?!admin|pages|users|photos)(./summer/summer-seascapes/page:1)
> This line is  just spitting out a line from my routes.php file where
> there is a line that basically just catches urls and send them to the
> view action of my nodes controller:
>
> Router::connect('(?!admin|pages|users|photos)(.*)', array('controller'
> => 'nodes', 'action' => 'view'));
>
> In my view I am using $paginator->options(array('url' => $this-
>>passedArgs)); to try and set the url but that isn't working - I want
> to set the url myself and not have cake try and figure out what it is,
> which I guess is what isn't working - what I am doing wrong ?
>
> Cheers
>
> (I'm using 1.2.3.8166)
> >
>

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



Assigning Users to two fields

2009-05-05 Thread damanlovett

Let's see if I can explain this.

I have a table that users can request time-off. The table needs to
record the user that is filling out the form as well as the person who
is covering.  The problem I can't figure out ( cause I'm a n00b ) is
how to use the user table for the requester and the person covering.
I want the table to be able to pull information from the user table.

Tables:
timeoff - collects time off information
users - members

foreign keys
users_id - The person filling out the form
others_id - The person who is covering for them
--~--~-~--~~~---~--~~
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: Removing an item from a set using Set::Remove.

2009-05-05 Thread brian

Understood. Perhaps you could loop through the data and, where you
have an event already registered, copy it into a new array, then
remove it from the original.

$registered_events = array();

foreach($events as $k => $event)
{
if (...)
{
$registered_events[] = $event;
unset($events[$k];
}
}

On Tue, May 5, 2009 at 12:17 AM, Krist van Besien
 wrote:
>
> On Sat, May 2, 2009 at 5:47 PM, brian  wrote:
>> For your purposes, why don't you simply use the conditions to keep
>> certain rows from being selected at all? Either that, or re-think how
>> you're storing this data. Why do you need to remove this or other
>> rows? Perhaps there's a more elegant solution.
>
> It looks like I'll have to do it this way then.
>
> What I'm trying to do is build a event registration form, where a user
> sees the events he has registered on the top, and below that the
> events he could register. Ofcourse, in the part of the form that shows
> the events a user could register I don't want to show the events he
> has already registered.
>
> Krist
>
>
>
> --
> krist.vanbes...@gmail.com
> kr...@vanbesien.org
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email discussions?
>
> >
>

--~--~-~--~~~---~--~~
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: Memory Limit Exhausted

2009-05-05 Thread Flipflops

As the other posters have said your query is probably trying to pull
too much data back, why don't you raise the memory limit in cake until
you don't get a fatal error, then you can see what queries cake has
been trying to run.

Chances are that Cake is trying to pull in data from lots of
associations so you can get around this by using something like $this->
{$modelClass}->recursive = -1; or unbinding unnecessary models.

Assuming your server config will let you change the allowed memory,
you can do it within Cake by adding something like:
 define ('MAX_MEMORY_LIMIT', '64M'); in app/config/core.php

John

On Apr 30, 6:38 pm, "Benedikt R."  wrote:
> Hey!
>
> I am currently building an app that should be able to parse some
> tables with bank codes. The database table contains about 25,000
> entries.
>
> When I try to request some data ($this->ControllerObj->find
> (conditions)) the server shouts out:
> Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to
> allocate 37 bytes) in /usr/www/users/blzbak/cake/libs/model/
> datasources/dbo/dbo_mysql.php on line 643
>
> Cake doesn't throw an error, when I set ANY LIMIT (either 0 or
> 1000).
>
> Someone knows, what all this is about?
>
> Thank you,
> Benedikt
--~--~-~--~~~---~--~~
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: index view values showing as id value and not string value

2009-05-05 Thread brian

I'll guess that you're referring to the foreign key(s) in your model.
If you want the "name" or whaever from the associated model you'll
either have to ensure it's fetched (recursive, contain, etc.) and look
in $this->data['AssocModel'][...].

On Tue, May 5, 2009 at 1:13 AM, programguru  wrote:
>
>
> does anyone know why the values being pulled into my index view are id values
> as opposed to the literal string value of the field?
> --
> View this message in context: 
> http://www.nabble.com/index-view-values-showing-as-id-value-and-not-string-value-tp23381141p23381141.html
> Sent from the CakePHP mailing list archive at Nabble.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: big big big problem!!!!

2009-05-05 Thread brian

On Mon, May 4, 2009 at 10:42 PM, henry  wrote:
>
> 2. display index page if username and password is right. In index
> page, save username and usertype into session.
> 3. check whether session(username) is empty when redirect any other
> page.

Can you post some code for these 2 steps? Are you writing the session
values in the controller or the view? How are you checking the
session?

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



Help me respect MVC Paradigm please

2009-05-05 Thread Ernesto

Hello.

i'm working on 2 models:

Order --> hasMany --> Item

my view "orders/add" returns a data array like this

Array(
[Order] => array(
[Code] => XXX
[Customer] => 5
)
[Items_Order] => array(
[0] => array(
[Code] => Item1
[Quantity] => 3
)
[1] => array(
[Code] => Item2
[Quantity] => 2
)
)
)

Item.Quantity it's just a convenience field. It isn't stored in DB and
his only purpose is to shorten user inputs, allowing more than one
item-input per form line.

So... my goal is to obtain an array like this (starting from the
previous posted array)

Array(
[Order] => array(
[Code] => XXX
[Customer] => 5
)
[Items] => array(
[0] => array(
[Code] => Item1
)
[1] => array(
[Code] => Item1
)
[2] => array(
[Code] => Item1
)
[3] => array(
[Code] => Item2
)
[4] => array(
[Code] => Item2
)
)
)

and save it using Order->saveAll.

but... i'm having some troubles...

how should i validate Item.Quantity??

Where's the best place to do that "array spread"??

Any help will be very appreciated
--~--~-~--~~~---~--~~
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 Meetup - Uptown Dallas, TX - June 15th

2009-05-05 Thread britg

Come by the Uptown Dallas co-working house, Cohabitat, to meet with
other CakePHP developers. Talk about your projects and hear what
others are doing with CakePHP. Share plugins, components, best
practices etc.

Pizza and libations will be provided!

More about Cohabitat (http://cohabitat.us)
CoHabitat is a coworking space for developers, creatives and
entrepreneurs in the Dallas area. Located in the historic State-Thomas
area, we’re just a stone’s throw from downtown and within walking
distance of some of the best food, pubs, and cafés in the city.

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



jquery & validation for password

2009-05-05 Thread ZedR

Please check this link first:

 
http://teknoid.wordpress.com/2009/01/21/jquery-in-the-cakephp-world-part-2-is-client-side-code-all-that-great/

I am following the above link for ajax on blur event validation. But
the comparison validation of password & confirm password does not work
properly. Using compareTo rule also does not work. Have tried many
custom validation functions for comparison, but they dont work. Please
help. 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: hasOne relationship problem

2009-05-05 Thread Robin

Thanks Paulos for your advice. I could certainly add some manual
checking before adding a child record. The question I am having in my
mind is that should duplicate check be done by the hasOne relationship
or is it possible. Am I missing anything here?

Robin

On May 5, 2:27 am, paulos nikolo  wrote:
> Hi Robin.I am not an expert coz i am trying to build a similar app of yours
> so i ll tell you my opinion.As i saw your tables format i think you should
> set depentent=true in user model and the exslusive field in profile model
> true.The 1st one will delete the associated profile if the user has been
> deleted and the 2nd (i think) is what u search for.Alternatively , you can
> set the add profile link to invisible when a user has already a profile so
> that the rest CRUD functions can be shown.
>
> 2009/5/4 Robin 
>
>
>
> > Hello, i'm new both to php and cake, so please excuse me if this is
> > another obvious noob question.
>
> > I was trying to understand how associations work by building up the
> > example in the manual section of cakephp.org, i was able to build it
> > up using bake with no much effort.
>
> > The thing is, i have a users table and a profiles table, they look
> > like this:
>
> > CREATE TABLE `profiles` (
> >  `id` int(11) NOT NULL auto_increment,
> >  `name` varchar(100) collate utf8_unicode_ci NOT NULL,
> >  `header_color` varchar(100) collate utf8_unicode_ci NOT NULL,
> >  `user_id` int(11) NOT NULL,
> >  PRIMARY KEY  (`id`),
> > ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> > CREATE TABLE `users` (
> >  `id` int(11) NOT NULL auto_increment,
> >  `first_name` varchar(100) collate utf8_unicode_ci NOT NULL,
> >  `last_name` varchar(100) collate utf8_unicode_ci NOT NULL,
> >  `username` varchar(100) collate utf8_unicode_ci NOT NULL,
> >  `password` varchar(100) collate utf8_unicode_ci default NULL,
> >  PRIMARY KEY  (`id`)
> > ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>
> > using bake i was able to create the models and to define the following
> > associations
>
> > User:
> >        var $hasOne= array('Profile' =>array('className' => 'Profile',
> >                                                'foreignKey' =>
> > 'user_id',
> >                                                'conditions' => '',
> >                                                'fields' => '',
> >                                                'order' => '',
> >                                                'dependent' => ''),);
> > Profile:
> >        var $belongsTo = array('User' =>array('className' => 'User',
> >                                                'foreignKey' =>
> > 'user_id',
> >                                                'conditions' => '',
> >                                                'fields' => '',
> >                                                'order' => '',
> >                                                'counterCache' =>
> > ''),);
>
> > Which seems good to me, but testing the application i was able to
> > create a second profile for one user.
> > I was guessing if thehasOneassociation should check that and return
> > an error, or I am missing something?
> > On the other hand, i builded the tables based on my own understanding
> > of the example, maybe they are wrong, and so the whole example.
>
> > I was thinking of adding an UNIQUE clause on the user_id so forcing
> > only one profile per user but doing that causes the application to
> > show an ugly error database message, which is correct and obviously i
> > can take care of it, but not seems to follow the elegant and simple
> > rules of the rest of the application.
>
> > Thanks in advance
>
> > Robin

--~--~-~--~~~---~--~~
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: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread andy

See http://book.cakephp.org/view/199/options-selected. In the view,
you will need to do something like this:

$form->input('fieldname', array('options' => array($listvalue),
'selected' => 'desiredselectvalue') );

On May 4, 3:56 pm, qwanta  wrote:
> In the controller I do a find('list') to get an array ready for
> populating a select box. I am quite stumped as to how I would set the
> selected index of the select box in the view.
> This is a case where the automagic situation (editing a record) is not
> applicable - it is a log entry form and a new record each time.
>
> 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
-~--~~~~--~~--~--~---



big big big problem!!!!

2009-05-05 Thread henry

Hi everybody,

Please give me help !!!  I made a CMS with cakephp, it 's work fine in
IE6,IE7, Firefox and Opera, but doesn't work in Safari and Chrome.

Steps:

1. display the login page, enter username and password. click log in.
2. display index page if username and password is right. In index
page, save username and usertype into session.
3. check whether session(username) is empty when redirect any other
page.

Problem: i found the safari or chrome always create new session when
redirect to other pages. So lost usename and usertype info in new
session. Result is can't log in and always display the login page.

Current Cakephp config:

cake version:1.2.2.8120
Web Server : IIS
Database : mysql

Core.php config:
Configure::write('App.baseUrl', env('SCRIPT_NAME'). '?url=');
Configure::write('Cache.check', true);
Configure::write('Session.save', 'cake');
Configure::write('Session.cookie', 'PHPSESSID');
Configure::write('Session.timeout', '10');
Configure::write('Session.start', true);
Configure::write('Session.checkAgent', false);
Configure::write('Security.level', 'low');
Cache::config('default', array('engine' => 'File'));


Please give me any idea to fix it. Thanks a lot in advance.

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



Re: quick tip: html helper - verbose linking + named anchor

2009-05-05 Thread Mohsin Kabir
I think it will be a solution

$html->link('View More Photos','/listing/view/id#anchor');

Thanks,
Mohsin

On Tue, May 5, 2009 at 7:44 AM, brian  wrote:

>
> You can also pass '#' as an extra param:
>
> $html->link(
>'View More Photos',
>array(
>'controller'=>'listings',
>'action'=>'view',
>$id
>'#' => 'anchor'
>)
> );
>
> On Mon, May 4, 2009 at 5:55 PM, JamesF  wrote:
> >
> > hey there i'm a big fan of verbose linking but i was having a problem
> > linking to a named anchor in the target page
> > figured it out before i posted my question so figured i would share.
> >
> >
> > code sans named anchor link:
> > echo $html->link('View More Photos', array('controller'=>'listings',
> > 'action'=>'view', $id);
> >
> > outputs : http://mysite.com/controller/action/id
> >
> > try this to link to the anchor:
> >
> > echo $html->link('View More Photos', array('controller'=>'listings',
> > 'action'=>'view', $id . '#anchor');
> >
> > output: http://mysite.com/controller/action/id#anchor
> >
> > >
> >
>
> >
>


-- 
--~--~-~--~~~---~--~~
Thanks,
Mohsin Kabir
--~--~-~--~~~---~--~~

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



getting SQL statement

2009-05-05 Thread Krish

Hi, I want to see wat sql statement made in back by cake ORM? How can
I get 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: Save fields

2009-05-05 Thread andy

Are table rows in the user_systems and users tables named the same? If
so, I would rename the rows in the users table so that they differ
from user_systems and retry.

On Apr 30, 9:46 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Question about selecting fields allowed to have data saved to with a HABTM
> save.
>
> I have a users_systems table which has id, user_id, system_id and a form to
> update the users systems only...no other data.
>
> Now I do not want a User attempting to edit the form and edit other data
> thats saved in the database by adding a data[User][group_id] text field or
> anything.
>
> The code below i added which gets a list of the tables in the database i am
> going to be saving to, in this case its the users_systems table. So i debug
> and sure enough i see the 3 fields id, user_id, system_id.
>
> Are the fields in the save() function in addition to the User->$join_table
> or if you leave it blank only fields in the User->$join_table->can be saved
> to?
>
> Basically I want to restrict data being saved exclusively to the fields in
> the User->$join_table and no where else.
>
> But its still saving data to the User table when I add a text field using
> firebug to the database. How can I only allow data to be saved to the fields
> in the users_systems table? Using AJAX so Security Component is of no use I
> guess.
>
> // this seems to do nothing as i can save other fields by adding a text
> field manually with firebug to save user entered data.
> $whitelist = array('system_id');
>
> debug(array_intersect(array_keys($this->User->$join_table->schema()),
> $whitelist));
>                           $this->User->save($this->data, true,
> array_intersect(array_keys($this->User->$join_table->schema()),
> $whitelist));
>
> Ideas?
>
> Dave

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



Re: 404 File not found when try to browse my first project

2009-05-05 Thread andy

Have you setup routing to tell Cake where to find the app/views/books/
index.ctp file? Take a look at http://book.cakephp.org/view/542/Defining-Routes

You may need to setup a route in /app/config/routes.php like this:

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



On Apr 30, 4:14 pm, Nathan  wrote:
> Here is the background.
> - cakePHP 1.2 in Linux with Apache
> - everything was extract to /root/cakePHP
> - when I browsehttp://localhost/cakePHP, it shows the first page
> correctly (CSS, tmp writable, DB connected.)
>
> I establish my first project by creating files (in Dreamweaver) and
> store them in app/controllers/books_controller.php and app/views/books/
> index.ctp to just display simple text "THIS IS A TEST".
>
> I've got error when I browse tohttp://localhost/cakePHP/books/. The
> error is just normal HTML 404 file not found. I guess I miss some
> setup, didn't I?

--~--~-~--~~~---~--~~
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: User Id Updating

2009-05-05 Thread andy

I believe it is updating because the id value is set. If Cake's save
function picks up a id value through POST, it will update the
appropriate field rather than save a new one. Is the id that you set
in the controller accessed as $user['id'] or $user['User']['id'] in
the view? Try giving the Auth id a different name in the controller.

On May 1, 12:11 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am debugging a save
> debug($this->User->save($this->data[$model_table], true,
> array_keys($this->User->$join_table->schema(;
>
> Everything is working fine in regards to the save except in the debug array
> I see User id...and in the SQL log I see
>
> UPDATE `users` SET `id` = 3 WHERE `users`.`id` = 3
>
> Array
> (
>     [User] => Array
>         (
>             [id] => 3
>         )
>
>     [System] => Array
>         (
>             [0] => 3
>             [1] => 5
>             [2] => 4
>             [3] => 6
>             [4] => 1
>             [5] => 2
>             [6] => 3
>             [7] => 5
>             [8] => 4
>             [9] => 6
>             [10] => 1
>             [11] => 2
>         )
>
> )
> I have nothing in the controller relating to the User.id except
> $this->User->id = $this->Auth->user('id');
> $this->set('user', $this->User->read('id', $this->Auth->user('id')));
>
> Why is updatng? Any ideas?
>
> thanks
>
> Dave

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



Re: Missing table for missing model

2009-05-05 Thread andy

What url are you visiting when you receive this error? You don't have
to provide the entire url, just what appears after the domain name.

On Apr 29, 9:32 am, forrestgump  wrote:
> hey guys,
>  Iam working on a cakephp app and i ran into this problem, though
> minor it is driving me crazy
> I had created a complete MVC structure for a "Seasons" module, then i
> voted against it and deleted everything related to it..the
> model,views,controller and the table too...
>
> but, my app now keeps giving me an error
>
> Missing Database Table
> Error: Database table seasons for model Season was not found.
>
> Notice: If you want to customize this error message, create app\views
> \errors\missing_table.ctp
>
> Can someone help me resolve thisI tried deleting the necessary
> files in
> ...\app\tmp\cache\models
> ...\app\tmp\cache\persistent
> but still no change
>
> Will really appreciate all the help u have to offer..
>
> Regards,
> Forrestgump

--~--~-~--~~~---~--~~
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: Memory Limit Exhausted

2009-05-05 Thread andy

Is your query as thin as possible (only grabbing the fields that you
will be using)?

On Apr 30, 5:06 pm, "Benedikt R."  wrote:
> Okay... Forget this. I used the paginator helper :D
>
> On 30 Apr., 22:13, "Benedikt R."  wrote:
>
> > But how does this happen?
>
> > Doesn't CakePHP recieve the data via an MySQL-Request? How could the
> > memory limit be reached?

--~--~-~--~~~---~--~~
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: Setting pagination url problem - something to do with Routes ??

2009-05-05 Thread Flipflops

Sorry forgot to say would be something like:

$this->passedArgs = array(
[0] => seascapes
[1] => summer-seascapes
);

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



Setting pagination url problem - something to do with Routes ??

2009-05-05 Thread Flipflops

Hi

I'm trying to paginate a set of results but Cake isn't building the
links properly, instead of the correct link the pagination helper is
generating links that just output part of my routes config.

The pagination is working fine in some parts of my application so
something like this is working fine where 'photos' is an actual
controller and 'project_gallery' a method e.g. /photos/project_gallery/
16/page:1#album-image-gallery

But I want the following to be routed to my 'nodes' controller /
seascapes/summer-seascapes - instead of generating /seascapes/summer-
seascapes/page:2  the generated url is:

/(?!admin|pages|users|photos)(./summer/summer-seascapes/page:1)
This line is  just spitting out a line from my routes.php file where
there is a line that basically just catches urls and send them to the
view action of my nodes controller:

Router::connect('(?!admin|pages|users|photos)(.*)', array('controller'
=> 'nodes', 'action' => 'view'));

In my view I am using $paginator->options(array('url' => $this-
>passedArgs)); to try and set the url but that isn't working - I want
to set the url myself and not have cake try and figure out what it is,
which I guess is what isn't working - what I am doing wrong ?

Cheers

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



RE: HABTM question

2009-05-05 Thread Dave Maharaj :: WidePixels.com

Cool...

Will just leave it the way it is.

Thanks.

Dave 

-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com] 
Sent: May-05-09 5:57 AM
To: CakePHP
Subject: Re: HABTM question


Hi Dave,

In my opinion, you should only have one HABTM table between the USER and
SYSTEM models. If you need to split your information from the SYSTEM model
into separate presentation steps, do it with views or with additional
tables/models.

Example:
Users <--- systems_users ---> Systems <--- steps_systems ---> Steps ---
> Tasks

where:
Users - contains information on the users.
Systems - contains information on the possible systems.
Steps - contains information on presentation steps within a task.
Tasks - contains information on presentation tasks, for example Hardware,
Software, etc.

and each HABTM table:
systems_users - defines the system that the user is assigned.
steps_systems - defines the system parts that the user may assign in a
specific step within a task.

This could also be made just using views.

The model above may be incomplete, as I do not know all the factors allowing
the user to choose system parts.

Your last question is answered with a No! I would never model it that way!

Hope this helps you on the way,
   John

On May 5, 6:59 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> I have a question about if this is possible or if it even make sense to
do.
>
> I have 4 HABTM tables that are for a USER to select options from. The 
> options are only for choosing and user has no control over any of the 
> actual options (edit delete add none of that) Now the tables look like 
> this:
> TableA
> TableB
> TableC
> TableD
> all have exactly id, name
>
> User
> id
>
> All the HABTM tables are the same for A, B,C, D TableA_Users tableA_id 
> user_id
>
> I have them separate because the User can update their selections on 
> different pages and not all in 1 form.
>
> My question is if I made 1 HABTM table users_options
>
> id
> user_id
> TableA_id
> TableB_id
> TableC_id
> TableD_id
>
> Would it possible to do something like that? If so would the user be 
> able to update TableA options and not mess with other TableX selected
options?
>
> I read about the tree behaviour but have no clue how to use it for 
> what i am interested in using it for.
>
> Dave


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



Re: Is it possible to set the index of a select box after populating it with find('list')?

2009-05-05 Thread rich...@home

You can pre-populate the $this->data array:

In your controller method:

$this->data['Model']['field'] = 1;

(where 1 is value you want to pre-select)

or,

in the view:

input("field", array("options"=>$options, "default"=>1) ?
>

On May 4, 9:56 pm, qwanta  wrote:
> In the controller I do a find('list') to get an array ready for
> populating a select box. I am quite stumped as to how I would set the
> selected index of the select box in the view.
> This is a case where the automagic situation (editing a record) is not
> applicable - it is a log entry form and a new record each time.
>
> 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: index view values showing as id value and not string value

2009-05-05 Thread rich...@home

You'll need to post your code before anyone has a hope of helping you
here ;-)

On May 5, 6:13 am, programguru  wrote:
> does anyone know why the values being pulled into my index view are id values
> as opposed to the literal string value of the field?
> --
> View this message in 
> context:http://www.nabble.com/index-view-values-showing-as-id-value-and-not-s...
> Sent from the CakePHP mailing list archive at Nabble.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: quick tip: html helper - verbose linking + named anchor

2009-05-05 Thread JamesF

even better...that seems like a more cake-like method than my concat
operator trick

On May 4, 9:44 pm, brian  wrote:
> You can also pass '#' as an extra param:
>
> $html->link(
>         'View More Photos',
>         array(
>                 'controller'=>'listings',
>                 'action'=>'view',
>                 $id
>                 '#' => 'anchor'
>         )
> );
>
> On Mon, May 4, 2009 at 5:55 PM, JamesF  wrote:
>
> > hey there i'm a big fan of verbose linking but i was having a problem
> > linking to a named anchor in the target page
> > figured it out before i posted my question so figured i would share.
>
> > code sans named anchor link:
> > echo $html->link('View More Photos', array('controller'=>'listings',
> > 'action'=>'view', $id);
>
> > outputs :http://mysite.com/controller/action/id
>
> > try this to link to the anchor:
>
> > echo $html->link('View More Photos', array('controller'=>'listings',
> > 'action'=>'view', $id . '#anchor');
>
> > output:http://mysite.com/controller/action/id#anchor
--~--~-~--~~~---~--~~
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: Trying to edit User.status but nothing happens

2009-05-05 Thread Flipflops

Hi

I assume that you are including sername and password as hidden fields
because they are required in your validation array - but rather than
include them as hidden fields it might be better to create different
validate arrays in your model e.g.

var $validate = array(
'somefield' => array('notempty'),
'someotherfield' => array('notempty'),
'password' => array('notempty')
);

var $validate_edit = array(
'somefield' => array('notempty'),
'someotherfield' => array('notempty')
);

Then in your controller you can just choose which validation array you
want to apply, therefore you won't have to include any hidden fields
unnecessarily. e.g.

$this->{$this->modelClass}->validate = $this->{$this->modelClass}-
>validate_edit;

You could alternatively use the 'on' option in your validation array
(see http://book.cakephp.org/view/127/One-Rule-Per-Field)

var $validate = array(
 'fieldName1' => array(
 'rule' => 'ruleName', // or: array('ruleName', 'param1',
'param2' ...)
 'required' => true,
 'allowEmpty' => false,
 'on' => 'create', // or: 'update'
 'message' => 'Your Error Message'
 )
)

I prefer to create multiple validation arrays as it is really easy to
read and keeps things nice and clear.

John



On May 5, 1:11 pm, paulos nikolo  wrote:
> Well i found the solution...i put sername and password as hidden so that
> there are enough data for update!
> Thx again m8!
>
> 2009/5/5 paulos nikolo 
>
> > Thx for the hint Jonh.Well when i try to change status from 1 to 0
> > (checkbox unchecked) here is what debug prints:
>
> > Array
> > (
> >     [User] => Array
> >         (
> >             [status] => 0
>
> >             [id] => 54
> >         )
>
> > )
>
> > Which it seems ok to me...i cant understand what's going on.The status has
> > been changed but it cant be saved.
>
> > 2009/5/5 John Andersen 
>
> >> Try to put a debug statement into the controller in the change_status
> >> method, to see that it is getting invoked!
> >> For example "debug($this->data);"
> >> Enjoy,
> >>    John
>
> >> On May 5, 1:47 pm, Paulos23  wrote:
> >> > Hello people,
> >> > I am facing a really weird problem with an issue.I have a field in
> >> > users table which is called status.I have set it to tinyint(1) not
> >> > null default '1',which means user status is active.Now when i want to
> >> > change his status to inactive--> '0'
> >> > i use a checkbox as it is more appropriate,so if i leave it unchecked
> >> > User.status become inactive.The weird thing is that when i do that the
> >> > action in users_controller which is called change_status does
> >> > NOTHING.No errors,no saving new data...just nothing.I wonder if there
> >> > is a bug with checkbox button or something else.
> >> > Here i put my code..Plz if you have any ideas i 'd be glad.
>
> >> > Thx in advance!
>
> >> > views/users/change_status.ctp
>
> >> > User Status Change
>
> >> >  >> >         echo $form->create('User', array('action' => 'change_status'));
>
> >> >         echo $form->input('User.status', array ('type' =>
> >> > 'checkbox','label'=> 'Active'));
>
> >> >         echo'Set the user account as active or inactive ';
> >> >         echo $form->input('id', array('type'=>'hidden'));
> >> >         echo $form->end('Save');
> >> > ?>
>
> >> > controllers/users_controller
>
> >> > function change_status($id=null){
> >> >                 //$this->User->id = $id;
> >> >                 if (empty($this->data)) {
> >> >                         $this->data = $this->User->read(null, $id);
> >> >                 } else {
> >> >                         if ($this->User->save($this->data)) {
> >> >                         $this->Session->setflash('User status has been
> >> updated!');
> >> >                         $this->redirect('/users');
> >> >                         }
> >> >                 }
> >> >         }
>
>
--~--~-~--~~~---~--~~
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: Release: 1.2.3.8166

2009-05-05 Thread Celso

Nice Job!
Ps.: i hope that the ticket https://trac.cakephp.org/ticket/6212 come
in the next version :D


On 5 maio, 08:33, Fábio "Kym" Nascimento 
wrote:
> thanks!
>
> On May 4, 6:58 pm, Gwoo  wrote:
>
> > I am happy to announce another release of CakePHP 1.2. CakePHP
> > 1.2.3.8166[1] includes several bug fixes and most importantly a
> > security fix. To understand the security issue please have a look at
> > Ticket #6336[2]. While this may not affect every installation of Cake,
> > we do recommend that everyone take the time to upgrade their
> > applications. Also, note that there was a bug in Paginator related to
> > changing directions on sorting that is now fixed. For a complete list
> > of changes, please look at the changelog[3].
>
> > I would also like to bring your attention to the work being done on
> > CakePHP 1.3. You can see we have several branches[4] and many commits
> > [5] have also been pushed. So, development is pushing forward nicely,
> > though I still cannot offer up an expected release date.
>
> > Happy Baking.
>
> > [1]http://cakeforge.org/frs/?group_id=23&release_id=442
> > [2]https://trac.cakephp.org/ticket/6336
> > [3]https://trac.cakephp.org/wiki/changelog/1.2.x.x/
> > [4]http://thechaw.com/cakephp/source/branches
> > [5]http://thechaw.com/cakephp/commits
>
> > PS. CakeFest Tickets.http://cakefest.org
--~--~-~--~~~---~--~~
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: Trying to edit User.status but nothing happens

2009-05-05 Thread paulos nikolo
Well i found the solution...i put sername and password as hidden so that
there are enough data for update!
Thx again m8!

2009/5/5 paulos nikolo 

> Thx for the hint Jonh.Well when i try to change status from 1 to 0
> (checkbox unchecked) here is what debug prints:
>
> Array
> (
> [User] => Array
> (
> [status] => 0
>
> [id] => 54
> )
>
> )
>
> Which it seems ok to me...i cant understand what's going on.The status has
> been changed but it cant be saved.
>
> 2009/5/5 John Andersen 
>
>
>> Try to put a debug statement into the controller in the change_status
>> method, to see that it is getting invoked!
>> For example "debug($this->data);"
>> Enjoy,
>>John
>>
>> On May 5, 1:47 pm, Paulos23  wrote:
>> > Hello people,
>> > I am facing a really weird problem with an issue.I have a field in
>> > users table which is called status.I have set it to tinyint(1) not
>> > null default '1',which means user status is active.Now when i want to
>> > change his status to inactive--> '0'
>> > i use a checkbox as it is more appropriate,so if i leave it unchecked
>> > User.status become inactive.The weird thing is that when i do that the
>> > action in users_controller which is called change_status does
>> > NOTHING.No errors,no saving new data...just nothing.I wonder if there
>> > is a bug with checkbox button or something else.
>> > Here i put my code..Plz if you have any ideas i 'd be glad.
>> >
>> > Thx in advance!
>> >
>> > views/users/change_status.ctp
>> >
>> > User Status Change
>> >
>> > > > echo $form->create('User', array('action' => 'change_status'));
>> >
>> > echo $form->input('User.status', array ('type' =>
>> > 'checkbox','label'=> 'Active'));
>> >
>> > echo'Set the user account as active or inactive ';
>> > echo $form->input('id', array('type'=>'hidden'));
>> > echo $form->end('Save');
>> > ?>
>> >
>> > controllers/users_controller
>> >
>> > function change_status($id=null){
>> > //$this->User->id = $id;
>> > if (empty($this->data)) {
>> > $this->data = $this->User->read(null, $id);
>> > } else {
>> > if ($this->User->save($this->data)) {
>> > $this->Session->setflash('User status has been
>> updated!');
>> > $this->redirect('/users');
>> > }
>> > }
>> > }
>> >>
>>
>

--~--~-~--~~~---~--~~
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: Trying to edit User.status but nothing happens

2009-05-05 Thread paulos nikolo
Thx for the hint Jonh.Well when i try to change status from 1 to 0 (checkbox
unchecked) here is what debug prints:

Array
(
[User] => Array
(
[status] => 0
[id] => 54
)

)

Which it seems ok to me...i cant understand what's going on.The status has
been changed but it cant be saved.

2009/5/5 John Andersen 

>
> Try to put a debug statement into the controller in the change_status
> method, to see that it is getting invoked!
> For example "debug($this->data);"
> Enjoy,
>John
>
> On May 5, 1:47 pm, Paulos23  wrote:
> > Hello people,
> > I am facing a really weird problem with an issue.I have a field in
> > users table which is called status.I have set it to tinyint(1) not
> > null default '1',which means user status is active.Now when i want to
> > change his status to inactive--> '0'
> > i use a checkbox as it is more appropriate,so if i leave it unchecked
> > User.status become inactive.The weird thing is that when i do that the
> > action in users_controller which is called change_status does
> > NOTHING.No errors,no saving new data...just nothing.I wonder if there
> > is a bug with checkbox button or something else.
> > Here i put my code..Plz if you have any ideas i 'd be glad.
> >
> > Thx in advance!
> >
> > views/users/change_status.ctp
> >
> > User Status Change
> >
> >  > echo $form->create('User', array('action' => 'change_status'));
> >
> > echo $form->input('User.status', array ('type' =>
> > 'checkbox','label'=> 'Active'));
> >
> > echo'Set the user account as active or inactive ';
> > echo $form->input('id', array('type'=>'hidden'));
> > echo $form->end('Save');
> > ?>
> >
> > controllers/users_controller
> >
> > function change_status($id=null){
> > //$this->User->id = $id;
> > if (empty($this->data)) {
> > $this->data = $this->User->read(null, $id);
> > } else {
> > if ($this->User->save($this->data)) {
> > $this->Session->setflash('User status has been
> updated!');
> > $this->redirect('/users');
> > }
> > }
> > }
> >
>

--~--~-~--~~~---~--~~
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: Release: 1.2.3.8166

2009-05-05 Thread Kym

thanks!

On May 4, 6:58 pm, Gwoo  wrote:
> I am happy to announce another release of CakePHP 1.2. CakePHP
> 1.2.3.8166[1] includes several bug fixes and most importantly a
> security fix. To understand the security issue please have a look at
> Ticket #6336[2]. While this may not affect every installation of Cake,
> we do recommend that everyone take the time to upgrade their
> applications. Also, note that there was a bug in Paginator related to
> changing directions on sorting that is now fixed. For a complete list
> of changes, please look at the changelog[3].
>
> I would also like to bring your attention to the work being done on
> CakePHP 1.3. You can see we have several branches[4] and many commits
> [5] have also been pushed. So, development is pushing forward nicely,
> though I still cannot offer up an expected release date.
>
> Happy Baking.
>
> [1]http://cakeforge.org/frs/?group_id=23&release_id=442
> [2]https://trac.cakephp.org/ticket/6336
> [3]https://trac.cakephp.org/wiki/changelog/1.2.x.x/
> [4]http://thechaw.com/cakephp/source/branches
> [5]http://thechaw.com/cakephp/commits
>
> PS. CakeFest Tickets.http://cakefest.org
--~--~-~--~~~---~--~~
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: What is the limit to the string length to be written to cake po files .Can it be overridden.if so how?

2009-05-05 Thread John Andersen

With that I can't help you! That would mean too deep a detective work
into the code :)
Try to reach one of the experts!
   John

On May 4, 2:04 pm, Anibigi  wrote:
> Thanks!
>
> How can I override this if I want to read /write longer strings from/
> to po files.
>
> - regards
>
> On May 4, 3:37 pm, John Andersen  wrote:
>
> > As stated in the book at:
>
> >http://book.cakephp.org/view/162/Localizing-Your-Application
>
> > ".po files should be encoded using UTF-8, and there is a 1014-
> > character limit for each msgstr value."
>
> > Enjoy,
> >    John
>
> > On May 4, 12:48 pm, Anibigi  wrote:
>
> > > Hi,
>
> > > I'm attempting to localize content.
> > > Some of the strings are very long and when I try to read them it
> > > renders the msgid only from the po file and not the mg string.
>
> > > Is there a limit to the length of string to be written in po file..If
> > > so..how can I override it.
>
> > > Please help if anyone knows the answer to this.- Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
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: Trying to edit User.status but nothing happens

2009-05-05 Thread John Andersen

Try to put a debug statement into the controller in the change_status
method, to see that it is getting invoked!
For example "debug($this->data);"
Enjoy,
   John

On May 5, 1:47 pm, Paulos23  wrote:
> Hello people,
> I am facing a really weird problem with an issue.I have a field in
> users table which is called status.I have set it to tinyint(1) not
> null default '1',which means user status is active.Now when i want to
> change his status to inactive--> '0'
> i use a checkbox as it is more appropriate,so if i leave it unchecked
> User.status become inactive.The weird thing is that when i do that the
> action in users_controller which is called change_status does
> NOTHING.No errors,no saving new data...just nothing.I wonder if there
> is a bug with checkbox button or something else.
> Here i put my code..Plz if you have any ideas i 'd be glad.
>
> Thx in advance!
>
> views/users/change_status.ctp
>
> User Status Change
>
>          echo $form->create('User', array('action' => 'change_status'));
>
>         echo $form->input('User.status', array ('type' =>
> 'checkbox','label'=> 'Active'));
>
>         echo'Set the user account as active or inactive ';
>         echo $form->input('id', array('type'=>'hidden'));
>         echo $form->end('Save');
> ?>
>
> controllers/users_controller
>
> function change_status($id=null){
>                 //$this->User->id = $id;
>                 if (empty($this->data)) {
>                         $this->data = $this->User->read(null, $id);
>                 } else {
>                         if ($this->User->save($this->data)) {
>                         $this->Session->setflash('User status has been 
> updated!');
>                         $this->redirect('/users');
>                         }
>                 }
>         }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trying to edit User.status but nothing happens

2009-05-05 Thread Paulos23

Hello people,
I am facing a really weird problem with an issue.I have a field in
users table which is called status.I have set it to tinyint(1) not
null default '1',which means user status is active.Now when i want to
change his status to inactive--> '0'
i use a checkbox as it is more appropriate,so if i leave it unchecked
User.status become inactive.The weird thing is that when i do that the
action in users_controller which is called change_status does
NOTHING.No errors,no saving new data...just nothing.I wonder if there
is a bug with checkbox button or something else.
Here i put my code..Plz if you have any ideas i 'd be glad.

Thx in advance!

views/users/change_status.ctp

User Status Change

create('User', array('action' => 'change_status'));

echo $form->input('User.status', array ('type' =>
'checkbox','label'=> 'Active'));

echo'Set the user account as active or inactive ';
echo $form->input('id', array('type'=>'hidden'));
echo $form->end('Save');
?>

controllers/users_controller

function change_status($id=null){
//$this->User->id = $id;
if (empty($this->data)) {
$this->data = $this->User->read(null, $id);
} else {
if ($this->User->save($this->data)) {
$this->Session->setflash('User status has been 
updated!');
$this->redirect('/users');
}
}
}
--~--~-~--~~~---~--~~
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: show field names in cakephp error messages

2009-05-05 Thread John Andersen

Yes you can, look at 
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller,
where the erroneous fields are retrieved using the models method
http://api.cakephp.org/class/model#method-ModelinvalidFields to
retrieve the erroneous fields.
Enjoy,
   John

On May 5, 1:28 pm, Malcolm Krugger 
wrote:
> Is it possible to show the fieldname/include the fieldname in cakephp
> validation error messages ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



show field names in cakephp error messages

2009-05-05 Thread Malcolm Krugger

Is it possible to show the fieldname/include the fieldname in cakephp
validation error messages ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



$this->render causes openbase_dir restriction error ??

2009-05-05 Thread Flipflops

Hi

I've got an action that based on on the parameters passed to it either
renders its default view or one of a number of alternate views based
on the values in $this->params['pass'];

This is stripped back version of the action, $this->render('/sections/
view'); seeme to be what is causing the problem, but it is still
rendering the correct view file despite the errors.

function view() {
$this->Node->recursive = -1;
$this->pass_count = count($this->params['pass']);
$this->pass_position = $this->pass_count - 1;

$data = $this->view_sub();
$this->data = $data;

if(!empty($data['Node']['model_placeholder'])){

$section = ClassRegistry::init('Section');
$section_data = 
$section->view_section($this->params['pass'], $this-
>pass_count, $this->pass_position);

if(count($section_data) == 2){
$this->data['Section'] = 
$section_data[0]['Section'];
$this->set('subsections', $section_data[1]);
$this->render('/sections/view');
}
} else {
// do nothing this will render the default view
}
}

The error I'm getting is:

is_file() [function.is-file]: open_basedir restriction in effect. File
(/sections/view) is not within the allowed path(s): (/var/www/vhosts/
somedomain.com/subdomains/coastal/httpdocs:/tmp) [CORE/cake/libs/view/
view.php, line 792]

Looking on Google about similar sounding errors I've tried to force
the path to views into bootstrap.php setting: $viewPaths = array(APP .
'app' . DS . 'views' . DS );

I'm sure its something obvious and I'm just being thick, any help
greatly appreciated (I'm using 1.2.1.8004)

Cheers
--~--~-~--~~~---~--~~
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: $time->timeAgoInWords() not displaying plural times

2009-05-05 Thread John Andersen

There is an error in the I18N class at line 176, where due to checking
a singular translation as the first part of the if statement, the
second part is not checked, thus not filling the translation with the
plural version.

Change the line to:
if (($plurals) && ($trans = $_this->__domains[$_this->category][$_this-
>__lang][$domain][$plural]) || ($trans = $_this->__domains[$_this-
>category][$_this->__lang][$domain][$singular])) {

Best wishes,
   John

On May 5, 11:42 am, Miles J  wrote:
> Locale files:
>
> msgid "minute"
> msgstr "Minute"
>
> msgid "minutes"
> msgstr "Minutes"
>
> In the view:
>
> timeAgoInWords($user['User']['created'],
> array('userOffset' => $misc->timezone(; ?>
--~--~-~--~~~---~--~~
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: Release: 1.2.3.8166

2009-05-05 Thread Miles J

Hah, I would if I could afford it.

On May 4, 6:45 pm, Mariano Iglesias 
wrote:
> Come to Berlin:
>
> http://cakefest.org
>
> And buy beers for the whole team. How's that?
>
> Miles J wrote:
> > I love you guys, seriously.
> > I just wish there was somehow to help or give back!
>
> --
> -MI
> *Coding Ninja* @ CRICAVA Technologies 
>
> *Blog*:        http://www.marianoiglesias.com.ar
> *Twitter*:      http://twitter.com/mgiglesias
> *LinkedIn*:    http://www.linkedin.com/pub/2/483/B94
> *Facebook*:    http://facebook.com/people/Mariano_Iglesias/646886921
--~--~-~--~~~---~--~~
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: $time->timeAgoInWords() not displaying plural times

2009-05-05 Thread Miles J

Locale files:

msgid "minute"
msgstr "Minute"

msgid "minutes"
msgstr "Minutes"

In the view:

timeAgoInWords($user['User']['created'],
array('userOffset' => $misc->timezone(; ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM question

2009-05-05 Thread John Andersen

Hi Dave,

In my opinion, you should only have one HABTM table between the USER
and SYSTEM models. If you need to split your information from the
SYSTEM model into separate presentation steps, do it with views or
with additional tables/models.

Example:
Users <--- systems_users ---> Systems <--- steps_systems ---> Steps ---
> Tasks

where:
Users - contains information on the users.
Systems - contains information on the possible systems.
Steps - contains information on presentation steps within a task.
Tasks - contains information on presentation tasks, for example
Hardware, Software, etc.

and each HABTM table:
systems_users - defines the system that the user is assigned.
steps_systems - defines the system parts that the user may assign in a
specific step within a task.

This could also be made just using views.

The model above may be incomplete, as I do not know all the factors
allowing the user to choose system parts.

Your last question is answered with a No! I would never model it that
way!

Hope this helps you on the way,
   John

On May 5, 6:59 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> I have a question about if this is possible or if it even make sense to do.
>
> I have 4 HABTM tables that are for a USER to select options from. The
> options are only for choosing and user has no control over any of the actual
> options (edit delete add none of that)
> Now the tables look like this:
> TableA
> TableB
> TableC
> TableD
> all have exactly id, name
>
> User
> id
>
> All the HABTM tables are the same for A, B,C, D
> TableA_Users
> tableA_id
> user_id
>
> I have them separate because the User can update their selections on
> different pages and not all in 1 form.
>
> My question is if I made 1 HABTM table
> users_options
>
> id
> user_id
> TableA_id
> TableB_id
> TableC_id
> TableD_id
>
> Would it possible to do something like that? If so would the user be able to
> update TableA options and not mess with other TableX selected options?
>
> I read about the tree behaviour but have no clue how to use it for what i am
> interested in using it for.
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Release: 1.2.3.8166

2009-05-05 Thread j0n4s.h4rtm...@googlemail.com

Wow you are fast. And its on the spot. I just released a customer
application with SVN head 2 days ago :)

Thank you so much!

On May 5, 3:52 am, jperras  wrote:
> On May 4, 6:20 pm, Brett Wilton  wrote:
>
> > Thanks gwoo and all the dev.
>
> > To find out about the 1.3 features and to keep up with progress on 1.3
> > is thehttp://thechaw.com/cakephp/wiki/1.3wikithe best place to
> > follow this ?
>
> yep. That and the aggregate timeline of the master (as well as the
> many branches) to see what features are being implemented/refactored
> into 1.3.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to trap DB errors and show a msg?

2009-05-05 Thread John Andersen

Look into onError - Called when a DataSource-level error occurs.

See http://book.cakephp.org/view/687/onError
and source at http://api.cakephp.org/view_source/model/#line-2778

Enjoy,
   John


On May 5, 9:12 am, K3  wrote:
> when i try to delete wrong row from DB able i get "SQL Error: 1451:
> Cannot delete or update a parent row: a foreign key constraint fails",
> but if debug=0 it shows PAGE NOT FOUND error. How can i trap this
> error and show some user friendly msg?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---