DS1 was prone to constipation and my golden rules were (and I'm very aware this sounds a bit preachy):
No junk drinks of any sort. Milk, water or diluted pure fruit juice.
Absolutlely no white bread or processed food (biscuits,baked beans fine, but none of that smiley face, nugget, pizza crap).
Pasta (white OK) ALWAYS served with veg or a home-made tomato sauce.
Snack times always started with sliced fruit, biscuit if he's still hungry. If he turns his nose up at fruit, then it's nothing.
On a w/e, however, where we tend to have pretty junky snacks, it still leaves poor DS with a rock hard poo on Sunday, but he seems to pop it out with no bother .
Constipation in kids is too little fluid, too much junk.