Re: dynamically setting the $useTable

2007-05-23 Thread gwoo

setSource


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



Re: dynamically setting the $useTable

2007-05-23 Thread Anton Morrison
thanks

the reason is i have a content model and have two tables for english  
content and one for spanish content, then depending on what language  
the user is viewing in i thought i could swap the table over rather  
than have two controllers. This also makes adding a new language just  
adding a new table.

thanks again


On 23 May 2007, at 14:04, grigri wrote:

>
> Why do you need to do that?
>
> Anyway, assuming you have a reason, the best place to set it would be
> the constructor of the model:
>
> class SillyTest extends AppModel {
>   var $name = "SillyTest";
>   var $useTable = 'dummy';
>
>   function __construct() {
> if (mt_rand(0, 100) < 30) {
>   $this->useTable = 'other_table';
> }
>   }
>   parent::__construct();
> }
>
> Hope this helps!
>
> On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote:
>> Hi I am wondering if anyone can help me find a way to set the
>> $useTable dynamically.
>>
>> I want to set it depending on a Session variable.
>>
>> thanks
>
>
> >

Anton Morrison
[EMAIL PROTECTED]




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



Re: dynamically setting the $useTable

2007-05-23 Thread grigri

Why do you need to do that?

Anyway, assuming you have a reason, the best place to set it would be
the constructor of the model:

class SillyTest extends AppModel {
  var $name = "SillyTest";
  var $useTable = 'dummy';

  function __construct() {
if (mt_rand(0, 100) < 30) {
  $this->useTable = 'other_table';
}
  }
  parent::__construct();
}

Hope this helps!

On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote:
> Hi I am wondering if anyone can help me find a way to set the
> $useTable dynamically.
>
> I want to set it depending on a Session variable.
>
> thanks


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



Re: dynamically setting the $useTable

2007-05-23 Thread grigri

Why do you need to do that?

Anyway, assuming you have a reason, the best place to set it would be
the constructor of the model:

class SillyTest extends AppModel {
  var $name = "SillyTest";
  var $useTable = 'dummy';

  function __construct() {
if (mt_rand(0, 100) < 30) {
  $this->useTable = 'other_table';
}
  }
  parent::__construct();
}

Hope this helps!

On May 23, 9:19 am, Anton Morrison <[EMAIL PROTECTED]> wrote:
> Hi I am wondering if anyone can help me find a way to set the
> $useTable dynamically.
>
> I want to set it depending on a Session variable.
>
> thanks


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



dynamically setting the $useTable

2007-05-23 Thread Anton Morrison

Hi I am wondering if anyone can help me find a way to set the  
$useTable dynamically.

I want to set it depending on a Session variable.

thanks




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