У меня есть Custom MVC и застрял на нумерации страниц.Пожалуйста, дайте мне код моей структуры MVC здесь.index-> controller-> model-> back-to-controller-> then-view.
Пожалуйста, помогите мне создать нумерацию страниц, чтобы соответствовать этому MVC.
Мой контроллер:
class Posts extends Controller{
public function __construct(){
$this->postModel = $this->model('Post');
}
public function index(){
$allpost = $this->postModel->getAllPosts();
$data = [
'posts' => $allpost,
];
$this->view('jobs/index', $data);}}
вот моя модель:
class Post {
private $db;
public function __construct(){
$this->db = new Database;
}
public function getAllPosts(){
$this->db->query('select * from posts where active = 0 ');
return $this->db->resultSet();
}
вот мой вид:
<?php foreach($data['allposts'] as $posts) : ?>
<div class="jobContent">
<div class="jobTitle">
<h5><a href="="><?= $posts->title; ?></a></h5>
</div>
<div class="cName">
<a href=""><?= $posts->des; ?></a>
</div>
</div>
<?php endforeach ;?>