This is a difficult question to answer without knowing which ruleset you're referring to. Irrespective of that, almost all fouls (personal, technical, intentional, flagrant) count towards the team foul count. The ones that don't shoot FTs, in general, are player and team control fouls, while some indirect technicals do not count towards the team foul count.
With Greg's edit, I've edited my post, too.