added parsedown function to recipe.php

This commit is contained in:
Tim Krehan 2018-10-24 18:24:05 +02:00
parent 6ee9372ca4
commit e2deee8fc8

View file

@ -2,6 +2,7 @@
<script src="/bin/recipe.js" charset="utf-8"></script> <script src="/bin/recipe.js" charset="utf-8"></script>
<?php <?php
include $_SESSION["docroot"].'/php/classes.recipe.php'; include $_SESSION["docroot"].'/php/classes.recipe.php';
include $_SESSION["docroot"].'/php/classes.parsedown.php';
$book = new cookbook; $book = new cookbook;
$book->getRecipe($_GET["number"]); $book->getRecipe($_GET["number"]);
$recipe = $book->sites[0]; $recipe = $book->sites[0];
@ -17,9 +18,13 @@
} }
echo "</div>"; echo "</div>";
echo "<h2>Zubereitung</h2>"; echo "<h2>Zubereitung</h2>";
foreach(explode("\r\n", $recipe->Beschreibung) as $paragraph){ $parsedown = new Parsedown;
echo "<p>$paragraph</p>"; // var_dump($recipe->Beschreibung);
} echo $parsedown->text($recipe->Beschreibung);
// foreach(explode("\r\n", $recipe->Beschreibung) as $paragraph){
// echo "<p>$paragraph</p>";
// }
?> ?>
<div id="editingMenu"></div> <div id="editingMenu"></div>
<div id="editingMenuOpen"> <div id="editingMenuOpen">