Ah but what do you do if the enemy army has phalangites, archers/slingers and cavalry?

(well i suppose the obvious answer is you try to use light cavalry to draw out their cavalry and destroy them, then try to separate the archers/slingers from the phalanxes and wipe them out, then get round the phalanxes' backs/sides and hit them with javelins, slingshot etc)