Skip to content

Commit 77e9e20

Browse files
authored
Add files via upload
1 parent cd1ebf1 commit 77e9e20

File tree

1 file changed

+26
-40
lines changed

1 file changed

+26
-40
lines changed

blog.php

+26-40
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<div class="col-lg-12 text-center">
4545
<div class="normal__breadcrumb__text">
4646
<h2>Our Blog</h2>
47-
<p>Welcome to the official Anime blog.</p>
47+
<p>Welcome to the official Anime blog.</p>
4848
</div>
4949
</div>
5050
</div>
@@ -78,15 +78,31 @@
7878
// Open the row div
7979
echo '<div class="row">';
8080

81-
// Open the col-lg-6 div
82-
echo '<div class="col-lg-6">';
83-
84-
// Open the row div
85-
echo '<div class="row">';
86-
87-
// Loop through the first set of blogs and display them
88-
foreach (array_slice($blogs, 0, 4) as $blog) {
89-
echo '<div class="col-lg-12">
81+
// Initialize a counter to track the remainder
82+
$counter = 0;
83+
84+
// Loop through the blogs and display them
85+
foreach ($blogs as $blog) {
86+
87+
// Increment the counter
88+
$counter++;
89+
90+
// Determine the CSS class for the blog item based on the remainder
91+
$css_class = '';
92+
switch ($counter % 8) {
93+
case 0:
94+
$css_class = 'col-lg-12';
95+
break;
96+
case 1:
97+
case 2:
98+
case 3:
99+
case 4:
100+
$css_class = 'col-md-6 col-sm-6';
101+
break;
102+
}
103+
104+
// Echo the blog item
105+
echo '<div class="' . $css_class . '">
90106
<div class="blog__item set-bg" data-setbg="' . $blog['banner'] . '">
91107
<div class="blog__item__text">
92108
<p><span class="icon_calendar"></span>' . date('jS F Y', strtotime($blog['time'])) . '</p>
@@ -99,36 +115,6 @@
99115
// Close the row div
100116
echo '</div>';
101117

102-
// Close the col-lg-6 div
103-
echo '</div>';
104-
105-
// Open the col-lg-6 div
106-
echo '<div class="col-lg-6">';
107-
108-
// Open the row div
109-
echo '<div class="row">';
110-
111-
// Loop through the second set of blogs and display them
112-
foreach (array_slice($blogs, 4, 4) as $blog) {
113-
echo '<div class="col-lg-6 col-md-6 col-sm-6">
114-
<div class="blog__item small__item set-bg" data-setbg="' . $blog['banner'] . '">
115-
<div class="blog__item__text">
116-
<p><span class="icon_calendar"></span>' . date('jS F Y', strtotime($blog['time'])) . '</p>
117-
<h4><a href="blog/index.php?id=' . $blog['blog-id'] . '">' . $blog['title'] . '</a></h4>
118-
</div>
119-
</div>
120-
</div>';
121-
}
122-
123-
// Close the row div
124-
echo '</div>';
125-
126-
// Close the col-lg-6 div
127-
echo '</div>';
128-
129-
// Close the row div
130-
echo '</div>';
131-
132118
// Close the container div
133119
echo '</div>';
134120

0 commit comments

Comments
 (0)