Aside from one occasion of Mercenary Hoplites first trying to shuffle through a building to their right and then getting butchered by enemy cavalry in a city battle, I've never noticed the infamous Phalanx Shuffle.

Maybe it's just because I keep the guard mode off.

Anyway, I've found it best to form all but two of the phalanx units into a single, solid line and march that close to the enemy line. Once I'm suitably close (about one screen-width, just to be safe) I put on the phalanx mode. These can then be crept within spitting range of the enemy and pointed at suitable targets - the fact that the enemy likes to run its units back and forth tends to get them a little confused and tangled up in each other, but all those spearheads normally maim everything readily enough.

But then, I'm not touching VH battle difficulty...

Oh, those two leftover phalanxes ? They're kept a little bit behind and to the side of the outermost units in the line as flank guards, just because the cavalry is often busy elsewhere and the skirmishers sort of lack staying power in a fight. They're a good enough reserve to throw at any trouble spots, too.