Browse Source

add find in news

develop
Carmine De Rosa 7 years ago
parent
commit
7f9a24ef4e
  1. 33
      css/styles.css
  2. 6
      js/scripts.js
  3. 33
      news.php
  4. BIN
      scss/.sass-cache/094858d67900945e1547c8ced88b84162c32e28d/news.scssc
  5. BIN
      scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/global.scssc
  6. 7
      scss/global.scss
  7. 7
      scss/sections/news.scss

33
css/styles.css

@ -14368,6 +14368,7 @@ a:hover {
/* line 84, global.scss */
.section-title {
position: relative;
font-size: 0.75rem;
color: white;
background: #4e984a;
@ -14379,35 +14380,41 @@ a:hover {
height: 35px;
line-height: 35px;
}
/* line 97, global.scss */
.section-title .right {
position: absolute;
right: 10px;
top: 0;
}
/* line 99, global.scss */
/* line 106, global.scss */
.items-list .item {
padding: 10px;
transition: .4s;
font-size: 0.875rem;
border-bottom: 1px solid #d1efb5;
}
/* line 105, global.scss */
/* line 112, global.scss */
.items-list .item .fa-angle-right {
padding: 0 5px;
transition: .4s;
}
/* line 111, global.scss */
/* line 118, global.scss */
.items-list .item a:after {
content: '\f0c1';
font-family: 'FontAwesome';
padding: 0 5px;
}
/* line 118, global.scss */
/* line 125, global.scss */
.items-list .item:hover {
background: #d1efb5;
}
/* line 120, global.scss */
/* line 127, global.scss */
.items-list .item:hover .fa-angle-right {
margin-left: 5px;
}
/* line 127, global.scss */
/* line 134, global.scss */
#MainContent {
position: absolute;
top: 40px;
@ -14418,7 +14425,7 @@ a:hover {
transform: translateX(-50%);
}
/* line 137, global.scss */
/* line 144, global.scss */
#map {
width: 100%;
border-radius: 3px;
@ -14426,12 +14433,12 @@ a:hover {
padding: 10px;
}
/* line 145, global.scss */
/* line 152, global.scss */
#menuLeft {
margin-top: 70px;
}
@media only screen and (min-width: 768px) {
/* line 145, global.scss */
/* line 152, global.scss */
#menuLeft {
margin-top: 0;
}
@ -14956,7 +14963,13 @@ header .breadcrumb .container .crumbs a:hover {
.news .item a:hover {
color: black;
}
/* line 41, sections/news.scss */
/* line 42, sections/news.scss */
.news .append .item a:before {
content: '\f019';
font-family: 'FontAwesome';
padding-right: 4px;
}
/* line 48, sections/news.scss */
.news .append .item .size {
float: right;
}

6
js/scripts.js

@ -52,6 +52,12 @@ $(document).ready(function(){
});
$('#news-find').on('submit', function(e){
e.preventDefault();
window.location = "/news/0/find/" + $('#news-find').find('.q').val();
});
});

33
news.php

@ -1,6 +1,11 @@
<?php
$q = mysqli_query($conn, "SELECT COUNT(id) FROM news");
$extraQ="";
if($getQ[2]=="find"){
$extraQ = "WHERE title LIKE '%".$getQ[3]."%' OR text LIKE '%".$getQ[3]."%' ";
}
$q = mysqli_query($conn, "SELECT COUNT(id) FROM news $extraQ");
$r = mysqli_fetch_array($q);
$totNews = $r[0];
@ -9,7 +14,8 @@
$totPages = $totNews/$itemsPage;
$pageStart = $currentPage * $itemsPage;
if($getQ[2]){
if($getQ[2] && $getQ[2]!="find"){
$q = mysqli_query($conn, "SELECT * FROM news WHERE id=".$getQ[2]);
$r = mysqli_fetch_array($q);
@ -20,6 +26,9 @@
<div class="col-12">
<div class="section-title">Notizie dall'Ordine</div>
</div>
<div class="col-12 my-2">
<div class="section-text">
<p class="item py-3 h6"><span class="date"><?php echo conv_date($r['date']);?></span> - <?php echo $r['title'];?></p>
<p class="p-2"><?php echo $r['text'];?></p>
@ -70,8 +79,22 @@
<div class="col-12">
<div class="section-title">Notizie dall'Ordine</div>
</div>
<div class="col-12">
<form id="news-find">
<div class="row py-2 font-14">
<div class="col-6 d-none d-sm-block"></div>
<div class="col"><input type="text" class="q" value="<?= $getQ[3];?>"></div>
<div class="col-auto"><button type="submit">Cerca <i class="fa fa-search"></i></button></div>
<div class="col-12 px-3 font-12"><?php if($getQ[2]=="find"){echo "Ricerca terminata, ".$totNews." notizie corrispondono ai criteri di ricerca.";}?></div>
</div>
</form>
</div>
<div class="col-12 my-2">
<?php
$q = mysqli_query($conn, "SELECT * FROM news ORDER BY date LIMIT $pageStart,$itemsPage");
$q = mysqli_query($conn, "SELECT * FROM news $extraQ ORDER BY date LIMIT $pageStart,$itemsPage");
while($r = mysqli_fetch_array($q)){
echo "<p class=\"item\"><a href=\"$BASE_URL/news/0/".$r['id']."/".conv_url($r['title'])."\"><span class=\"date\">".conv_date($r['date'])." </span> - ".$r['title']."</a></p>";
}
@ -81,10 +104,12 @@
<div class="col-12 my-2 pages">
<?php
$findAppend = ($getQ[2]=="find") ? $getQ[2]."/".$getQ[3] : "";
for($i=0;$i<$totPages;$i++){
echo "<a class=\"font-12 ";
if($i==$currentPage){echo "selected";}
echo "\" href=\"$BASE_URL/news/$i\">".($i+1)."</a>";
echo "\" href=\"$BASE_URL/news/$i/$findAppend\">".($i+1)."</a>";
}
?>
</div>

BIN
scss/.sass-cache/094858d67900945e1547c8ced88b84162c32e28d/news.scssc

Binary file not shown.

BIN
scss/.sass-cache/bdcb2ec4843708bc0e130897363854e74056ec3e/global.scssc

Binary file not shown.

7
scss/global.scss

@ -82,6 +82,7 @@ a{
}
.section-title{
position: relative;
font-size: $font-12;
color: white;
background: $green;
@ -92,6 +93,12 @@ a{
border-radius: 3px 3px 0px 0px;
height: 35px;
line-height: 35px;
.right{
position: absolute;
right: 10px;
top: 0;
}
}

7
scss/sections/news.scss

@ -38,6 +38,13 @@
.append{
.item{
a{
&:before{
content: '\f019';
font-family: 'FontAwesome';
padding-right: 4px;
}
}
.size{
float: right;
}

Loading…
Cancel
Save