-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainPage.php
413 lines (349 loc) · 15.2 KB
/
mainPage.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>Main Page</title>
<link rel="stylesheet" type = "text/css" href="mainStyle.css" media = "all">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<!-- why css doesnt work anymore? command s is not working for some reasons have to manually save the doc-->
</head>
<body>
<!--Connect to phpMyAdmin Database-->
<?php
$server = "localhost";
$username = "root";
$password = "";
$database = "art_store";
$con = mysqli_connect($server, $username, $password, $database);
/*Check connection*/
if (!$con) {
die("Connection failed: " . mysqli_connect_error());
}
/*queries that are used to individually select all needed attributes from the table*/
$popimage = "select imageFileName from artworks order by view LIMIT 3";
$title = "select title from artworks order by view LIMIT 3";
$newimage = "select imageFileName from artworks order by timeReleased LIMIT 3";
$newimgauthor = "select artist from artworks order by timeReleased LIMIT 3";
$newimgname = "select title from artworks order by timeReleased LIMIT 3";
$newimgdescription = "select description from artworks order by timeReleased LIMIT 3";
$newimgid = "select artworkID from artworks order by timeReleased LIMIT 3";
/*execute the queries above to assign the value to new variables*/
$result = $con->query($popimage);
$titleresult = $con->query($title);
$newimgresult = $con->query($newimage);
$newimg_artist = $con->query($newimgauthor);
$newimg_work = $con->query($newimgname);
$newimg_des = $con->query($newimgdescription);
$newimg_id = $con->query($newimgid);
$con->close(); ?>
<div class="page-container">
<!-- bootstrap implementation-->
<div id = "demo" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target ="#demo" data-slide-to="0" class="active"></li>
<li data-target ="#demo" data-slide-to="1"></li>
<li data-target ="#demo" data-slide-to="2"></li>
</ul>
<!--//still need improvement. Ops is tedious for fetcing the images from array-->
<!--To fetch the value from the array variable that we declared earlier-->
<?php $img_path = $result->fetch_array();?>
<?php $img_path2 = $result->fetch_array();?>
<?php $img_path3 = $result->fetch_array();?>
<?php $title_name = $titleresult->fetch_array();?>
<?php $title_name2 = $titleresult->fetch_array();?>
<?php $title_name3 = $titleresult->fetch_array();?>
<!--relative on the outside and absolute in the inside create overlapping
https://css-tricks.com/absolute-positioning-inside-relative-positioning/
https://puzzleweb.ru/en/css/12_positioning.php
-->
<div class='carousel-inner'>
<div class = 'carousel-item active'><img src="resources/img/<?php echo $img_path[0]; ?>"/>
<div class="carousel-caption">
<h3><?php echo $title_name[0]; ?></h3>
<p>POPULAR EXHIBITION 1</p>
</div>
</div>
<div class = 'carousel-item'><img src="resources/img/<?php echo $img_path2[0]; ?>"/>
<div class="carousel-caption">
<h3><?php echo $title_name2[0]; ?></h3>
<p>POPULAR EXHIBITION 2</p>
</div>
</div>
<div class = 'carousel-item'><img src="resources/img/<?php echo $img_path3[0]; ?>"/>
<div class="carousel-caption">
<h3><?php echo $title_name3[0]; ?></h3>
<p>POPULAR EXHIBITION 3</p>
</div>
</div>
<!--new layout for navigation bar and search bar--put it in the center of the carousel to have search engine look-->
<div class="navbar">
<span class = "nav_01">
<a href="mainPage.php">Main</a>
<a href="search.php">Search</a>
<a href="product_detail.php">Product</a>
<a href="collection.php">Store</a>
<a href="login_page.html">Login</a>
<a href="register_page.html">Register</a>
</span>
</div>
<div class="searchengine">
<span class = "logo_subtitle" >
<h1 style="display: inline-block">Art Store</h1>
<h5 style="display: inline-block">Where you find GENIUS and EXTRAODINARY </h5>
</span>
</br>
<span class="searchbar" style="display: inline-block">
<form action="search.html">
<input type="text" placeholder="search..." name="search" list="options" size="50">
<button type="submit" >Search</button>
</form>
</span>
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
<!-- new release section using flexbox-->
<h3>-------------------------------------------------Newest Release------------------------------------------------</h3>
<div class="pic_display">
<div class="img_container">
<div class="img">
<?php $newimg_path = $newimgresult->fetch_array();?>
<a href="product_detail.html"><img class="displayimg" src="resources/img/<?php echo $newimg_path[0]; ?>" alt="fancystuff"></a>
</div>
<div class="img_text">
<?php $newimg_author = $newimg_artist->fetch_array();?>
<?php $newimg_name = $newimg_work->fetch_array();?>
<?php $newimg_text = $newimg_des->fetch_array();?>
<?php $newimg_num = $newimg_id->fetch_array();?>
<h3><?php echo $newimg_name[0]; ?></h3>
<h3>Author: <?php echo $newimg_author[0]; ?></h3>
<p>
<?php echo $newimg_text[0]; ?>
</p>
<a class="figname" href="product_detail.php?myid=<?php echo $newimg_num[0]; ?>">LEARN MORE</a>
</div>
</div>
<div class="img_container">
<div class="img_text">
<?php $newimg_author2 = $newimg_artist->fetch_array();?>
<?php $newimg_name2 = $newimg_work->fetch_array();?>
<?php $newimg_text2 = $newimg_des->fetch_array();?>
<?php $newimg_num2 = $newimg_id->fetch_array();?>
<h3><?php echo $newimg_name2[0]; ?></h3>
<h3>Author: <?php echo $newimg_author2[0]; ?></h3>
<p>
<?php echo $newimg_text2[0]; ?>
</p>
<a class="figname" href="product_detail.php?myid=<?php echo $newimg_num2[0]; ?>">LEARN MORE</a>
</div>
<div class="img">
<?php $newimg_path2 = $newimgresult->fetch_array();?>
<a href="product_detail.html"><img class="displayimg" src="resources/img/<?php echo $newimg_path2[0]; ?>" alt="fancystuff"></a>
</div>
</div>
<div class="img_container">
<?php $newimg_author3 = $newimg_artist->fetch_array();?>
<?php $newimg_name3 = $newimg_work->fetch_array();?>
<?php $newimg_text3 = $newimg_des->fetch_array();?>
<?php $newimg_num3 = $newimg_id->fetch_array();?>
<div class="img">
<?php $newimg_path3 = $newimgresult->fetch_array();?>
<a href="product_detail.html"><img class="displayimg" src="resources/img/<?php echo $newimg_path3[0]; ?>" alt="fancystuff"></a>
</div>
<div class="img_text">
<h3><?php echo $newimg_name3[0]; ?></h3>
<h3>Author: <?php echo $newimg_author3[0]; ?></h3>
<p >
<?php echo $newimg_text3[0]; ?>
</p>
<a class="figname" href="product_detail.php?myid=<?php echo $newimg_num3[0]; ?>">LEARN MORE</a>
</div>
</div>
</div>
<!--footer problem:for position element, need to consider the parent element. If the parent element is body, the position is decided relative to the initial containing block which is viewport-->
<footer class="footer">
<p>ArtStore. Produced and maintained by YC. All rights reserved.</p>
</footer>
</div>
</body>
<script>
</script>
</html>
<!--/*old codes*/-->
<!-- Carousel bootstrap
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>-->
<!-- Carousel bootstrap additional css <style>
/* Make the image fully responsive */
.carousel-inner ig {
width: 100%;
height: 600px;
}
.carousel-inner{
position: relative;
text-align: center;
color: white;
}
.searchengine{
position: absolute;
}
</style>-->
<!-- Old CSS <style>
.nav_01 a {float: right; text-align: center; width: 50px; padding-top: 2%; padding-bottom:2%; padding-left:0; padding-right:0;}
.logo_subtitle{padding: 0px}
.head_pic{text-align: center}
.mostviewed{
text-align: center;
}
.content-wrap{
min-height: 100vh;
overflow: hidden;
position: relative;
padding-bottom: 100px;
}
.footer{
position: absolute;
bottom: 0;
width: 100%;
background: grey;
}
/*figure{*/
/* width:20%;*/
/* float: left;*/
/* margin-left:80px;*/
/* margin-right: 80px;*/
/* text-align:center;*/
/* padding:0px;*/
/*}*/
.column {
float: left;
padding: 0px;
text-align: center;
margin: 10px;
}
.displayimg{
width:356px;
height: 640px;
}
</style>-->
<!--JS manual carousel
<div class="navbar">
<span class = "nav_01">
<a href="html_Spring.php">首页</a>
<a href="search.html">搜索</a>
<a href="product_detail.html">详情</a>
<a href="collection.html">收藏</a>
<a href="login_page.html">登陆</a>
<a href="register_page.html">注册</a>
</span>
</div>
<div class="searchengine">
<span class = "logo_subtitle" >
<h1 style="display: inline-block">Art Store</h1>
<h5 style="display: inline-block">Where you find GENIUS and EXTRAODINARY </h5>
</span>
</br>
<span class="searchbar" style="display: inline-block">
<form action="search.html">
<input type="text" placeholder="search..." name="search" list="options" size="50">
<datalist id="options">
<option label="Hello" value="Hello"> Hello<option>
</datalist>
<button type="submit" >Search</button>
</form>
</span>
</div>
<div class="slideshow-container">
<div class="mySlide fade">
<img src="resources/img/48.jpg" width="100%" height="800px"/>
</div>
<div class="mySlide fade">
<img src="resources/img/58.jpg" width="100%" height="800px"/>
</div>
<div class="mySlide fade">
<img src="resources/img/70.jpg" width="100%" height="800px"/>
</div>
<a class="prev" onclick="plusSlide(-1)">❮</a>
<a class="next" onclick="plusSlide(1)">❯</a>
</div>-->
<!-- original main page body layout <hr/>
<div class="head_pic">
<a href="product_detail.html"><img src="resources/img/7.jpg" alt = "family" /></a>
</div>
<hr/>
<div class="mostviewed">
<h5>Most Viewed</h5>
</div>
<div class="pic_display">
<div class = "row">
<div class="column">
<a href="product_detail.html"><img class="displayimg" src="resources/img/14.jpg" alt="fancystuff"></a>
<h3>Two Nudes</h3>
<h3>Author: Pablo Picasso</h3>
<p >
The terracotta shades and heavy monumentality of the figures in <em>Two Nudes</em> derive from Picasso\'s interest at the time in the ancient Iberian sculpture of his native Spain.
</p>
<a class="figname" href="product_detail.html">LEARN MORE</a>
</div>
<div class="column">
<a href="product_detail.html"><img class="displayimg" src="resources/img/12.jpg" alt="fancystuff"></a>
<h3>Portrait of Gertrude Stein</h3>
<h3>Author: Pablo Picasso</h3>
<p>
By 1905 Picasso became a favorite of the American art collectors Leo and Gertrude Stein. Their older brother Michael Stein and his wife Sarah also became collectors of his work.
</p>
<a class="figname" href="product_detail.html">LEARN MORE</a>
</div>
<div class="column">
<a href="product_detail.html"><img class="displayimg" src="resources/img/8.jpg" alt="fancystuff"></a>
<h3>Portrait of Daniel-Henry Kahnweiler</h3>
<h3>Author: Pablo Picasso</h3>
<p >
In 1907 Picasso joined an art gallery that had recently been opened in Paris by Daniel-Henry Kahnweiler. Kahnweiler was a German art historian, art collector who became one of the premier French art dealers of the 20th century.
</p>
<a class="figname" href="product_detail.html">LEARN MORE</a>
</div>
</div>
</div>
<footer class="footer">
<p>ArtStore. Produced and maintained by YC. All rights reserved.</p>
</footer>
</div>-->
<!-- JS script for Carousel
var slideIndex=1;
showSlide(slideIndex);
function plusSlide(n){
showSlide(slideIndex+=n);
}
function currentSlide(n){
showSlide(slideIndex=n);
}
function showSlide(n){
var i;
var slides=document.getElementsByClassName("mySlide");
slideIndex++;
if(slideIndex> slides.length){
slideIndex = 1;
}
if(n> slides.length){
slideIndex = 1;
}
if(n<1){
slideIndex = slides.length;
}
for(i = 0; i<slides.length;i++){
slides[i].style.display="none";
}
slides[slideIndex-1].style.display="block";
setTimeout(showSlide,4000);
}-->