-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeline.php
106 lines (90 loc) · 3.12 KB
/
timeline.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<div class=timeline id=timeline >
<?php
$conn = new mysqli($HOST_,$USER_,$PASS_,$DATABASE_);
$sql = 'SELECT id,title,price FROM product WHERE draft=0 ORDER BY date_added DESC';
$result = $conn->query($sql);
$target = '';
$inject = '';
$c = 1;
if($result){
while($row = $result->fetch_assoc()){
if($c<40){
$conn = new mysqli($HOST_,$USER_,$PASS_,$DATABASE_);
$sql = 'SELECT url FROM product_image WHERE product_id='.$row['id'];
$result2 = $conn->query($sql);
if($result2){
if($row2 = $result2->fetch_assoc()){
$inject.=
'<a href="open.php?product_id='.$row['id'].'" >'.
'<div class="block '.($c%4==0?'block_purple':'').' tml_p" >'.
'<span class=highlight_green >R'.$row['price'].'</span>'.
'<img src="'.(strpos($row2['url'],'//')!==false?$row2['url']:'https://'.$HOME_.'/services/sell/products/product_images/'.$row2['url']).'" width=100% />'.
'<span style="font-size:1em;" >'.$row['title'].'</span>'.
'</div>'.
'</a>';
if($row = $result->fetch_assoc()){
$sql = 'SELECT url FROM product_image WHERE product_id='.$row['id'];
$result2 = $conn->query($sql);
if($result2){
if($row2 = $result2->fetch_assoc()){
$inject.=
'<a href="open.php?product_id='.$row['id'].'" >'.
'<div class="block '.($c%4==0?'block_purple':'').' tml_p" >'.
'<span class=highlight_green >R'.$row['price'].'</span>'.
'<img src="'.(strpos($row2['url'],'//')!==false?$row2['url']:'https://'.$HOME_.'/services/sell/products/product_images/'.$row2['url']).'" width=100% />'.
'<span style="font-size:1em;" >'.$row['title'].'</span>'.
'</div>'.
'</a>'.($c%2==0 ?'</div>'.($c%12==0?'</div><div class="row tml_row" >':'').'<div class="col-sm-6 row" >':'');
}}
}
if($c%2==0){
$target .=
'<div class="col-sm-6 row" >'.
$inject.
'</div>';
$inject='';
}
if($c%4==0){
$target =
'<div class="row tml_row" >'.
$target.
'</div>';
echo
$target;
$target='';
}
}
}else{
echo
'error: '.
mysqli_error($conn);
}
}
$c+=1;
}
}else{
echo
'error: '.
mysqli_error($conn);
}
?>
</div>
<style>
@media only screen and
(max-width: 768px) {
.timeline {
padding-left:20px;
}
}
</style>
<div class=nav >
<script>
function appendTimeline(top){
var res = sendreq('feature/timeline/index.php?top='+top);
res.onload = function(){
e('timeline').innerHTML+=res.responseText;
};
}
</script>
<a class=more href="#" onclick="appendTimeline(e('timeline').getElementsByClassName('tml_p').length);return false;" > load more </a>
</div>