diff --git a/Models/RecipeModel.php b/Models/RecipeModel.php index c4fad86..07c63e4 100644 --- a/Models/RecipeModel.php +++ b/Models/RecipeModel.php @@ -147,6 +147,10 @@ final class RecipeModel return $this->A_APPRS; } + public function getSteps(){ + return explode("\n\n", str_replace("\r", "", $this->S_RECIPE)); + } + //TODO: return array object public static function searchRecipesByName($S_query) { diff --git a/Views/recipe/edit.php b/Views/recipe/edit.php index a2dd8f9..8cb218d 100644 --- a/Views/recipe/edit.php +++ b/Views/recipe/edit.php @@ -5,7 +5,7 @@ if ($O_recipe === null) { $S_name = null; $I_time = null; $S_descr = null; - $S_recipe = null; + $A_steps = array(); $S_difficultyName = null; $A_parts = array(); $A_ingredients = array(); @@ -13,7 +13,7 @@ if ($O_recipe === null) { $S_name = $O_recipe->S_NAME; $I_time = $O_recipe->I_TIME; $S_descr = $O_recipe->S_DESCR; - $S_recipe = $O_recipe->S_RECIPE; + $A_steps = $O_recipe->getSteps(); $S_difficultyName = $O_recipe->getDifficulty()->S_NAME; $A_parts = array(); // TODO $A_ingredients = $O_recipe->getIngredients(); @@ -109,28 +109,25 @@ if ($O_recipe === null) {