<?php foreach($medias as $media):
if (strpos($media->type, 'image') !== false) { ?>
<article>
<a href="mediapage.php?id=<?php echo $media->id; ?>">
<img src="<?php echo $media->image_path(); ?>" width="200" />
</a>
<hgroup>
<h3><?php echo $media->caption; ?></h3>
</hgroup>
<p><?php echo $media->caption; ?></p>
</article>
<?php } else { ?>
<article>
<video controls>
<source src="<?php echo $media->image_path(); ?>">
Your browser does not support HTML5 video.
</video>
<hgroup>
<h3><?php echo $media->caption; ?></h3>
</hgroup>
MY code works fine as a php file. The problem is I need it to work when I retrieve it from mysql. The php code works fine on its own and when in between tags. My problem is the code inside an opening tag like the a href and the img src. How do I get the php to turn on and off inside these tags? Also the code won't call the object attribute, it turns off.