Added boolean argument to loadTemplate to decide if the template was loaded by index.php or not