Version 1.1

This commit is contained in:
mmk2410 2015-02-24 23:05:30 +01:00
parent e1bbbfb117
commit 016eecebd8
3 changed files with 57 additions and 8 deletions

View file

@ -27,19 +27,25 @@
<!--Set here the link to your Homepage or delete the following line--> <!--Set here the link to your Homepage or delete the following line-->
<a href="../" class="home">Home</a> <a href="../" class="home">Home</a>
</div> </div>
<!-- This is the Intro section. You can set your intro text in md/intro.md. In case you don't want an intro delete this whole section until the next comment-->
<section> <section>
<span class="text"> <span class="text">
<?php <?php
require_once 'res/Parsedown.php'; require_once 'res/Parsedown.php';
require_once 'res/umlautconverter.php';
if(file_exists('md/intro.md')){ if(file_exists('md/intro.md')){
$file = file_get_contents('md/intro.md'); $file = file_get_contents('md/intro.md');
echo Parsedown::instance() $intro = Parsedown::instance()
->setBreaksEnabled(true) ->setBreaksEnabled(true)
->text($file); ->text($file);
$UmlautConverter = new UmlautConverter;
$intro = $UmlautConverter->convert($intro);
echo $intro;
} }
?> ?>
</span> </span>
</section> </section>
<!-- In case you don't want a Intro section delete the above section-->
<!--DON'T CHANGE ANYTHING HERE!--> <!--DON'T CHANGE ANYTHING HERE!-->
<?php <?php
$xml = simplexml_load_file('xml/posts.xml'); $xml = simplexml_load_file('xml/posts.xml');
@ -50,19 +56,28 @@
<section> <section>
<p class="texttitle"> <p class="texttitle">
<?php <?php
echo $post->title; $title = $post->title;
$UmlautConverter = new UmlautConverter;
$title = $UmlautConverter->convert($title);
echo $title;
?> ?>
</p> </p>
<small> <small>
<?php <?php
echo $post->pubdate; $pubdate = $post->pubdate;
$UmlautConverter = new UmlautConverter;
$pubdate = $UmlautConverter->convert($pubdate);
echo $pubdate;
?> ?>
</small> </small>
<p class="text"> <p class="text">
<?php <?php
echo Parsedown::instance() $content = Parsedown::instance()
->setBreaksEnabled(true) ->setBreaksEnabled(true)
->text($post->content); ->text($post->content);
$UmlautConverter = new UmlautConverter;
$content = $UmlautConverter->convert($content);
echo $content;
?> ?>
</p> </p>
<p align="right"> <p align="right">
@ -71,11 +86,17 @@
?> ?>
<a class="button_white" target="_blank" href=" <a class="button_white" target="_blank" href="
<?php <?php
echo $olb->otherurl; $otherurl = $olb->otherurl;
$UmlautConverter = new UmlautConverter;
$otherurl = $UmlautConverter->convert($otherurl);
echo $otherurl;
?> ?>
"> ">
<?php <?php
echo $olb->otherlink; $otherlink = $olb->otherlink;
$UmlautConverter = new UmlautConverter;
$otherlink = $UmlautConverter->convert($otherlink);
echo $otherlink;
?> ?>
</a> </a>
<?php <?php
@ -84,11 +105,17 @@
?> ?>
<a class="button_color" target="_blank" href=" <a class="button_color" target="_blank" href="
<?php <?php
echo $post->mainurl; $mainurl = $post->mainurl;
$UmlautConverter = new UmlautConverter;
$mainurl = $UmlautConverter->convert($mainurl);
echo $mainurl;
?> ?>
"> ">
<?php <?php
echo $post->mainlink; $mainlink = $post->mainlink;
$UmlautConverter = new UmlautConverter;
$mainlink = $UmlautConverter->convert($mainlink);
echo $mainlink;
?> ?>
</a> </a>
<?php } ?> <?php } ?>

15
res/umlautconverter.php Normal file
View file

@ -0,0 +1,15 @@
<?php
class UmlautConverter
{
function convert($text)
{
$output = str_replace("ä","&auml;",$text);
$output = str_replace("Ä","&Auml;",$output);
$output = str_replace("ö","&ouml;",$output);
$output = str_replace("Ö","&Ouml;",$output);
$output = str_replace("ü","&uuml;",$output);
$output = str_replace("Ü","&Uuml;",$output);
$output = str_replace("ß","&szlig;",$output);
return $output;
}
}

View file

@ -1,5 +1,12 @@
<?xml version='1.0' standalone='yes'?> <?xml version='1.0' standalone='yes'?>
<posts> <posts>
<post>
<title>Version 1.1</title>
<pubdate>24th February 2015</pubdate>
<content>
After I published the Version 1.0 last sunday I realized some problems with german umlauts. Now I added a function that converts every umlaut (ü, Ü, ä, Ä, ö, Ö and ß) into the html code.
</content>
</post>
<post> <post>
<title>Version 1.0</title> <title>Version 1.0</title>
<pubdate>22nd February 2015</pubdate> <pubdate>22nd February 2015</pubdate>