Dual templating fabrication of hierarchical porous three-dimensional ZnO/carbon nanocomposites for enhanced photocatalytic and photoelectrochemical activity