Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Help.., cara membuat looping
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2>Portfolio</h2>
<p>Check out our beautifull portfolio</p>
</div>
<div class="row" data-aos="fade-up" data-aos-delay="100">
<div class="col-lg-12">
<ul id="portfolio-flters">
<li data-filter="*" class="filter-active">All</li>
<li data-filter=".filter-app">App</li>
<li data-filter=".filter-card">Card</li>
<li data-filter=".filter-web">Web</li>
</ul>
</div>
</div>
<div class="row portfolio-container" data-aos="fade-up" data-aos-delay="200">
<!-- <div class="col-lg-4 col-md-6 portfolio-item filter-app">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-1.jpg" class="img-fluid" alt="">
<div class="portfolio-links">
<a href="assets/img/portfolio/portfolio-1.jpg" data-gallery="portfolioGallery" class="portfolio-lightbox" title="App 1"><i class="bi bi-plus"></i></a>
<a href="portfolio-details.html" title="More Details"><i class="bi bi-link"></i></a>
</div>
<div class="portfolio-info">
<h4>App 1</h4>
<p>App</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-card">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-8.jpg" class="img-fluid" alt="">
<div class="portfolio-links">
<a href="assets/img/portfolio/portfolio-8.jpg" data-gallery="portfolioGallery" class="portfolio-lightbox" title="Card 3"><i class="bi bi-plus"></i></a>
<a href="portfolio-details.html" title="More Details"><i class="bi bi-link"></i></a>
</div>
<div class="portfolio-info">
<h4>Card 3</h4>
<p>Card</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-web">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-9.jpg" class="img-fluid" alt="">
<div class="portfolio-links">
<a href="assets/img/portfolio/portfolio-9.jpg" data-gallery="portfolioGallery" class="portfolio-lightbox" title="Web 3"><i class="bi bi-plus"></i></a>
<a href="portfolio-details.html" title="More Details"><i class="bi bi-link"></i></a>
</div>
<div class="portfolio-info">
<h4>Web 3</h4>
<p>Web</p>
</div>
</div>
</div>
</div>
</div>
Tanggapan
Pertanyaan kamu tidak jelas, coba dijelaskan lebih baik
membuat looping pada gambar yang ada di dalam div pak
1 Jawaban:
<div>masalahnya disini, kamu tidak memberitahu array yang ingin di looping,, jadi kami tidak tahu musti apa yang di looping, dan harus menggunakan apa,, (while, for, atau yang lainnya)<br>misal aja kita punya array data portfolio,, maka, mungkin bisa dibuat seperti ini</div><pre><?php // Data portfolio dalam bentuk array $portfolio = array( array( 'filter' => 'filter-app', 'image' => 'assets/img/portfolio/portfolio-1.jpg', 'title' => 'App 1', 'category' => 'App' ), array( 'filter' => 'filter-card', 'image' => 'assets/img/portfolio/portfolio-8.jpg', 'title' => 'Card 3', 'category' => 'Card' ), array( 'filter' => 'filter-web', 'image' => 'assets/img/portfolio/portfolio-9.jpg', 'title' => 'Web 3', 'category' => 'Web' ) );
// Looping portfolio foreach ($portfolio as $item) { echo '<div class="col-lg-4 col-md-6 portfolio-item ' . $item['filter'] . '">'; echo '<div class="portfolio-wrap">'; echo '<img src="' . $item['image'] . '" class="img-fluid" alt="">'; echo '<div class="portfolio-links">'; echo '<a href="' . $item['image'] . '" data-gallery="portfolioGallery" class="portfolio-lightbox" title="' . $item['title'] . '"><i class="bi bi-plus"></i></a>'; echo '<a href="portfolio-details.html" title="More Details"><i class="bi bi-link"></i></a>'; echo '</div>'; echo '<div class="portfolio-info">'; echo '<h4>' . $item['title'] . '</h4>'; echo '<p>' . $item['category'] . '</p>'; echo '</div>'; echo '</div>'; echo '</div>'; } ?> <br></pre><div><br><br></div>
Tanggapan
Terima Kasih Pak