Else If While PHP Statements

This code is not functioning properly and I would like some assistance resolving it. The format seems correct even though some html is commented out.

Thanks in advance for insight!

[php]

<?php get_header(); ?> <?php //gets the data from a URL function get_tiny_url($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?>
<?php if ( have_posts() ) : ?>

	<?php while ( have_posts() ) : the_post(); ?>

		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">

			<div class="entry">
				<h1>Live Theater : Coming Events</h1>
				
				<?php the_content(); ?>
				<!--<p style="padding: 20px; color: #fff; font-weight: bold;">Our website is under maintenance, presently. Please click on the calendar link to see upcoming events and to purchase tickets.</p>-->		
				<ul id="upcoming-events">
					
					<?php

					$xml = 'http://secure.franklintheatre.com/websales/feed.ashx?guid=12f03090-740d-429b-a093-73b1f3960f83&&showslist=true';
					
					$events = new AgileFeed();
					$eventsxml = $events->loadXML($xml);
					$eventslist = $events->createArray($eventsxml);
					$eventgroup = $events->groupArray($eventslist);

					for ( $i = 0; $i < count($eventgroup); $i++ ) {
						?>
						<li class="event">
							<img class="event-thumbnail" src="<?php echo $eventgroup[$i]['tinythumb']; ?>" alt="<?php echo $eventgroup[$i]['title']; ?> thumbnail" class="alignleft" \>
							<div class="event-title"><strong><?php echo $eventgroup[$i]['title']; ?></strong></div>
							<div class="event-date">Opens <?php echo date('F j, Y', strtotime($eventgroup[$i]['open'])); ?></div>
							<p class="event-desc"><?php echo truncate($eventgroup[$i]['desc'], 150); ?></p>
							<div class="event-share">						
								<strong>Share it!</strong><br />
								<a href="http://www.facebook.com/sharer.php?u=<?php echo get_tiny_url($eventgroup[$i]['link'][0]); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/share-facebook.png" alt="Facebook icon" /></a>
								<a href="http://twitter.com/home?status=<?php echo $eventgroup[$i]['title']; ?> at Franklin Theatre | <?php echo get_tiny_url($eventgroup[$i]['link'][0]); ?>" title="Click to share this post on Twitter" blank="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/share-twitter.png" alt="Twitter icon" /></a>
								<a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/share-email.png" alt="Email icon" /></a>
							</div>
							<div class="event-more-link">
								<a href="<?php echo $eventgroup[$i]['link'][0]; ?>" class="event-more-info"><strong>More Info</strong></a>
							</div>
							<div class="clearfix"></div>
						</li>
						<?php
					}

					?>

						<!--<li class="event">
							<img style="width:138px;height:138px;" src="http://secure.franklintheatre.com/images/user/FT_11874/studio%20tenn_thumb.jpg" class="alignleft" />
							<div class="event-title"><strong>Studio Tenn Season<br />Package 2013-2014</strong></div>
							<p class="event-desc"><?php echo truncate($eventgroup[$i]['desc'], 150); ?></p>
							<div class="event-share">						
								<strong>Share it!</strong><br />
								<a href="http://www.facebook.com/sharer.php?u=<?php echo get_tiny_url($eventgroup[$i]['link'][0]); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/share-facebook.png" alt="Facebook icon" /></a>
								<a href="http://twitter.com/home?status=Studio Tenn Season at Franklin Theatre" title="Click to share this post on Twitter" blank="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/share-twitter.png" alt="Twitter icon" /></a>
								<a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/share-email.png" alt="Email icon" /></a>
							</div>
							<div class="event-more-link">
								<a href="http://secure.franklintheatre.com/websales/pages/EntryPoint.aspx?guid=06cb0fd9-1d61-47d7-89c5-e19c68c9eadf&" class="event-more-info"><strong>More Info</strong></a>
							</div>
							<div class="clearfix"></div>
						</li>-->

										
				</ul>
				
				
			</div>

		</div>

	<?php endwhile; ?>

<?php else : ?>

	<h2>Error</h2>
	<p>Sorry, but you are looking for something that isn't here.</p>

<?php endif; ?>
<?php get_sidebar(); ?> <?php get_footer(); ?>

[/php]

How is it not functioning properly? Do you get any errors?

Sponsor our Newsletter | Privacy Policy | Terms of Service