Can't get the items to line up by each other PHP *? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't get the items to line up by each other PHP *?

so my code looks like this <?php //this says for each item in the ($articles class refer to it as an $article so that single item in the class can be used.) foreach ($articles as $article) //then the brackets will tell you what will happen think of php as living outside of html so a break in the brackets is fine and newly opened php in these brackets will act as it was never broken. { ?> <div class="row"> <div class="col-md-4"> <!-- Single Blog item --> <div class="post-slide"> <div class="post-img"> <a href="article.php?id=<?= $article['article_id']; ?>"><img src="assets/images/blog/dummy-image.jpg" alt=""></a> </div> <div class="post-content"> <div class="post-date"> <span class="month"><?= date('M', $article['article_timestamp']); ?></span> <span class="date"><?= date('jS', $article['article_timestamp']); ?></span> </div> <h5 class="post-title"><a <a href="article.php?id=<?= $article['article_id']; ?>"><?= $article['article_title']; ?></a></h5> <p class="post-description"> <?= $article['article_description']; ?> </p> <a class="read-more" href="article.php?id=<?= $article['article_id']; ?>">Read More</a> </div> <ul class="post-bar"> <li> <i class="fa fa-users"></i> <?= $article['article_user']; ?> </li> </ul> </div> </div> <?php //where the brackets ends. } ?> basically it isn't lining up like it would if it were just simple html i.e. <div class="col-md-4">

17th Oct 2018, 2:03 AM
D'Mairis Edwards
D'Mairis Edwards - avatar
2 Answers
+ 1
Its not you php fault, you have added row class inside loop, try to use it outside loop and see the output
17th Oct 2018, 5:53 AM
Raziul Islam
Raziul Islam - avatar
0
yeah that fixed it i didn't even notice
18th Oct 2018, 7:55 PM
D'Mairis Edwards
D'Mairis Edwards - avatar