The correct solution is not to make calls to a third-party component from a component template (here such here a tautology).
Can try to use delay functions (
CMain::ShowViewContent and
CComponentTemplate::SetViewTarget):
https://dev.1c-bitrix.ru/api_help/main/reference/c...