WIP make lokal hosting work
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"cwsvJudo": {
|
||||
"db": {
|
||||
"host": "localhost",
|
||||
"host": "db",
|
||||
"name": "cwsvjudo_main",
|
||||
"user": "cwsvjudo_marko"
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
$home = "/home/cwsvjudo.helioho.st";
|
||||
/// Basis(/Root)-Verzeichnis auf dem Server (für Dateizugriffe, insbesondere phpIncludes)
|
||||
/// (ist eigentlich das serve verzeichnis, aka www-data)
|
||||
$basePath = join("/", [$home, "httpdocs"]);
|
||||
$basePath = join(separator: "/", array: [$home, "httpdocs"]);
|
||||
|
||||
/// Url zum Zugriff auf "shared Data" unter der Hauptadresse
|
||||
$baseUrl = "http://".$baseDomain;
|
||||
|
||||
@@ -21,10 +21,11 @@ services:
|
||||
image: mariadb:latest
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_USER: "cwsvjudo"
|
||||
MYSQL_DATABASE: "cwsvjudo"
|
||||
MYSQL_USER: "cwsvjudo_marko"
|
||||
MYSQL_DATABASE: "cwsvjudo_main"
|
||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_root_password
|
||||
MYSQL_PASSWORD_FILE: /run/secrets/db_password
|
||||
MYSQL_TCP_PORT: 3306
|
||||
volumes:
|
||||
# this line maps the content of ./mysql_data in your pc to the /var/lib/mysql of the container
|
||||
- mysqldata:/var/lib/mysql
|
||||
@@ -44,7 +45,7 @@ services:
|
||||
environment:
|
||||
# name of the host is the name of the db service started above! Why? I don't know!
|
||||
- PMA_HOST=db
|
||||
- PMA_PORT=1433
|
||||
- PMA_PORT=3306
|
||||
volumes:
|
||||
# data storage for the db
|
||||
mysqldata: {}
|
||||
|
||||
@@ -15,8 +15,7 @@ $headerRootLevel = is_positive_integer($someOptions['headerRootLevel'])?$someOpt
|
||||
/// Eine Datenbankverbindung (über pdo) erstellen
|
||||
try{
|
||||
$db_connection = new PDO(
|
||||
"mysql:host=".$cwsvJudoConfig["db"]["host"].";".
|
||||
"dbname=".$cwsvJudoConfig["db"]["name"],
|
||||
"mysql:host=".$cwsvJudoConfig["db"]["host"].";"."dbname=".$cwsvJudoConfig["db"]["name"],
|
||||
$cwsvJudoConfig["db"]["user"],
|
||||
$cwsvJudoConfig["db"]["password"]
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
font-size: 1em;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.parallax-container {
|
||||
height: 50vw;
|
||||
height: 38vh;
|
||||
}
|
||||
|
||||
.parallax-container > .parallax > img{
|
||||
|
||||
@@ -4,11 +4,11 @@ title: "Judo im Chemnitzer WSV - Kinder- und Erwachsenentraining"
|
||||
description: "Informationen zu Trainingszeiten, Wettkämpfen und anderen Veranstaltungen der Abteilung Judo des Chemnitzer Freizeit- und Wohngebiets­sportvereines e. V."
|
||||
author: "marko"
|
||||
keywords:
|
||||
- "Judo"
|
||||
- "Chemnitzer Freizeit- und Wohngebietssportverein"
|
||||
- "Judo"
|
||||
- "Chemnitzer Freizeit- und Wohngebietssportverein"
|
||||
canonicalPath: ""
|
||||
jsonSdFiles:
|
||||
- cwsvJudo.json
|
||||
- cwsvJudo.json
|
||||
...
|
||||
|
||||
# Judo im Chemnitzer WSV
|
||||
@@ -20,8 +20,8 @@ und [Wettkampfterminen][cwsvJudoWettkampfKalender].
|
||||
Ein kleines Wiki bietet [Wissenswertes über Judo][cwsvJudoWiki], wie
|
||||
zum Beispiel das [Programm für die Gürtelprüfungen][cwsvJudoWikiKyu].
|
||||
|
||||
|
||||
## Letzte Neuigkeiten
|
||||
|
||||
<?php $options=array(); $options['limit']=6; $options['headerRootLevel']=2; echoNewsTableHtml( $options ); ?>
|
||||
|
||||
[cwsvHomepage]: http://www.cwsv-sport.de "Homepage des Chemnitzer Freizeit- und Wohngebietssportvereines"
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
<?
|
||||
$home = "/home/cwsvjudo.helioho.st";
|
||||
/**
|
||||
* home directory on the server
|
||||
* - meaning the users home directory (aka ~) in the environment, not the directory served via http
|
||||
*/
|
||||
$home = "/home/cwsvjudo.helioho.st";
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
|
||||
$directory_paths=[
|
||||
"wallpapers" => "/ressourcen/graphiken/wallpapers",
|
||||
];
|
||||
|
||||
$mainNav = [
|
||||
[
|
||||
"url" => "training",
|
||||
@@ -16,26 +21,72 @@ $sections = [
|
||||
|
||||
$wallpapers = [
|
||||
[
|
||||
"src" => "/ressourcen/graphiken/wallpapers/osae-komi.svg",
|
||||
"data-src" => "/ressourcen/graphiken/wallpapers/osae-komi.jpg"
|
||||
"src" => $directory_paths['wallpapers']. "/osae-komi.svg",
|
||||
"data-src" => $directory_paths['wallpapers']. "/osae-komi.jpg"
|
||||
],
|
||||
[
|
||||
"src" => "/ressourcen/graphiken/wallpapers/nage.svg",
|
||||
"data-src" => "/ressourcen/graphiken/wallpapers/nage.jpg"
|
||||
"src" => $directory_paths['wallpapers']. "/nage.svg",
|
||||
"data-src" => $directory_paths['wallpapers']. "/nage.jpg"
|
||||
],
|
||||
[
|
||||
"src" => "/ressourcen/graphiken/wallpapers/kata.svg",
|
||||
"data-src" => "/ressourcen/graphiken/wallpapers/kata.jpg"
|
||||
"src" => $directory_paths['wallpapers']. "/kata.svg",
|
||||
"data-src" => $directory_paths['wallpapers']. "/kata.jpg"
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
// helper functions
|
||||
// -html output
|
||||
|
||||
/**
|
||||
* Inject the html code for the nav targets
|
||||
* @param mixed $mainNav
|
||||
* @return void
|
||||
*/
|
||||
function mainNavTargets($mainNav){
|
||||
echo('<ul id="nav-mobile" class="right">');
|
||||
foreach($mainNav as $nav){
|
||||
echo('<li>');
|
||||
echo('<a');
|
||||
echo(' href="' . $nav['url']. '"');
|
||||
echo(' title="' . $nav['caption']. '"');
|
||||
echo('>');
|
||||
echo('<span>'.$nav['caption'].'</span>');
|
||||
echo('</a>');
|
||||
echo('</li>');
|
||||
}
|
||||
echo('</ul>');
|
||||
}
|
||||
|
||||
function main($sections, $wallpapers){
|
||||
foreach($sections as $idx => $section){
|
||||
echo(
|
||||
'<div class="parallax-container">'
|
||||
.'<div class="parallax">'
|
||||
.'<img'
|
||||
. ' class="lazyload" '
|
||||
. ' src="'.$wallpapers[$idx]['src'].'" '
|
||||
. ' data-src="'.$wallpapers[$idx]['data-src'].'" '
|
||||
.'>'
|
||||
.'</div>'
|
||||
.'</div>'
|
||||
);
|
||||
echo(
|
||||
'<div class="section">'.$section.'</div>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<link type="text/css" rel="stylesheet" href="/ressourcen/css/cwsvJudo.css">
|
||||
<!--Import materialize.css-->
|
||||
<!--Imports-->
|
||||
<!-- - materialize Framework -->
|
||||
<link type="text/css" rel="stylesheet" href="/ressourcen/css/materialize.min.css" media="screen,projection" />
|
||||
<!-- - cwsvJudo adjustments -->
|
||||
<link type="text/css" rel="stylesheet" href="/ressourcen/css/cwsvJudo.css">
|
||||
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
@@ -50,20 +101,7 @@ $wallpapers = [
|
||||
<a href="/" class="brand-logo">
|
||||
<span>cwsvJudo</span>
|
||||
</a>
|
||||
<?php // main nav targets
|
||||
echo('<ul id="nav-mobile" class="right">');
|
||||
foreach($mainNav as $nav){
|
||||
echo('<li>');
|
||||
echo('<a');
|
||||
echo(' href="' . $nav['url']);
|
||||
echo(' title="' . $nav['caption']);
|
||||
echo('>');
|
||||
echo('<span>'.$nav['caption'].'</span>');
|
||||
echo('</a>');
|
||||
echo('</li>');
|
||||
}
|
||||
echo('</ul>');
|
||||
?>
|
||||
<?php mainNavTargets($mainNav);?>
|
||||
</div>
|
||||
<!-- <div class="nav-content">
|
||||
$if(subNav)$
|
||||
@@ -92,43 +130,24 @@ $wallpapers = [
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<script>
|
||||
function postload(t){
|
||||
if(t.src !== t.getAttribute('data-src')){
|
||||
t.src = t.getAttribute('data-src');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
foreach($sections as $idx => $section){
|
||||
echo(
|
||||
'<div class="parallax-container">'
|
||||
.'<div class="parallax">'
|
||||
.'<img'
|
||||
. ' class="lazyload" '
|
||||
. ' src="'.$wallpapers[$idx]['src'].'" '
|
||||
. ' data-src="'.$wallpapers[$idx]['data-src'].'" '
|
||||
.'>'
|
||||
.'</div>'
|
||||
.'</div>'
|
||||
);
|
||||
echo(
|
||||
'<div class="section">'.$section.'</div>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
<?php main($sections, $wallpapers);?>
|
||||
</main>
|
||||
|
||||
<!--JavaScript at end of body for optimized loading-->
|
||||
<!-- Import external libraries -->
|
||||
<!-- - materialize framework -->
|
||||
<script type="text/javascript" src="/ressourcen/js/materialize.min.js"></script>
|
||||
<!-- - lazysizes -->
|
||||
<script type="text/javascript" src="/ressourcen/js/lazysizes.min.js"></script>
|
||||
<!-- Configure external libraries -->
|
||||
<!-- - materialize framework -->
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const elems = document.querySelectorAll('.parallax');
|
||||
const instances = M.Parallax.init(elems, {
|
||||
// specify options here
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -2,25 +2,28 @@
|
||||
require_once("config.php");
|
||||
|
||||
$config = json_decode(
|
||||
file_get_contents($home."/.local/config.json"),
|
||||
true
|
||||
json: file_get_contents(filename: $home."/.local/config.json"),
|
||||
associative: true
|
||||
);
|
||||
|
||||
$secrets = json_decode(
|
||||
file_get_contents($home."/.local/secrets.json"),
|
||||
true
|
||||
json: file_get_contents(filename: $home."/.local/secrets.json"),
|
||||
associative: true
|
||||
);
|
||||
|
||||
var_dump($config);
|
||||
|
||||
try {
|
||||
$conn = new PDO(
|
||||
"mysql:host=".$config['cwsvJudo']['db']['host'].";dbname=".$config['cwsvJudo']['db']['name'],
|
||||
$config['cwsvJudo']['db']['user'],
|
||||
$secrets['cwsvJudo']['db'][$config['cwsvJudo']['db']['user']]
|
||||
dsn: join(separator: ";",array: [
|
||||
"mysql:host=".$config['cwsvJudo']['db']['host'],
|
||||
"port=3306",
|
||||
"dbname=".$config['cwsvJudo']['db']['name']
|
||||
]),
|
||||
username: $config['cwsvJudo']['db']['user'],
|
||||
password: $secrets['cwsvJudo']['db'][$config['cwsvJudo']['db']['user']]
|
||||
);
|
||||
// set the PDO error mode to exception
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$conn->setAttribute(attribute: PDO::ATTR_ERRMODE, value: PDO::ERRMODE_EXCEPTION);
|
||||
echo "Connected successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user