Re: rackspace cloud servers

2010-10-03 Thread codivist
I have 5 sites set up on rackspace and don't have any issues.
Whenever I have, chatting with tech support has been quick and
friendly.

On Oct 1, 6:05 pm, andres amaya diaz  wrote:
> Has anybody on the group has any experience using rackspace cloud servers?
> They look like a great alternative for a big web app deployment, even
> for development or testing stages and i am looking for something like
> this but first i wanted to see any reviews.
>
> Here is the link:http://www.rackspacecloud.com/cloud_hosting_products/servers
>
> Thanks ... aad

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: models: fundamental question referring to member variables

2010-10-03 Thread Jack Timmons
On Sun, Oct 3, 2010 at 6:56 PM, DerBjörn  wrote:
> The user table has a column 'birthtime', but in my page i want to show
> the age in years and days of the user instead.

The you should make a view helper for this, and not bother the data in-transit.

class AgeHelper extends AppHelper {} (I think, I don't have the
inclination ATM to ensure I'm accurate).

> So when i retrieve the data of the database i first need to set the
> birthtime:
>
> $this->Age->setBirthtime($data['User']['birthtime']);
> to be then able to access to calculated years and days:
>
> $user->getAge()->getYears();
> $user->getAge()->getDays();
>
> The same the other way round:
> If i want to randomize the birthtime of the user with my solution i am
> able to do it like that:
> $user->getAge()->randomizeBirthtime();

If you go with my Helper idea, I see no point in any of this. The data
should stay exactly as it came from the database, and your Helper
handle displaying how you want it.

> But when i want to save the user of course first i have to get the
> random birthtime out of its class and put it in the array:
> $this->data['User']['birthtime'] = $this->Age->getBirthtime();
> $this->save($this->data);
>
> Something like that, sorry about my pseudo code.
> The problem is that the most of my member varables are classes
> actually to be able to randomize or do calculations with their values.

And if you go with my method, you don't have to worry about messing
with the data at all. If they change it, you do the same calculations
in the model's beforeSave. Or the controller, whichever holds Cthulhu
off another night.

-- 
Jack Timmons
@_Codeacula

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: models: fundamental question referring to member variables

2010-10-03 Thread DerBjörn
Your example and explaination I understand, but what about using other
classes as member variables and not just simple values.
Let me give you an example:
The user table has a column 'birthtime', but in my page i want to show
the age in years and days of the user instead.
So i have a class 'Age':

Pseudocode:
class User(
private $Age = new Age());

So when i retrieve the data of the database i first need to set the
birthtime:
$this->Age->setBirthtime($data['User']['birthtime']);
to be then able to access to calculated years and days:

$user->getAge()->getYears();
$user->getAge()->getDays();

The same the other way round:
If i want to randomize the birthtime of the user with my solution i am
able to do it like that:
$user->getAge()->randomizeBirthtime();

But when i want to save the user of course first i have to get the
random birthtime out of its class and put it in the array:
$this->data['User']['birthtime'] = $this->Age->getBirthtime();
$this->save($this->data);

Something like that, sorry about my pseudo code.
The problem is that the most of my member varables are classes
actually to be able to randomize or do calculations with their values.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem with installation

2010-10-03 Thread Graham Weldon
Turn debug level to 2 to see useful output to help debug the problem. At a 
guess, I think you may have some model caching issues and your tmp directory 
may not be writable. 

Cheers
Graham. 

On 04/10/2010, at 7:19 AM, tompap  wrote:

> Hello,
> 
> I have developed a website for my university and works like a charm
> when i installed it in one of my own servers.
> The problem is that when i transfered it to the university's server i
> came across some really strange errors. I'm sure that this is due to
> the server's settings. So the problems are:
> 
> 1. The locale for swithing languages was not working anymore. To be
> more specific, half of the contents were appearring in one language
> and the other half in another.
> 
> 2. In my own servers when i requested the mywebsite.gr/admin i was
> transfered to a login form from where i could access the admin
> section. Now i only see a white screen of death...
> 
> Do you have any ideas? I suspect that this is a problem of the
> particular server's settings, maybe it doesn't allow sessions or
> something...
> 
> 
> Any ideas? Or any guidance on what should i check?
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 with installation

2010-10-03 Thread tompap
Hello,

I have developed a website for my university and works like a charm
when i installed it in one of my own servers.
The problem is that when i transfered it to the university's server i
came across some really strange errors. I'm sure that this is due to
the server's settings. So the problems are:

1. The locale for swithing languages was not working anymore. To be
more specific, half of the contents were appearring in one language
and the other half in another.

2. In my own servers when i requested the mywebsite.gr/admin i was
transfered to a login form from where i could access the admin
section. Now i only see a white screen of death...

Do you have any ideas? I suspect that this is a problem of the
particular server's settings, maybe it doesn't allow sessions or
something...


Any ideas? Or any guidance on what should i check?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: models: fundamental question referring to member variables

2010-10-03 Thread Miles J
Theres no point for getters and setters if they dont do anything to
the property. If it just sets and gets without modifying the data in
any way, you might as well just use public properties. However, Cake
does support the active record approach.

$user = new User();
$user->username = 'miles';
$user->email = 'em...@domain.com';
$user->save();

On Oct 3, 1:12 pm, DerBjörn  wrote:
> Hi,
>
> as a newbie to cakephp for me it looks like that 'normal' models don't
> have any more common member variables, but associative arrays.
>
> For example I have a model 'Person' with firstname, lastname, age etc.
>
> Generally i would solve this with member variables $firstname,
> $lastname and $age and their common getters and setters
> setFirstname($value), getAge(), etc., but this still does have sense?
> When i save a person i have to use an associative array, so with my
> technique i need to create first an array ($data = array()) out of my
> common member variables to pass it to model's function ->save($data)
>
> Does it mean that the common member variables are obsolete and i
> actually only have to use one member variable $data and use it then
> like:
>
> function setFirstname($value){ $this->data['firstname'] = $value;}; or
> function getAge(){ return $this->data['age']; }; ?
>
> The same when i want to make a new instance of a Person and retrieve
> their variables from the database:
> Does it has to look like following then?
>
> $person = new Person();
> $person->retrieve(5); // ID
>
> and the model Person has a function retrieve($id) when i get then its
> data from the database and set it to $this->data??
>
> I hope i made me explain at least a little and you understand my
> question :)
> Thanks for any advice or example!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem with hasOne Relation

