I have this function in my HTML body:
<ul>
<!-- Dynamic insertion of projects with PHP function -->
<?php projectGallery(); ?>
</ul>
And this is the PHP function itself:
// This function shows a list of projects on our home page
function projectGallery(){
include 'includes/config.php';
$result = mysqli_query($con,"SELECT * FROM project");
while($row = mysqli_fetch_array($result)) {
echo "<li>
<a href='#' data-reveal-id='".$row['project_id']."' data-animation='fade'>
<div class='project'>
<img class='project_image' src='images/upload/".$row['project_afbeelding']. "' />
<h2 class='title'>".$row['project_titel']."</h2>
</div>
</a>
</li>" ;
};
};
Well, if you're still reading despite the ugliness... My question is, would there be a cleaner way to write this echo part? Without the endless HTML string.