The best practice would be to leave the resource calls in the View, as it is to her that they will serve.
Just like @leonardopessoa commented on your question, you can create templates that provide common parts to the main template, for example:
application/views/header.php
<!DOCTYPE html>
<html>
<head>
<title>Hello World - Template</title>
<link rel="stylesheet" href="folha_de_estilo_main_para_todos.css">
</head>
<body>
Applications/views/footer.php
<script src="script_main_para_todos.js"></script>
</body>
</html>
Applications/views/page_personal.php
<p>
Hello world - Template do método personal!
</p>
Applications/views/page_contact.php
<p>
Hello again, world - Template do método contact!
</p>
<script src="script_customizado_apenas_para_este_template.js"></script>
Applications/controllers/pages.php
class Pages extends CI_Controller {
public function index()
{
$this->load->view('header');
$this->load->view('page_personal');
$this->load->view('footer');
}
}
public function contact()
{
$this->load->view('header');
$this->load->view('page_contact');
$this->load->view('footer');
}
}
Well, I believe that there is no ideal way, but in my opinion, this would be the best way to organize resources in an MVC application, mainly applications with Codeigniter, which does not provide such cool helpers so to do this.
I used code snippets of the following link to write this answer, in it can be found another way to implement templates in CI, but I did not find anything interesting: https://code.tutsplus.com/tutorials/an-introduction-to-views-templating-in-codeigniter--net-25648
You can make a template structure, where you would have a base template (menu, footer and the required Imports) and others would include it and any other additional Imports.
– Leonardo Pessoa