For turning of caching in a given template, see here: http://www.ez.no/developer/ez_publish_3/documentation/incoming/how_to_set_cache_expire_time_or_disable_cache_in_template
But I think, your problem is easier: Close the cache-block, that probably starts your pagelayout.tpl, before your if-else-section starts. See here: http://www.ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/functions/function_list
As the admin siteaccess is known to work well ;), you can examine the admin's pagelayout and look out for "cache-block" diretives there.