CodeIgniter Forums
Template View Library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: Template View Library (/showthread.php?tid=75695)



Template View Library - MatheusCastro - 03-06-2020

Hello everyone

Below is a library that makes it easy to work with templates in Codeigniter 4

How would you upload it using this library:

PHP Code:
  public function index()
        {
                $data = [
                        'page_title' => 'Your title'
                ];

                // Here
                $this->template->load('template_name''page_name'$data)
        

Link is here: <https://github.com/matheuscastroweb/ci4-template-view>


RE: Template View Library - kilishan - 03-06-2020

I think you may have missed the new View Layouts in CI4.


RE: Template View Library - MatheusCastro - 03-06-2020

(03-06-2020, 02:06 PM)kilishan Wrote: I think you may have missed the new View Layouts in CI4.

Hello, kilishan

I didn't like the views layouts so much.

The need to add in each view affects the maintenance issue.

I used this library in Codeigniter v3, I rewrote it for use in v4 because I found it practical and useful.

As I understand it, the use of:

PHP Code:
<?= $this->extend('default'?>

It can be used only inside the View, in my opinion, this is more practical in the Controllers, leaving the View files just to "display", very transparent.

Well, of course this is a personal opinion. Anyway, I decided to share the Library with those interested.


RE: Template View Library - kilishan - 03-06-2020

No worries. Just wanted to make sure you had seen it and it sounds like you have. So thanks for sharing your library with us!