Load different layout for a module

Hi, I have a problem applying layout for a module.

I’ve created a module ymonline, for example. How to applies different layout for it, so when a visitor came, it applies layout of main.php and when administrator came/login it applies layout of admin.php?

Maybe, as in Joomla that has two layouts which are backoffice and FrontOffice.

Any suggestion is appreciated…Thank you! :)

this question has been discussed a couple of times, so what about using search of this forum?

in short, its possible to define a layout for modules.

in your AdminModule.php init()->method you can write:

$this->layout = 'admin';