From aacf94e1e736cc9b2d2835cf160c6ccc4df51f48 Mon Sep 17 00:00:00 2001 From: Table <romain.drouin@ensiie.fr> Date: Thu, 5 May 2016 14:56:59 +0200 Subject: [PATCH] Modification de l'utilisation de l'image pour simplifier --- app/controller/ProfilController.php | 1 + app/view/Profil/display.html | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/ProfilController.php b/app/controller/ProfilController.php index 37d6784..9d507c5 100644 --- a/app/controller/ProfilController.php +++ b/app/controller/ProfilController.php @@ -5,6 +5,7 @@ class ProfilController extends Controller { // classe de contrôleur pour l'affi $slug = $this->route["params"]["slug"]; // on récupère le "slug", en gros tout le reste de l'URL qui n'a pas encore servi // je précise que dans ce cas précis, le $slug ne contient que le pseudo du joueur sosu forme normalisée. Donc je pourrais renommer la variable $slug_joueur... $this->view->profil = Profil::getFromSlug($slug); // on utilise le modèle pour aller chercher en BDD le profil qui nous intéresse + $this->view->profil->avatar = $this->view->profil->avatar ? BASE_URL."/images/avatar/".$this->view->profil->slug.".jpg": BASE_URL."/images/profil_42.jpg"; $this->view->display(); // on affiche ce profil } } diff --git a/app/view/Profil/display.html b/app/view/Profil/display.html index 069ef80..1566803 100644 --- a/app/view/Profil/display.html +++ b/app/view/Profil/display.html @@ -6,8 +6,7 @@ <article> <h2><?php echo $this->profil->pseudo; ?></h2> <aside class="profil-image"> - <?php $avatar = $this->profil->avatar ? BASE_URL."/images/avatar/".$this->profil->slug.".jpg": BASE_URL."/images/profil_42.jpg"; ?> - <img src="<?php echo $avatar; ?>" alt="Photo de profil de <?php echo $this->profil->pseudo; ?>" /> + <img src="<?php echo $this->profil->avatar; ?>" alt="Photo de profil de <?php echo $this->profil->pseudo; ?>" /> </aside> <div class="row"> <ul class="col-4 pref"> -- GitLab