PHP in TPL file?
Design and Skin Customization
You might try using the literal tags to wrap the php code in...
{literal}
PHP Code Here...
{/literal}{literal}
PHP Code Here...
{/literal}{$item.gallery_image_time|jrCore_format_time:false:"%F"}{if $_profile_id == X}
{jrProfile_disable_sidebar}
{/if}background:#FFFFFF url("{$mgMySlate_img_url}/menu-bg.png");