2010-10-03 Thread Raphi
Hi, thank you for you quick response. Unfortunately I neither do use
AJAX nor have the data saved in the users table. I guess I have to use
two controllers anyway. :(


On 3 Okt., 22:36, cricket  wrote:
> On Sun, Oct 3, 2010 at 2:01 PM, Raphi  wrote:
> > Hi there,
>
> > I'm new to Cake and now I seem to have a little understanding problem.
> > The situation is this:
>
> > I have a UsersController and a User Model. Then there is an
> > editProfile() method within my UsersController. Of course I also
> > created a view (users/edit_profile.ctp). My problem is that I want to
> > have an editable automagic form on that page that is linked to the
> > user_profiles table.
>
> > What I did is, I added "var $hasOne = array('UserProfile');" to my
> > User Model. And I created a form like this:
>
> >    echo $form->create('UserProfile');
> >    echo $form->input('id');
> >    echo $form->input('name');
> >    echo $form->end();
>
> > Then I created a user_profile.php model file and added "var $belongsTo
> > = 'User';" to it. The user_profiles table has a "user_id" foreign key.
>
> > When I send the form, cake throws an error as it cannot find the
> > "UserProfileController". Normally this would be ok but for I want the
> > UsersController to do all the work it's not. What can I do? I mean, I
> > could create a user_profiles_controller.php to send the form and
> > afterwards do a redirect to the form but that wouldn't be very
> > fashionable.
>
> Assuming that the data you want to modify are in the users table, and
> that you want to submit the form with AJAX, you can handle it all with
> a single action in UsersController.
>
> AppController:
>
> public $components = array('Auth', 'Session', 'RequestHandler', ...);
>
> function beforeFilter()
> {
>         parent::beforeFilter();
>
>         // ...
>
>         if ($this->RequestHandler->isAjax())
>         {
>                 Configure::write('debug', 0);
>                 $this->layout = 'ajax';
>         }
>
> }
>
> UsersController:
>
> function beforeFilter()
> {
>         parent::beforeFilter();
>
>         // ...
>
>         if ($this->RequestHandler->isAjax())
>         {
>                 $this->viewPath = 'elements/users';
>         }
>
> }
>
> public function edit()
> {
>         $id = $this->Auth->user('id');
>
>         if (!$id)
>         {
>                 $this->flash('invalid request');
>         }
>
>         if (!empty($this->data))
>         {
>                 if ($this->User->save($this->data))
>                 {
>                         if ($this->RequestHandler->isAjax())
>                         {
>                                 $this->render('profile');
>                         }
>                 }
>                 else
>                 {
>                         if ($this->RequestHandler->isAjax())
>                         {
>                                 $this->render('form');
>                         }
>                 }
>         }
>         else
>         {
>                 $this->data = $this->User->read(null, $id);
>         }
>
>         // set whatever else you need
>
> }
>
> views/elements/users/form.ctp:
>
>  if (!empty($form->validationErrors))
> {
> ?>
>         There was an error in the submission. Please review
> the fields below.
> 
> ?>
>         * Required Field
> 
> switch ($this->params['action'])
> {
>         case 'admin_add':
>
>                 echo $form->create('User', array('action' => 'add', 'admin' 
> => 1));
>                 break;
>
>         case 'add':
>
>                 echo $form->create('User', array('action' => 'add'));
>                 break;
>
>         case 'admin_edit':
>
>                 echo $form->create('User', array('action' => 'edit', 'admin' 
> => 1));
>                 echo $form->hidden('User.id');
>                 break;
>
>         case 'edit':
>
>                 echo $form->create('User', array('action' => 'edit'));
>                 echo $form->hidden('User.id');
>                 break;
>
> }
>
> In the case blocks above, you could include your JS link(s) for the
> AJAX form stuff. You can also switch on $this->params['action'] for
> the submit buttons, test it for whether to include certain fields,
> etc. The add, edit, admin_add, admin_edit views all just include the
> form element.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: unbind USER model inside the USER controller

2010-10-03 Thread cricket
On Sun, Oct 3, 2010 at 4:31 PM, Mariano C.  wrote:
> How can I rewrite my function to do things like u suggested???
>
> On 2 Ott, 21:53, "Mariano C."  wrote:
>> my function that paginate is something like
>>
>> function ... paging()
>> {
>>    $this->paginate = array(.);
>>    $books = $this->paginate('Book');
>>    // this is where i can get the information printed in first post
>>    $this->set(compact('books'));
>>
>> }

It's unclear to me which controller we're talking about. You mentioned
paginating books but also that what you're interested in is a
particular User's Books. Unless you mean that you want to paginate a
particular User's Books, maybe?

If you're fetching a single User and you'd like to see their Books in the data:

$data = $this->User->find(
   'first',
   array(
   'conditions' => array(
   'User.id' => $id
   ),
   'fields' => array('...'),
   'contain' => array(
   'Book'
   )
   )
);

If you're paginating several Users and you'd like to include each of
their Book collections:

public $paginate = array(
'fields' => array('*'),
'limit' => 10,
'order' => array('User.surname' => 'ASC'),
'contain' => array(
'Book' => array(
'fields' => array(
'Book.id',
'Book.title'
),
'order' => array('Book.title' => 'ASC')
)
)
);

public function index()
{
$this->set(
'data'
$this->paginate()
);
}


If you're paginating Books and want to see theUsers who have each in
the collections:

public $paginate = array(
'fields' => array('*'),
'limit' => 10,
'order' => array('Book.title' => 'ASC'),
'contain' => array(
'User' => array(
'fields' => array(
'User.id',
'User.surname'
),
'order' => array('User.surname' => 'ASC')
)
)
);

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem with hasOne Relation

2010-10-03 Thread cricket
On Sun, Oct 3, 2010 at 2:01 PM, Raphi  wrote:
> Hi there,
>
> I'm new to Cake and now I seem to have a little understanding problem.
> The situation is this:
>
> I have a UsersController and a User Model. Then there is an
> editProfile() method within my UsersController. Of course I also
> created a view (users/edit_profile.ctp). My problem is that I want to
> have an editable automagic form on that page that is linked to the
> user_profiles table.
>
> What I did is, I added "var $hasOne = array('UserProfile');" to my
> User Model. And I created a form like this:
>
>    echo $form->create('UserProfile');
>    echo $form->input('id');
>    echo $form->input('name');
>    echo $form->end();
>
> Then I created a user_profile.php model file and added "var $belongsTo
> = 'User';" to it. The user_profiles table has a "user_id" foreign key.
>
> When I send the form, cake throws an error as it cannot find the
> "UserProfileController". Normally this would be ok but for I want the
> UsersController to do all the work it's not. What can I do? I mean, I
> could create a user_profiles_controller.php to send the form and
> afterwards do a redirect to the form but that wouldn't be very
> fashionable.

Assuming that the data you want to modify are in the users table, and
that you want to submit the form with AJAX, you can handle it all with
a single action in UsersController.

AppController:

public $components = array('Auth', 'Session', 'RequestHandler', ...);

function beforeFilter()
{
parent::beforeFilter();

// ...

if ($this->RequestHandler->isAjax())
{
Configure::write('debug', 0);
$this->layout = 'ajax';
}
}

UsersController:

function beforeFilter()
{
parent::beforeFilter();

// ...

if ($this->RequestHandler->isAjax())
{
$this->viewPath = 'elements/users';
}
}

public function edit()
{
$id = $this->Auth->user('id');

if (!$id)
{
$this->flash('invalid request');
}

if (!empty($this->data))
{
if ($this->User->save($this->data))
{
if ($this->RequestHandler->isAjax())
{
$this->render('profile');
}
}
else
{
if ($this->RequestHandler->isAjax())
{
$this->render('form');
}
}
}
else
{
$this->data = $this->User->read(null, $id);
}

// set whatever else you need
}

views/elements/users/form.ctp:


validationErrors))
{
?>
There was an error in the submission. Please review
the fields below.

* Required Field
params['action'])
{
case 'admin_add':

echo $form->create('User', array('action' => 'add', 'admin' => 
1));
break;

case 'add':

echo $form->create('User', array('action' => 'add'));
break;

case 'admin_edit':

echo $form->create('User', array('action' => 'edit', 'admin' => 
1));
echo $form->hidden('User.id');
break;

case 'edit':

echo $form->create('User', array('action' => 'edit'));
echo $form->hidden('User.id');
break;
}

