vendredi 26 février 2016

Echo divs inside Foreach loop

Im developing a web page which contains a posting section. I have an Array called $posts which contains Title, body, date, and name of the image from the post (rows come from a data base). This array is filled with all postings in the page, and when I use a foreach I want to echo these variables inside this block of code when running a foreache:

<div class="col-lg-12 text-center">
   <img class="img-responsive img-border img-full" src="../img/NAME.jpg" alt="">
     <h2>TITLE
        <br>
        <small>DATE</small>
          </h2>
          <p>BODY</p>
           <a href="#" class="btn btn-default btn-lg">Button</a>
           <hr>
</div>

This is the structure of the array:

$post= [
    "title",
    "date",
    "body",
    "name"
];




Aucun commentaire:

Enregistrer un commentaire