Welcome Guest, Not a member yet? Register   Sign In
Cutter Template Library (CI3)
#1

(This post was last modified: 04-18-2017, 08:57 PM by anovsiradj.)

Hello everyone.., I want to share my library for template view. It's called Cutter. For CI3 only

Basically it was extending CI core view, and add more functionalty on it.

main functionalty on this library is (i dont know what it's called) block-template.


TL;DR. example:

PHP Code:
class Homepage extends CI_Controller {

    public function 
index()
    {
        
$offset 10;
        
$this->cutter->view('post/list', array('pagination_current_offset' => $offset));
    }


create file layout.cutter.php in view directory.

PHP Code:
<!DOCTYPE html>
<
html>
<
head>
    <
link rel="stylesheet" href="assets/style.css"/>
    <?
php cutter_field('css-section'?>
</head>
<body>
    <section>
        <?php cutter_field('content-section'?>
    </section>

    <script src="assets/main.js"></script>
    <?php cutter_field('js-section'?>
</body>
</html> 


and then, create file post/list.cutter.php in view directory

PHP Code:
<?php cutter_start('content-section'?>
    <ul>
        <li>new codeigniter release</li>
        <li>how to make fancy-cool website</li>
        <li>my first post</li>
    </ul>
<?php cutter_end() ?>


<?php cutter_start('js-section'?>
<script>
$.ajax('/service/data', function() {
    console.log('ok');
});
</script>
<?php cutter_end() ?>


<?php cutter_start('css-section'?>
<link rel="stylesheet" href="assets/custom.css"/>
<?php cutter_end() ?>

you can get the library at: https://github.com/anovsiradj/codeigniter-cutter

that's all.   Big Grin sorry for my english
Reply




Theme © iAndrew 2016 - Forum software by © MyBB