In the case blocks above, you could include your JS link(s) for the
AJAX form stuff. You can also switch on $this->params['action'] for
the submit buttons, test it for whether to include certain fields,
etc. The add, edit, admin_add, admin_edit views all just include the
form element.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: unbind USER model inside the USER controller

2010-10-03 Thread Mariano C.
How can I rewrite my function to do things like u suggested???

On 2 Ott, 21:53, "Mariano C."  wrote:
> my function that paginate is something like
>
> function ... paging()
> {
>    $this->paginate = array(.);
>    $books = $this->paginate('Book');
>    // this is where i can get the information printed in first post
>    $this->set(compact('books'));
>
> }
>
> On 2 Ott, 20:59, cricket  wrote:
>
> > On Sat, Oct 2, 2010 at 1:27 PM, Mariano C.  
> > wrote:
> > > Then, I have a User model and a Book Model I bind it as:
> > > User HABTM Book
> > > Book HABTM User
>
> > > So I have books_users table inside my DB and CAKEPHP will
> > > automatically create BooksUser virtual model.
>
> > > Now if I want to know about a user's book collection I call method
> > > getCollection inside User controller. This work QUITE perfectly and
> > > will return me a data set like:
> > > Array
> > > (
> > >    [0] => Array
> > >        (
> > >            [BooksUser] => Array
> > >                (
> > >                    [id] => 4ca75919
> > >                )
>
> > >            [Book] => Array
> > >                (
> > >                    [id] => 6a915e32
> > >                    [title] => the Dubliners
> > >                )
>
> > >          [User] => Array
> > >                (
> > >                    [0] => Array
> > >                        (
> > >                            [id] => 4ca3183d
> > >                            [BooksUser] => Array
> > >                                (
> > >                                    [id] => 4ca75919
> > >                                )
>
> > >                        )
> > >  );
>
> > > This return me what I need, but there is even [User] information.
> > > Inside this array there will be all users that own that book, this
> > > will mean a lot of unuseful information and a lot of unuseful load.
> > > How can I unbind it?
> > > The real problem is that I need to unbind model User from User
> > > controller, I can do that? Otherwise, what can I do?
>
> > No need to unbind.
>
> > $data = $this->User->find(
> >     'first',
> >     array(
> >         'conditions' => array(
> >             'User.id' => $id
> >         ),
> >         'fields' => array('...'),
> >         'contain' => array(
> >             'Book'
> >         )
> >     )
> > );
>
> > That should get you just the Books for this User, and not all the
> > Users for each Book.
>
> > > PS: I have thing to remove [User] using PHP unset() function. In this
> > > way there will be less data send to view, but I think that simply
> > > unbinding model will increase performance?
>
> > Sure, it'd save having to fetch the extra data, allocate memory, etc.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


models: fundamental question referring to member variables

2010-10-03 Thread DerBjörn
Hi,

as a newbie to cakephp for me it looks like that 'normal' models don't
have any more common member variables, but associative arrays.

For example I have a model 'Person' with firstname, lastname, age etc.

Generally i would solve this with member variables $firstname,
$lastname and $age and their common getters and setters
setFirstname($value), getAge(), etc., but this still does have sense?
When i save a person i have to use an associative array, so with my
technique i need to create first an array ($data = array()) out of my
common member variables to pass it to model's function ->save($data)

Does it mean that the common member variables are obsolete and i
actually only have to use one member variable $data and use it then
like:

function setFirstname($value){ $this->data['firstname'] = $value;}; or
function getAge(){ return $this->data['age']; }; ?

The same when i want to make a new instance of a Person and retrieve
their variables from the database:
Does it has to look like following then?

$person = new Person();
$person->retrieve(5); // ID

and the model Person has a function retrieve($id) when i get then its
data from the database and set it to $this->data??

I hope i made me explain at least a little and you understand my
question :)
Thanks for any advice or example!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: cakephp dynamic databases.

2010-10-03 Thread Jos Gerrits
Finally figured it out.. YAAAY. (sorry, took me 3 days and the
solution was pretty obvious and nowhere to be found..).
Thanks for pointing the bootstrap thing out :) Your help was *awesome!*

