Okay, in /index.php of roundcube, at the very bottom there is this:
$OUTPUT->send($_task);
Depending upon the task, that does the work for the templating. Now, if you go up to line 241 or so, you should see this:
// not logged in -> show login page
if (!$_SESSION['user_id'])
{
$OUTPUT->task = 'login';
$OUTPUT->send('login');
exit;
}
So now I can say: the $OUTPUT object has a "send" method that is using the parameter "login" to include the "login.html" template file and parse it. So now let's track down where $OUTPUT is instantiated. I know that the "include/main.inc" file has a function rcmail_load_gui(). So if I look in there, I see this:
$OUTPUT = new rcmail_template($CONFIG, $GLOBALS['_task']);
Okay, so now we need to look at rcmail_template() to see how it deals with the "login" task.
So we open up include/rcmail_template.inc and see that $OUTPUT::send('login') forwards the work on to $OUTPUT::parse('login') which is where you see this:
function parse($name='main', $exit=true)
{
$skin_path = $this->config['skin_path'];
// read template file
$templ = '';
$path = "$skin_path/templates/$name.html";
So you'll have to add a conditional to test if $name is "login" or not. Something like this should work:
$skin_path = $this->config['skin_path'];
$ext = 'html';
if($name == 'login')
$ext = 'php';
// read template file
$templ = '';
$path = "$skin_path/templates/$name.$ext";
That should get you what you need for your second question. I'm still baffled by your first question though. Why on earth are you doing it this way? What is your goal? To wrap the login page into your site? The login page redirects to itself, so if you just wrap it, then you'll only be wrapping the login page, and the rest of the interface will be roundcube. If you're going to "skin" your site, then do that instead.