Template-Directed Photochemical Homodimerization and Heterodimerization Reactions of Cinnamic Acids.