Well, I've found that with phalanx heavy armies, it's often better to abandon the walls completely, and have your phalanxes set up in the town centre or at intervening choke points. The enemy that makes it passed all your tower arrows generally beats itself to death on your wall of pointy things. If you have archers, keep them on the walls until the siege towers reach, then have them run behind your phalanxes (remembering of course to take off fire at will before hand...)
I did wonder in a post last year whether this was a cheesy tactic or not, but I was advised that I'd stumbled onto the joys of guerrilla urban warfare. So that's alright then.