Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
assets
screenshots
.editorconfig
.gitignore
LICENSE
README.md
author.php
index.php
robots.txt

README.md

Yrgo-assignments/Fake News

Assignments from School ( Yrgo ) Gothenburg : 2018-09-03 - 2020-05-29

Assignment 1 ( PHP ) Fake News

Our first assignment in php at Yrgo in Sweden Gothenburg. Deadline for: 2018-10-31 23:59
This assignment is called Fake News and I have generated text from StarTrek ipsum to use as articles
Like-buttons are connected to a function in javascript and working but will not save likes permanently
Every author "character" have a link to wikipedia as well as authors.php which will filter authors by id...

Languages Used:
HTML CSS PHP Javascript Markdown <- Readme.md

License: MIT

Live preview:

leemann.se/fredrik/project/fake-news

Installation

Github Repository

1. Click the green button "clone or download" at top of this github repository

( You can use git from your terminal or GitHub Desktop to clone this repository )

2. For easy instalation on Windows, Mac or Linux you can click "Download ZIP"

  1. [assets/fake-news.zip?raw=true](Click here to download this project as a zip-file)
  2. On Linux/Mac/BSD you can use wget from your terminal
  3. Extract the compressed zip-archive to the root-folder of your webserver
  4. Start your webserver (xampp/wamp/mamp/lamp) and open the webpage in your browser

Example wget

wget https://bit.ly/2MKDA40 -O fake-news.zip
unzip fake-news.zip

Example Git Clone

git clone https://github.com/freddan88/fakenews.git

pre-requirements:

Usage

  • Start your browser and point the URL to this folder

Example: http://{webserver}/fake-news

Startpage The above picture is the startpage were you can read all articles. They are sorted on date with the latest date first. If you press thumb-up or thumb-down you will add likes or dislikes. Every author will have a link to wikipedia, clicking this link will open a new tabb in your browser. Every authors name are linked to the page below "authors.php"...

Authorpage The above picture is the authorspage which will filter the output to only show articles from a single author. This page also includes links to the authors wikipedia-page and also a link to authors.php for the current author. The arrow in the header will link you back to the startpage again...

Testers

Name OS Browser Status
Maja Filipsson Windows 10 Professional Google Chrome v70.0.3538.77 working
Maja Filipsson Windows 10 Professional Microsoft Edge 17.17134 working
André Broman macOS High Sierra v10.13.6 Chromium v57 working
André Broman macOS High Sierra v10.13.6 Mozilla Firefox v64.0b4 ( dev ) working
André Broman macOS High Sierra v10.13.6 Safari 11.1 working
Fredrik Leemann Windows 7 Home Premium SP1 Google Chrome v70.0.3538.77 working
Fredrik Leemann Windows 7 Home Premium SP1 Mozilla Firefox v63.0 working
Fredrik Leemann Windows 7 Home Premium SP1 Internet Explorer v11.0.9600.18665 working
Fredrik Leemann macOS High Sierra v10.13.6 Google Chrome v70.0.3538.77 working
Fredrik Leemann macOS High Sierra v10.13.6 Mozilla Firefox v64.0b4 ( dev ) working
Fredrik Leemann macOS High Sierra v10.13.6 Brave Version 0.55.20 working

Servers

Server PHP Apache
MAMP v5.1 (350) v7.2.8 v2.2.34
XAMP v3.2.2 v7.2.5 v2.4.33

References

Some programing-snippets from this project

New javascript

'use strict';

const buttons = document.querySelectorAll('.thumb-button');
const btnArray = Array.from(buttons);

btnArray.forEach((button)=>{
	let numLikes = parseInt(button.querySelector('span').innerText, 10);

	button.addEventListener('click',()=>{

		if(numLikes === 50){
			return;
		}
		button.querySelector('span').innerText = ++numLikes;
	});
});

Old Javascript

    'use strict';

    function funcJSlikes(btx){
        let number = parseInt(btx.querySelector('span').textContent);
        if (number === 50){
            return;
        }
        btx.querySelector('span').textContent = ++number;
    }

php

    declare(strict_types=1);

    function funcSortByDate(array $a, array $b): int {
    return $a['published'] <=> $b['published'];
    }
    
    function funcSearchAuthorID(array $array): bool{
        $urlAuthorID = $_GET['author_id'];
        return $array['author_id'] == $urlAuthorID;
    }

YRGO - Assignment 1 ( php ) - October 31 2018 23:59 URL www.leemann.se/fredrik

You can’t perform that action at this time.