Thought i'll share it since it cannot be found on the internet after
searching for 3 days.

1 Simple solution :)

*Bootstrap.php*

*App::import('Component', 'Session');
App::import('Model', 'User');
$SessionClass = new SessionComponent();
$UserClass = new User();


if($SessionClass->check('User')){
  $user = $UserClass->findById($SessionClass->read('User'));

  ConnectionManager::create(
  $name = 'user',
  $config = array('driver' => 'mysql',
  'persistent' => false,
  'host' => $user['User']['name'],
  'login' => $user['User']['dbuser'],
  'password' => $user['User']['dbpass'],
  'database' => $user['User']['dbname'])
  );
}*

Once the user session is active (User is logged in) switch to the userDb.
If needed you can still switch back. (just define the $useDbConfig in the
model for when u need either the default or the user db.)

Thanks again Dr. Loboto :)


2010/10/2 Dr. Loboto 

> You can improve your beforeFilter solution by doing it in
> bootstrap.php: request login database there and create new database
> config. In this case you can keep $useDbConfig in all models pointing
> to dynamic config and do not hit missing DB error.
>
> On Oct 1, 7:52 pm, Jos Gerrits  wrote:
> > Thats whats happening,
> >
> > i have 1 database which has the login details for the other databases.
> >
> > 2010/10/1 Jeremy Burns | Class Outfit 
> >
> >
> >
> > > Couldn't store this data in a separate database that just has log in
> > > details?
> >
> > > Jeremy Burns
> > > *Class Outfit*
> > > *
> > > *
> > > jeremybu...@classoutfit.com 
> > >http://www.classoutfit.com
> >
> > > On 30 Sep 2010, at 20:06, nithiz wrote:
> >
> > > Hi all,
> >
> > > im developing an application which has the cakephp installed on 1
> > > server and has a login system for customers to connect to their own
> > > databases.
> >
> > > Now my question is, is there an alternative for manualy entering all
> > > customers (1000+) in the database.php config file?
> >
> > > I have all my customers in a local database with all their database
> > > configurations. So my default in my database.php config in cakephp is
> > > the local database with all my customers.
> >
> > > I have done this one time before by having my app_controller do a
> > > beforeFilter() and retrieve the database configurations from my local
> > > database depending on a login + pass. (although, this caused problems
> > > every time..)
> >
> > > Thanks in advance :)
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.comFor
> > >  more options, visit this group
> > > athttp://groups.google.com/group/cake-php?hl=en
> >
> > >  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> > > others with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 with hasOne Relation

2010-10-03 Thread Raphi
Hi there,

I'm new to Cake and now I seem to have a little understanding problem.
The situation is this:

I have a UsersController and a User Model. Then there is an
editProfile() method within my UsersController. Of course I also
created a view (users/edit_profile.ctp). My problem is that I want to
have an editable automagic form on that page that is linked to the
user_profiles table.

What I did is, I added "var $hasOne = array('UserProfile');" to my
User Model. And I created a form like this:

echo $form->create('UserProfile');
echo $form->input('id');
echo $form->input('name');
echo $form->end();

Then I created a user_profile.php model file and added "var $belongsTo
= 'User';" to it. The user_profiles table has a "user_id" foreign key.

When I send the form, cake throws an error as it cannot find the
"UserProfileController". Normally this would be ok but for I want the
UsersController to do all the work it's not. What can I do? I mean, I
could create a user_profiles_controller.php to send the form and
afterwards do a redirect to the form but that wouldn't be very
fashionable.

I hope you can help me out.

Regards

Raphi

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread calzone
Ah!

Thank you!

