In your php file you can write following and pass it to tpl.
{file_name}.php
$this->context->smarty->assign(array(
'is_mobile' => Context::getContext()->isMobile(),
'device_type' => Context::getContext()->getDevice(),
));
----------------------------------------------------
In your tpl file you can use it like this.
{file_name}.tpl
{if isset($is_mobile) && $is_mobile == 1}
<div class="for_mobile">MOBILE</div>
{else}
<div class="for_other_devices">---</div>
{/if}
NOTE: getDevice() returns 1,2,4 for device types
const DEVICE_COMPUTER = 1;
const DEVICE_TABLET = 2;
const DEVICE_MOBILE = 4;