Correction de bugs

This commit is contained in:
stiti 2024-05-19 15:57:25 +02:00
parent 14b260fb6c
commit 03e1f43d2d
5 changed files with 12 additions and 8 deletions

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own. | a PHP script and you can easily do that on your own.
| |
*/ */
$config['base_url'] = '/~stiti/SAE2.02/CodeIgniter-3.1.13'; $config['base_url'] = '/~stiti/SAE_2.02/CodeIgniter-3.1.13';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -49,6 +49,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| Examples: my-controller/index -> my_controller/index | Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method | my-controller/my-method -> my_controller/my_method
*/ */
$route['default_controller'] = 'albums'; $route['default_controller'] = 'home';
$route['404_override'] = ''; $route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE; $route['translate_uri_dashes'] = FALSE;
$route['albums'] = 'albums/index';

View File

@ -9,16 +9,16 @@ class Albums extends CI_Controller {
// Load the URL Helper // Load the URL Helper
$this->load->helper('url'); $this->load->helper('url');
} }
public function index($page = 1){ public function index(){
$page = 1;
$limit = 21; $limit = 21;
$offset = ($page - 1) * $limit; $offset = ($page - 1) * $limit;
$albums = $this->model_music->getAlbums($limit, $offset); $albums = $this->model_music->getAlbums($limit, $offset);
// Pass pagination information to view
$total_albums = $this->model_music->get_total_albums(); $total_albums = $this->model_music->get_total_albums();
$data['total_pages'] = ceil($total_albums / $limit); $data['total_pages'] = ceil($total_albums / $limit);
$data['current_page'] = $page; $data['current_page'] = $page;
$data['albums'] = $albums; // Pass albums data to view $data['albums'] = $albums;
$this->load->view('layout/header_not_logged_dark'); $this->load->view('layout/header_not_logged_dark');
$this->load->view('albums_list', $data); $this->load->view('albums_list', $data);

View File

@ -5,11 +5,15 @@ public function index() {
// Charger le modèle // Charger le modèle
$this->load->model('Cover_model'); $this->load->model('Cover_model');
$this->load->helper('url');
// Appeler la fonction pour récupérer les couvertures d'albums // Appeler la fonction pour récupérer les couvertures d'albums
$data['covers'] = $this->Cover_model->get_covers(); $data['covers'] = $this->Cover_model->get_covers();
// Charger la vue avec les données récupérées // Charger la vue avec les données récupérées
$this->load->view('layout/header_not_logged_dark');
$this->load->view('accueil', $data); $this->load->view('accueil', $data);
$this->load->view('layout/footer_dark');
} }
} }

View File

@ -1,6 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<?php include 'layout/header_not_logged_dark.php'; ?>
<head> <head>
<link rel="stylesheet" href="assets/css/accueil.css"> <link rel="stylesheet" href="assets/css/accueil.css">
<link rel="icon" type="image/x-icon" href="assets/img/Logo_ONZEUR.png"> <link rel="icon" type="image/x-icon" href="assets/img/Logo_ONZEUR.png">
@ -11,7 +10,7 @@
<div class="hero"> <div class="hero">
<h1>Bienvenue sur Onzeur !</h1> <h1>Bienvenue sur Onzeur !</h1>
<p>Le service de streaming musical numéro 1 en France.</p> <p>Le service de streaming musical numéro 1 en France.</p>
<button type="button">Accéder à la musique</button> <a href="<?php echo base_url('albums'); ?>"><button type="button">Accéder à la musique</button></a>
</div> </div>
<div class="container"> <div class="container">
@ -73,6 +72,5 @@
</form> </form>
</div> </div>
</div> </div>
<?php include 'layout/footer_dark.php'; ?>
</body> </body>
</html> </html>