On Oct 3, 10:49 am, Tilen Majerle  wrote:
> yes, it's true m8...i faaiil...actually u will need in all functions change
> this...
>
> i have this in AppError
>
> {{{
>
>  function error404($params)
> {
>  $this->controller->layout = "error_default";
> $this->controller->set("title_for_layout", __("Error 404", true));
>  parent::error404($params);
>
> }
> }}}
>
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/10/3 calzone 
>
>
>
> > I've tried this and it makes no difference.  The only time it makes a
> > difference is if I create actual custom error views and put them
> > inside /app/views/errors -- otherwise it just gets ignored.
>
> > On Oct 3, 2:55 am, Tilen Majerle  wrote:
> > > ok then do this in AppError
>
> > > {{{
>
> > >  function __construct($method, $messages)
> > > {
> > > parent::__construct($method, $messages);
> > >  $this->controller->layout = "layoutname";
>
> > > }
> > > }}}
>
> > > --
> > > Tilen Majerlehttp://majerle.eu
>
> > > 2010/10/3 calzone 
>
> > > > I don't want to change the layout for the whole site.  I just want to
> > > > change the layout for all errors.
>
> > > > On Oct 3, 2:46 am, Tilen Majerle  wrote:
> > > > > u can set it in AppController
>
> > > > > {{{
>
> > > > > function __construct()
> > > > > {
> > > > >    parent::__construct();
>
> > > > >    $this->layout = "yourlayout";
>
> > > > > }
> > > > > }}}
>
> > > > > --
> > > > > Tilen Majerlehttp://majerle.eu
>
> > > > > 2010/10/3 calzone 
>
> > > > > > I would like all cakeErrors to use the same layout, and I want that
> > > > > > layout to be something other than the default layout.
>
> > > > > > The only way I could see to accomplish this required creating app/
> > > > > > app_error.php and then rewriting every single error function and
> > every
> > > > > > single error.ctp file and being sure to set the layout for each.
>
> > > > > > Is there a DRYer way to accomplish this?
>
> > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > > others
> > > > > > with their CakePHP related questions.
>
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "CakePHP" group.
> > > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com > > > > >  om>
> > 
> > > > For more options, visit this
> > > > group at
> > > > > >http://groups.google.com/group/cake-php?hl=en
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>
> > For more options, visit this
> > group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread Tilen Majerle
yes, it's true m8...i faaiil...actually u will need in all functions change
this...

i have this in AppError

{{{

 function error404($params)
{
 $this->controller->layout = "error_default";
$this->controller->set("title_for_layout", __("Error 404", true));
 parent::error404($params);
}

}}}
--
Tilen Majerle
http://majerle.eu



2010/10/3 calzone 

> I've tried this and it makes no difference.  The only time it makes a
> difference is if I create actual custom error views and put them
> inside /app/views/errors -- otherwise it just gets ignored.
>
>
> On Oct 3, 2:55 am, Tilen Majerle  wrote:
> > ok then do this in AppError
> >
> > {{{
> >
> >  function __construct($method, $messages)
> > {
> > parent::__construct($method, $messages);
> >  $this->controller->layout = "layoutname";
> >
> > }
> > }}}
> >
> > --
> > Tilen Majerlehttp://majerle.eu
> >
> > 2010/10/3 calzone 
> >
> >
> >
> > > I don't want to change the layout for the whole site.  I just want to
> > > change the layout for all errors.
> >
> > > On Oct 3, 2:46 am, Tilen Majerle  wrote:
> > > > u can set it in AppController
> >
> > > > {{{
> >
> > > > function __construct()
> > > > {
> > > >parent::__construct();
> >
> > > >$this->layout = "yourlayout";
> >
> > > > }
> > > > }}}
> >
> > > > --
> > > > Tilen Majerlehttp://majerle.eu
> >
> > > > 2010/10/3 calzone 
> >
> > > > > I would like all cakeErrors to use the same layout, and I want that
> > > > > layout to be something other than the default layout.
> >
> > > > > The only way I could see to accomplish this required creating app/
> > > > > app_error.php and then rewriting every single error function and
> every
> > > > > single error.ctp file and being sure to set the layout for each.
> >
> > > > > Is there a DRYer way to accomplish this?
> >
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > > with their CakePHP related questions.
> >
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com
> 
> > > For more options, visit this
> > > group at
> > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread calzone
I've tried this and it makes no difference.  The only time it makes a
difference is if I create actual custom error views and put them
inside /app/views/errors -- otherwise it just gets ignored.


On Oct 3, 2:55 am, Tilen Majerle  wrote:
> ok then do this in AppError
>
> {{{
>
>  function __construct($method, $messages)
> {
> parent::__construct($method, $messages);
>  $this->controller->layout = "layoutname";
>
> }
> }}}
>
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/10/3 calzone 
>
>
>
> > I don't want to change the layout for the whole site.  I just want to
> > change the layout for all errors.
>
> > On Oct 3, 2:46 am, Tilen Majerle  wrote:
> > > u can set it in AppController
>
> > > {{{
>
> > > function __construct()
> > > {
> > >    parent::__construct();
>
> > >    $this->layout = "yourlayout";
>
> > > }
> > > }}}
>
> > > --
> > > Tilen Majerlehttp://majerle.eu
>
> > > 2010/10/3 calzone 
>
> > > > I would like all cakeErrors to use the same layout, and I want that
> > > > layout to be something other than the default layout.
>
> > > > The only way I could see to accomplish this required creating app/
> > > > app_error.php and then rewriting every single error function and every
> > > > single error.ctp file and being sure to set the layout for each.
>
> > > > Is there a DRYer way to accomplish this?
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>
> > For more options, visit this
> > group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Change id for checkboxes

2010-10-03 Thread thomaus
Yes, good idea.

