Commit 3940a174 authored by Karl Hasselbring's avatar Karl Hasselbring

Tips.xml wird von quicktip server geladen

parent 22b27f14
......@@ -6,6 +6,9 @@ use App;
use App\MetaGer;
use Illuminate\Http\Request;
#const TIP_SERVER = 'https://quicktips.metager3.de/tips.xml';
const TIP_SERVER = 'http://localhost:63825/tips.xml';
class MetaGerSearch extends Controller
{
public function search(Request $request, MetaGer $metager)
......@@ -70,4 +73,26 @@ class MetaGerSearch extends Controller
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
public function tips(Request $request)
{
$tips_text = file_get_contents(TIP_SERVER);
$tips = [];
try {
$tips_xml = simplexml_load_string($tips_text);
$tips_xml->registerXPathNamespace('mg', 'http://metager.de/tips/');
$tips_xml = $tips_xml->xpath('mg:tip');
foreach ($tips_xml as $tip_xml) {
$tips[] = $tip_xml->__toString();
}
} catch (\Exception $e) {
Log::error("A problem occurred loading tips from the tip server.");
Log::error($e->getMessage());
abort(500);
}
return view('tips')
->with('title', trans('tips.title'))
->with('tips', $tips);
}
}
......@@ -27,4 +27,5 @@ return [
'nav25' => 'MetaGer App',
'nav26' => 'MetaGer-Fanshop',
'navigationToggle' => 'Navigation anzeigen',
'titles.tips' => 'Tips',
];
<?php
return [
"title" => "MetaGer Tipps, unsortiert - dies & das - wussten Sie schon?",
"shorttitle" => "Wussten Sie schon?"
"title" => "MetaGer Tipps, unsortiert - wussten Sie schon?",
"shorttitle" => "Wussten Sie schon?",
];
......@@ -29,16 +29,16 @@
<a class="inlink" href="https://metager.de/klassik/asso/" tabindex="228">{{ trans('sidebar.nav11') }}</a>
</li>
<li>
<a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/app/") }}" tabindex="230">@lang('sidebar.nav25')</a>
<a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/app/") }}" tabindex="229">@lang('sidebar.nav25')</a>
</li>
<li>
<a class="inlink" href="https://metager.to/" tabindex="231">{{ trans('sidebar.nav13') }}</a>
<a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/tips/") }}" tabindex="230">{{ trans('sidebar.titles.tips') }}</a>
</li>
<li>
<a class="inlink" href="https://maps.metager.de" target="_blank" tabindex="232">Maps.MetaGer.de</a>
<a class="inlink" href="https://maps.metager.de" target="_blank" tabindex="231">Maps.MetaGer.de</a>
</li>
<li>
<a class="outlink" href="https://gitlab.metager3.de/open-source/MetaGer" tabindex="233">{{ trans('sidebar.nav24') }}</a>
<a class="outlink" href="https://gitlab.metager3.de/open-source/MetaGer" tabindex="232">{{ trans('sidebar.nav24') }}</a>
</li>
<li>
<a class="outlink" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/tor/") }}" tabindex="234">{{ trans('sidebar.nav14') }}</a>
......
@extends('layouts.staticPages')
@extends('layouts.subPages')
@section('title', $title )
@section('navbarFocus.tips', 'class="active"')
@section('content')
<h1>{!! trans('tips.title') !!}</h1>
<ol>
@foreach( $tips as $tip )
<li>{!! $tip !!}</li>
@endforeach
</ol>
<h1 class="page-title">{!! trans('tips.title') !!}</h1>
<div class="card-heavy">
<ol>
@foreach( $tips as $tip )
<li>{!! $tip !!}</li>
@endforeach
</ol>
</div>
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment