Controlled synthesis of ZnO nanowires towards the fabrication of solar cells