I should also probably mention that I'm using version 1.1.19.6305

On Nov 13, 11:33 am, shizWinkle <[EMAIL PROTECTED]> wrote:
> Hey Guys,
>     Having a small issue with Cake here, and rapidly reducing the
> amount of hair on my head to almost none, and no amount of google
> searches is giving me any love.
>
> Basically, what I want to do, is if a session variable is set, to set
> the data source to 'admin', otherwise, leave it as 'default'.
>
> So, what have I got so far?
>
> ===============================================
> app_model.php
> ---------------------------------
>
> function setDS($ds) {
>         $this->setDataSource($ds);
>
> }
>
> app_controller.php
> ----------------------------------
>
> function beforeFilter() {
>         // if admin pages are being requested
>         if(isset($this->params['admin'])) {
>                 AppModel::setDS('listings');
>         }
>         return true;
>
> }
>
> ===============================================
>
> Now, this gives me an error of Fatal error: Call to undefined method
> SomeController::setDataSource()
>
> While, what I would really like to do is:
>
> ===============================================
> app_model.php
> ---------------------------------
>
>  function __construct($id=false, $table=null, $ds=null) {
>         parent::__construct($id, $table, $ds);
>         if(isset($_SESSION['admin_user_id'])) $this->setDataSource
> ('admin');
>
> }
>
> ===============================================
>
> Which would work, but $_SESSION is not being recognised at this point
> (removing isset() and doing say $_SESSION['admin_user_id']
> =='admin_user', gives the error "Notice:  Undefined variable:
> _SESSION")
>
> Does anyone have any idea what is going on/what I'm doing wrong/or a
> better way for me to do this.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to