By setting the 'div' property to 11, this actually wraps the
checkboxes in a div with a class set to '11', just like this:

input('Group',
array(
'label' => 'Group',
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
'Other'),
'div' => 11)
);
?>

and then after, accessing the class of a checkbox with jQuery is as
simple as : $.id = $(this).parent().parent().attr('class');

Thanks a lot Jack.


On Oct 3, 3:19 pm, Jack Timmons  wrote:
> On Sun, Oct 3, 2010 at 8:00 AM, thomaus  wrote:
> > Hi Jack,
>
> > Thanks for your answer.
>
> > Ok then, but how do you set a class for the inputs?
>
> > If I do this :
>
> > input('Group',
> >        array(
> >        'label' => 'Group',
> >        'type' => 'select',
> >        'multiple' => 'checkbox',
> >        'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
> > 'Other'),
> >        'class' => 11)
> > );
> > ?>
>
> > this doesn't change anything at all, I mean my checkboxes they are not
> > assigned "11" as a class.
>
> > Cheers!
>
> Magic, I would guess.
>
> Likely just another thing CakePHP doesn't do.
>
> I would suggest wrapping them in a special div, giving that div a
> class, and then using that as a way to single them out. May not be
> what you're aiming for, but it'll get them job done.
>
> --
> Jack Timmons
> @_Codeacula

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 multiple domains on one app to create four seperate sites

2010-10-03 Thread Gabriel
Sorry for my previous answer. I misunderstand the question. Maybe you
could use one app and set a value with Configure in bootstrap, and
according to that value, load specifics layous, records, etc.
Even can set conditions in the models class for the model and the
relations and let cake do the "magic".

On 3 oct, 10:16, Gabriel  wrote:
> Yes, it's possible. I do that in a dreamhost's account. With a single
> user i have 2 domains with folders like this:
>
> /home/username/domain1.com (app1)
> /home/username/domain2.com (app2)
> /home/username/cake (CakePHP Core)
>
> There is no need to modify apache config o htaccess files.
>
> On 2 oct, 16:00, Jacob  wrote:
>
> > That is exactly what I thought of. But is this possible on a shared
> > webhost, because thats where the app lives? Is there way to do it
> > without changing any apache settings? Forgive my lack of knowledge
> > about Apache I am not an expert user of it.
>
> > On 1 okt, 14:42, Bernardo Vieira  wrote:
>
> > > You can use apache's namevirtualhost directive plus server aliases to 
> > > point all the domains to the same web root. After that all you have to do 
> > > is inspect the hostname in the $SERVER super global and use that to 
> > > switch the app's theme (this gives you the flexibility to have domain 
> > > specific layouts, views and elements) or just switch the layout. A good 
> > > place to deal with this is the beforefilter callback.
>
> > > On Oct 1, 2010, at 9:26 AM, Jacob  wrote:
>
> > > > Hello all,
>
> > > > I am working on a website for a company, which needs five different
> > > > websites. The five websites use the same database and mostly the same
> > > > records. For site specific records there is a 'company' column in the
> > > > table. With a parameter a function will know what records to get.
>
> > > > The current setup exists of one app on the webroot en 4 others in a
> > > > sub directory. This was the easiest way to solve the problem, but it
> > > > has a down site. As the development is in a final stage, the
> > > > controllers and views are modified a lot. For every change the other
> > > > four apps need to be changed also.
>
> > > > My question is:
> > > > Is there a way to create the illusion of five different websites while
> > > > it is actually one app? For example, based on the domainname used, the
> > > > layout changes? (that would be the best solution I think) But is it
> > > > possible en how should this be done?
>
> > > > Best regards,
>
> > > > Jacob
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Change id for checkboxes

2010-10-03 Thread Jack Timmons
On Sun, Oct 3, 2010 at 8:00 AM, thomaus  wrote:
> Hi Jack,
>
> Thanks for your answer.
>
> Ok then, but how do you set a class for the inputs?
>
> If I do this :
>
> input('Group',
>        array(
>        'label' => 'Group',
>        'type' => 'select',
>        'multiple' => 'checkbox',
>        'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
> 'Other'),
>        'class' => 11)
> );
> ?>
>
> this doesn't change anything at all, I mean my checkboxes they are not
> assigned "11" as a class.
>
> Cheers!

Magic, I would guess.

Likely just another thing CakePHP doesn't do.

I would suggest wrapping them in a special div, giving that div a
class, and then using that as a way to single them out. May not be
what you're aiming for, but it'll get them job done.

-- 
Jack Timmons
@_Codeacula

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 multiple domains on one app to create four seperate sites

2010-10-03 Thread Gabriel
Yes, it's possible. I do that in a dreamhost's account. With a single
user i have 2 domains with folders like this:

/home/username/domain1.com (app1)
/home/username/domain2.com (app2)
/home/username/cake (CakePHP Core)

There is no need to modify apache config o htaccess files.

On 2 oct, 16:00, Jacob  wrote:
> That is exactly what I thought of. But is this possible on a shared
> webhost, because thats where the app lives? Is there way to do it
> without changing any apache settings? Forgive my lack of knowledge
> about Apache I am not an expert user of it.
>
> On 1 okt, 14:42, Bernardo Vieira  wrote:
>
> > You can use apache's namevirtualhost directive plus server aliases to point 
> > all the domains to the same web root. After that all you have to do is 
> > inspect the hostname in the $SERVER super global and use that to switch the 
> > app's theme (this gives you the flexibility to have domain specific 
> > layouts, views and elements) or just switch the layout. A good place to 
> > deal with this is the beforefilter callback.
>
> > On Oct 1, 2010, at 9:26 AM, Jacob  wrote:
>
> > > Hello all,
>
> > > I am working on a website for a company, which needs five different
> > > websites. The five websites use the same database and mostly the same
> > > records. For site specific records there is a 'company' column in the
> > > table. With a parameter a function will know what records to get.
>
> > > The current setup exists of one app on the webroot en 4 others in a
> > > sub directory. This was the easiest way to solve the problem, but it
> > > has a down site. As the development is in a final stage, the
> > > controllers and views are modified a lot. For every change the other
> > > four apps need to be changed also.
>
> > > My question is:
> > > Is there a way to create the illusion of five different websites while
> > > it is actually one app? For example, based on the domainname used, the
> > > layout changes? (that would be the best solution I think) But is it
> > > possible en how should this be done?
>
> > > Best regards,
>
> > > Jacob
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Apache/ rewrite.load problem?

