Is there a way to know the type of output inside a template file?
I think you're looking for the $theme_key global, which gives you the:


  Name of the active theme.


You can use it like so:

global $theme_key;
if ($theme_key == 'mobile_theme') {
  // ...
}
else {
  // ...
}