PHP Echo with html, escapes and variables included

This is a good example of a php echo used to output some html which makes use of some variables – some escapes were also required for the html.

<?php
	include(TEMPLATEPATH."/insert-variables.php");
	$eventdate = date("l jS of F Y", get_post_meta($post->ID, 'date_value', true)); if ( $eventdate ) { echo "Event Date: $eventdate<br />"; }
	$eventtime = get_post_meta($post->ID, 'eventtime_value', true); if ( $eventtime ) { echo "Start Time: $eventtime <br />"; }
	$eventvenue = get_post_meta($post->ID, 'eventvenue_value', true); if ( $eventvenue ) { echo "Venue: $eventvenue <br />"; }
	$eventaddress = get_post_meta($post->ID, 'eventaddress_value', true); if ( $eventaddress ) { echo "Address: $eventaddress <br />"; }
	$bookingQuery = get_post_meta($post->ID, 'orderbydate_value', true); if ($bookingQuery > $todaysDate) { echo "<a href="$eventbookings">Click her to book for this event.</a><br />"; }
?>

Revisions

There are no revisions for this post.

Tags: , , ,

No comments yet.

Leave a Reply