2010-10-03 Thread JamesScottSomers
So I have been "playing" with CakePHP for a while now, I have had some
sucesses but in the end it just doesn't work. Now one thing that does
not work, is I do not get the coloured intro screen which according to
this is a sign your Apache mod rewrite.load is not loaded.

What my question is, is there anything else that could cause this?

I am getting the incorrect homepage:

http://www.ibm.com/developerworks/opensour...1/section2.html

The next step for me is to try it on my second computer and to test
the rewrite.load on the normal web server computer.

cross-posted yesterday
http://www.cakephpforum.net/index.php?act=ST&f=2&t=2311

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Admins link not working CakePHP 1.2.6 Xampp

2010-10-03 Thread hiyatechsolutions

WE create the following table, IT seems its working for few in our
team in Wamp but not in xampp.  In Xampp the 
http://localhost/little_job/WebContent/ljs/admins
link is not working, find listed below the controller and table



CREATE TABLE IF NOT EXISTS `admins` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `username` varchar(25) NOT NULL,
 `password` varchar(150) NOT NULL,
 `created` datetime NOT NULL,
 PRIMARY KEY (`id`)
)
Admin Sql
Admin Controller :



class AdminsController extends AppController {

   var $name = 'Admins';

   var $helpers = array('Html', 'Form', 'Javascript');

   var $uses =  array('Order', 'User', 'Bookmark', 'Job', 'Admin',
'Payment', 'Affiliate', 'Message');


   Config::write('debug',2);

   function index()
   {
   $this->Admin->recursive = 0;
   $this->set('users', $this->paginate());
   }


   function view($id = null) {
   if (!$id) {
   $this->Session->setFlash(__('Invalid Admin',
true));
   $this->redirect(array('action' => 'index'));
   }
   $this->set('admin', $this->Admin->read(null, $id));
   }

