-
Notifications
You must be signed in to change notification settings - Fork 4
/
slider.php
78 lines (76 loc) · 3.25 KB
/
slider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
$sqlSlider = 'SELECT
berita.id_berita,
berita.judul,
berita.gambar,
berita.teks_berita
FROM
berita
ORDER BY
berita.tgl_posting DESC
LIMIT 0, 4';
$qrySlider = $mysqli->query($sqlSlider) or die($mysqli->error);
$qrySliderNav = $mysqli->query($sqlSlider) or die($mysqli->error);
$counter_slider = 0;
$num = 0;
?>
<div class="slider">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<?php while ($slider_item = $qrySlider->fetch_array()) { ?>
<?php if ($counter_slider == 0) { ?>
<div class="item active">
<img src="<?php echo $base_url."images/".$slider_item['gambar']; ?>" class="wow fadeIn">
<div class="carousel-caption">
<h4>
<a href="<?php echo $base_url."detail.php?id=".$slider_item['id_berita']."&judul=".
strtolower(str_replace(' ', '-', $slider_item['judul'])); ?>">
<?php echo $slider_item['judul']; ?>
</a>
</h4>
<?php echo substr($slider_item['teks_berita'], 0,200); ?>...
</div>
</div><!-- End Item -->
<?php } else { ?>
<div class="item">
<img src="<?php echo $base_url."images/".$slider_item['gambar']; ?>" class="wow fadeIn">
<div class="carousel-caption">
<h4>
<a href="<?php echo $base_url."detail.php?id=".$slider_item['id_berita']."&judul=".
strtolower(str_replace(' ', '-', $slider_item['judul'])); ?>">
<?php echo $slider_item['judul']; ?>
</a>
</h4>
<?php echo substr($slider_item['teks_berita'], 0,200); ?>...
</div>
</div><!-- End Item -->
<?php } ?>
<?php $counter_slider++; ?>
<?php } ?>
</div><!-- End Carousel Inner -->
<ul class="list-group col-md-4">
<?php while ($slider_nav = $qrySliderNav->fetch_array()) { ?>
<?php if ($num==0) { ?>
<li data-target="#myCarousel" data-slide-to="<?php echo $num; ?>" class="list-group-item active">
<h4><?php echo $slider_nav['judul']; ?></h4>
</li>
<?php } else { ?>
<li data-target="#myCarousel" data-slide-to="<?php echo $num; ?>" class="list-group-item">
<h4><?php echo $slider_nav['judul']; ?></h4>
</li>
<?php } ?>
<?php $num++; ?>
<?php } ?>
</ul>
<!-- Controls -->
<div class="carousel-controls">
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div><!-- End Carousel -->
</div>