Browse Source

Added new feed to main page

pull/5/head
parent
commit
fc04d4ceb8
Signed by: aayla GPG Key ID: B9ECA7B2228FC760
4 changed files with 143 additions and 121 deletions
  1. +27
    -26
      index.php
  2. +2
    -95
      news/index.php
  3. +112
    -0
      res/css/news.css
  4. +2
    -0
      res/css/style.css

+ 27
- 26
index.php View File

@ -22,6 +22,7 @@
<title>Socialist Rifle Association</title>
<?php include("res/php/headtags.php"); ?>
</head>
<link rel="stylesheet" type="text/css" href="/res/css/news.css">
<style type="text/css">
@keyframes banner-slide-down {
0% {margin-top: 0;}
@ -157,7 +158,7 @@
background-color: #131313;
}
#first-spacer {
margin-top: 118vh;
margin-top: 40vh;
}
.ecks {
display: none;
@ -409,14 +410,9 @@
</div>
</div>
<div id="banner">
<?php
// $blogfeed = new SimpleXMLElement('https://blog.socialistra.org/rss', true);
// var_dump($blogfeed);
?>
<div id="overlay"></div>
</div>
<div id="first-spacer"></div>
<div id="first-spacer" style="30vh"></div>
<div id="donate-cont" class="d-height d-mobile-height">
<a href="/donate/">
<div id="donate" class="d-left">
@ -437,27 +433,32 @@
<br><br>
<div class="section group news zmd-hierarchical-display" data-animation="hierarchical-display">
<?php
require "vendor/autoload.php";
$feed = Laminas\Feed\Reader\Reader::import('http://blog.socialistra.org/rss');
$i = 0;
// Display stories
foreach ($stories as $story) {
if ($i < 3) {
$data = json_decode(
file_get_contents("./news/stories/$story/meta.json")
, true);
echo '
<div class="col span_1_of_3 news_item">
<a href="./news/story.php?id='.$story.'">
<img class="news_item" src="https://srastatic.nyc3.cdn.digitaloceanspaces.com/web/img/news/' . $story . '/' . $data['thumb'].'">
<hr class="news-hr">
<p class="nit">'.$data['title'].'</p>
<p class="sub-nit">'.$data['subtitle'].'</p>
</a>
foreach ($feed as $entry) {
if ($i == 3) { break; }
$title = $entry->getTitle();
$subtitle = strip_tags($entry->getDescription());
$link = $entry->getLink();
$content = $entry->getContent();
preg_match('/\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$]/i', $content, $result);
$image = $result[0];
echo <<< EOT
<a href="$link">
<div id="biotext">
<img src="$image" class="bio" />
<div id="biodesk">
<div id="chaplist">
<h1 class="headline">$title</h1>
<h2>$subtitle</h2>
</div>
</div>
';
$i++;
} else {
break;
}
</div>
</a>
<hr>
EOT;
$i += 1;
}
?>
</div>


+ 2
- 95
news/index.php View File

@ -26,100 +26,7 @@ error_reporting(E_ALL);
<head>
<title>Socialist Rifle Association</title>
<?php include("../res/php/headtags.php") ?>
<style type="text/css">
h1 {
font-size: 1.5em;
}
img.bio {
border-radius: 10px;
width: 20%;
display: inline-block;
vertical-align: middle;
}
#biodesk {
width: 65%;
margin: auto auto;
display: inline-block;
vertical-align: middle;
padding-left: 2em;
}
#biodesk p {
font-weight: 200;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
h5 {
font-weight: 200;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-style: italic;
}
#chaplist {
display: inline-block;
padding: 0.5em;
margin: 0.5em;
}
#chaplist h3 {
display: inline-block;
padding: 10px;
}
#map {
width: 80% !important;
margin: auto;
display: block;
height: 550px !important;
}
#map svg {
display: block;
width: 80%;
height: 500px !important;
text-align: center;
margin: auto auto;
}
.map-center {
margin: auto auto;
text-align: center;
}
.chapter-details {
z-index: 2;
}
@media screen and (max-width: 1080px) {
#map {
height: 450px !important;
text-align: center;
}
}
@media screen and (max-width: 1024px) {
#map {
height: 350px !important;
text-align: center;
}
}
@media screen and (max-width: 768px) {
#map {
height: 350px !important;
text-align: center;
}
}
@media screen and (max-width: 736px) {
#first img {
display: inline-block;
}
#chaplist {
width: 80%;
}
#map {
height: 300px !important;
text-align: center;
width: 90%;
margin: auto auto;
}
#map svg {
height: 200px !important;
width: 325px;
text-align: center;
margin: auto auto;
}
}
</style>
<link rel="stylesheet" type="text/css" href="/res/css/news.css">
</head>
<body>
<?php include("../res/php/top.php") ?>
@ -142,7 +49,7 @@ error_reporting(E_ALL);
<img src="$image" class="bio" />
<div id="biodesk">
<div id="chaplist">
<h1>$title</h1>
<h1 class="headline">$title</h1>
<h2>$subtitle</h2>
</div>
</div>


+ 112
- 0
res/css/news.css View File

@ -0,0 +1,112 @@
/**
* Copyright (C) 2021 Aayla Semyonova
*
* This file is part of website.
*
* website is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* website is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with website. If not, see <http://www.gnu.org/licenses/>.
*/
h1.headline {
font-size: 1.5em;
color: black !important;
}
img.bio {
border-radius: 10px;
width: 20%;
display: inline-block;
vertical-align: middle;
}
#biodesk {
width: 65%;
margin: auto auto;
display: inline-block;
vertical-align: middle;
padding-left: 2em;
}
#biodesk p {
font-weight: 200;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
h5 {
font-weight: 200;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-style: italic;
}
#chaplist {
display: inline-block;
padding: 0.5em;
margin: 0.5em;
}
#chaplist h3 {
display: inline-block;
padding: 10px;
}
#map {
width: 80% !important;
margin: auto;
display: block;
height: 550px !important;
}
#map svg {
display: block;
width: 80%;
height: 500px !important;
text-align: center;
margin: auto auto;
}
.map-center {
margin: auto auto;
text-align: center;
}
.chapter-details {
z-index: 2;
}
@media screen and (max-width: 1080px) {
#map {
height: 450px !important;
text-align: center;
}
}
@media screen and (max-width: 1024px) {
#map {
height: 350px !important;
text-align: center;
}
}
@media screen and (max-width: 768px) {
#map {
height: 350px !important;
text-align: center;
}
}
@media screen and (max-width: 736px) {
#first img {
display: inline-block;
}
#chaplist {
width: 80%;
}
#map {
height: 300px !important;
text-align: center;
width: 90%;
margin: auto auto;
}
#map svg {
height: 200px !important;
width: 325px;
text-align: center;
margin: auto auto;
}
}

+ 2
- 0
res/css/style.css View File

@ -303,6 +303,8 @@ a.edu_item {
width: 100%;
margin: 0 !important;
max-width: 100% !important;
max-height: 15% !important;
overflow: hidden;
border-radius: 10px 10px 0 0 !important;
}
.news_item a {


Loading…
Cancel
Save