|
44 | 44 | <div class="col-lg-12 text-center">
|
45 | 45 | <div class="normal__breadcrumb__text">
|
46 | 46 | <h2>Our Blog</h2>
|
47 |
| - <p>Welcome to the official Anime blog.</p> |
| 47 | + <p>Welcome to the official Anime blog.</p> |
48 | 48 | </div>
|
49 | 49 | </div>
|
50 | 50 | </div>
|
|
78 | 78 | // Open the row div
|
79 | 79 | echo '<div class="row">';
|
80 | 80 |
|
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 . '"> |
90 | 106 | <div class="blog__item set-bg" data-setbg="' . $blog['banner'] . '">
|
91 | 107 | <div class="blog__item__text">
|
92 | 108 | <p><span class="icon_calendar"></span>' . date('jS F Y', strtotime($blog['time'])) . '</p>
|
|
99 | 115 | // Close the row div
|
100 | 116 | echo '</div>';
|
101 | 117 |
|
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 |
| - |
132 | 118 | // Close the container div
|
133 | 119 | echo '</div>';
|
134 | 120 |
|
|
0 commit comments