   function add() {
   if (!empty($this->data)) {
   $this->Admin->create();
   if ($this->Admin->save($this->data)) {
   $this->Session->setFlash(__('The Admin
has been saved', true));
   $this->redirect(array('action' =>
'index'));
   } else {
   $this->Session->setFlash(__('The Admin
could not be saved. Please, try again.', true));
   }
   }
   }

   function edit($id = null) {
   if (!$id && empty($this->data)) {
   $this->Session->setFlash(__('Invalid Admin',
true));
   $this->redirect(array('action' => 'index'));
   }
   if (!empty($this->data)) {
   if ($this->Admin->save($this->data)) {
   $this->Session->setFlash(__('The Admin
has been saved', true));
   $this->redirect(array('action' =>
'index'));
   } else {
   $this->Session->setFlash(__('The Admin
could not be saved. Please, try again.', true));
   }
   }
   if (empty($this->data)) {
   $this->data = $this->Admin->read(null, $id);
   }
   }

   function delete($id = null) {
   if (!$id) {
   $this->Session->setFlash(__('Invalid id for
Admin', true));
   $this->redirect(array('action' => 'index'));
   }
   if ($this->Admin->del($id)) {
   $this->Session->setFlash(__('Admin deleted',
true));
   $this->redirect(array('action' => 'index'));
   }
   $this->Session->setFlash(__('The Admin could not be
deleted. Please, try again.', true));
   $this->redirect(array('action' => 'index'));
   }

}
Admin View :






counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out
of %count% total, starting on record %start%, ending on %end%', true)
));
?>


   sort('id');?>
   sort('username');?>
   sort('password');?>
   sort('created');?>
   


   >
   
   
   
   
   
   
   
   
   
   
   
   
   
   link(__('View', true),
array('action' => 'view', $admin['Admin']['id'])); ?>
   link(__('Edit', true),
array('action' => 'edit', $admin['Admin']['id'])); ?>
   link(__('Delete', true),
array('action' => 'delete', $admin['Admin']['id']), null,
sprintf(__('Are you sure you want to delete # %s?', true),
$admin['Admin']['id'])); ?>
   
   




   prev('<< '.__('previous', true),
array(), null, array('class'=>'disabled'));?>
| numbers();?>
   next(__('next', true).' >>', array(),
null, array('class' => 'disabled'));?>


   
   link(__('New Admin', true),
array('action' => 'add')); ?>
   

Admin Model :

 array('notempty'),
   'password' => array('notempty')
   );

}
?>
 Sent at 12:10 PM on Sunday


Pop-in

THANKS FOR HELP

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For m

Having problems with Cakephp 1.2.6 with Wamp Server

2010-10-03 Thread hiyatechsolutions
Anyone there know about this problem with CakePHP 1.2.6 and Wamp
server. We get a blank Page in the Admins panel even after using
"Configure::write('debug', 2);" command. Its the case in Both xampp
and wamp. All other links are working on Xampp but not in Wamp. For
our other team mates, it seems Wamp is working fine with the previous
DB versions. Any throghts or any fixes or any ideas. Need URGENT HELP
guys.

Error: The requested address “/” was not found on this server –
CakePHP Error

This error message pops out if we use any versions of Wamp, we tried
clearing Cookies and all the troubleshooting thats available in
forums. Any ideas..

Also is there any configuration differences beteen Wamp and Xampp
since our cakephp codes are working on Xampp but not in wamp. Is there
any solution to have our Code working on Wamp and Xampp ?  Thanks in
Advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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: Change id for checkboxes

2010-10-03 Thread thomaus
Hi Jack,

Thanks for your answer.

Ok then, but how do you set a class for the inputs?

If I do this :

input('Group',
array(
'label' => 'Group',
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
'Other'),
'class' => 11)
);
?>

this doesn't change anything at all, I mean my checkboxes they are not
assigned "11" as a class.

Cheers!


On Oct 2, 2:36 pm, Jack Timmons  wrote:
> On Sat, Oct 2, 2010 at 4:50 AM, thomaus  wrote:
> > So far so good right? But now I would like to have the id set to 11
> > not only for the global input tag, but for EVERY input tag, which
> > would output this :
>
> That's invalid HTML. The purpose of the ID property is to give each
> DOM element a unique name.
>
> What you're looking to do is give each of them a class. This will
> allow you to use smart selectors to pick the elements you want to
> style/manipulate.
>
> Off the top of my head, remove the ID property and instead use "class".
>
> --
> Jack Timmons
> @_Codeacula

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread Tilen Majerle
ok then do this in AppError

{{{

 function __construct($method, $messages)
{
parent::__construct($method, $messages);
 $this->controller->layout = "layoutname";
}

}}}
--
Tilen Majerle
http://majerle.eu



2010/10/3 calzone 

> I don't want to change the layout for the whole site.  I just want to
> change the layout for all errors.
>
> On Oct 3, 2:46 am, Tilen Majerle  wrote:
> > u can set it in AppController
> >
> > {{{
> >
> > function __construct()
> > {
> >parent::__construct();
> >
> >$this->layout = "yourlayout";
> >
> > }
> > }}}
> >
> > --
> > Tilen Majerlehttp://majerle.eu
> >
> > 2010/10/3 calzone 
> >
> >
> >
> > > I would like all cakeErrors to use the same layout, and I want that
> > > layout to be something other than the default layout.
> >
> > > The only way I could see to accomplish this required creating app/
> > > app_error.php and then rewriting every single error function and every
> > > single error.ctp file and being sure to set the layout for each.
> >
> > > Is there a DRYer way to accomplish this?
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread calzone
I don't want to change the layout for the whole site.  I just want to
change the layout for all errors.

On Oct 3, 2:46 am, Tilen Majerle  wrote:
> u can set it in AppController
>
> {{{
>
> function __construct()
> {
>    parent::__construct();
>
>    $this->layout = "yourlayout";
>
> }
> }}}
>
> --
> Tilen Majerlehttp://majerle.eu
>
> 2010/10/3 calzone 
>
>
>
> > I would like all cakeErrors to use the same layout, and I want that
> > layout to be something other than the default layout.
>
> > The only way I could see to accomplish this required creating app/
> > app_error.php and then rewriting every single error function and every
> > single error.ctp file and being sure to set the layout for each.
>
> > Is there a DRYer way to accomplish this?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com > om>For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Model based ACL simply doesn't work

2010-10-03 Thread calzone
How many years has cake been advertising ACL as the cat's pajamas now?

Year after year I try using ACL in some useful fashion only to come up
dry every single time.  This time I thought for sure it was going to
sparkle.  The grand tutorial and the new 1.3 version of cake had me
quite optimistic.

Well it works for controllers and actions but not for models.  Whole
lot of good that is.  There is no way now to use ACL to ensure that a
person from group B doesn't modify a record belonging to group A or
see a record that they shouldn't see.  Why do I say this?  Because I
have acl running on an installation right now and I can see plain as
day in the cake query list at the bottom of every page that it's
looking for controllers, not models.  I even put $this->Auth-
>authorize = 'crud'; in there, which surprise surprise is NOT
DOCUMENTED on the 1.3 docs for ACL.  Maybe it's deprecated from 1.2?
Well if so, how the hell do I invoke CRUD mode  Because with or
without it, ACL insists on looking for controllers and actions.

So, it's back to coding a check for that by hand in every action in
every controller.   And don't even get me started on the multi-
dimensional inabilities Cake's ACL has suffered from since day 1.  I
tried filing a bug for this way back in the day and it got rejected as
working the way it should.

Someone over there obviously doesn't get that people often work in
more than one group and that ACOs may also belong to more than one
group.  The very RAISON DE ETRE for ACL is to be able to have that
kind of infinitely extensible  multi-dimensional hierarchical goodness
and it continues to  fail at delivering on that promise.  Oh, sorry,
it's not actually a promise because "it's working the way it should."

The limitations of ACL need to be documented far more than anything
else.  Right now it's being sold as a panacea that if you only spend
enough time working with, eventually you get it working for you and
the world of permissions is your Oyster.  But that's not the case.

And what's the point of defining CRUD controls on actions anyway?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, 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 a layout for all cakeErrors

2010-10-03 Thread Tilen Majerle
u can set it in AppController

{{{

function __construct()
{
   parent::__construct();

   $this->layout = "yourlayout";
}

}}}

--
Tilen Majerle
http://majerle.eu



2010/10/3 calzone 

> I would like all cakeErrors to use the same layout, and I want that
> layout to be something other than the default layout.
>
> The only way I could see to accomplish this required creating app/
> app_error.php and then rewriting every single error function and every
> single error.ctp file and being sure to set the layout for each.
>
> Is there a DRYer way to accomplish this?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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