PHP code example of kykurniawan / rangkai

1. Go to this page and download the library: Download kykurniawan/rangkai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kykurniawan / rangkai example snippets




use Kykurniawan\Rangkai\Rangkai;

// Create new Rangkai instance with provided views path where we store the view file.
$rangkai = new Rangkai('Views');
// Set some data to our view
$rangkai->setData(['name' => 'Gumbili Project']);
// Display our view with echo
// Note: "page" is file path relative to views path
// if your page in Views/home/page.php, you should use "home/page" instead of "page"
echo $rangkai->render('page');


 $this->
html
<!-- layout.php -->

<html>
    <head>
        <title>Rangkai</title>
    </head>
    <body>
        <header>
            <!-- Assume your header here -->
        </header>
        <main>
            <!-- Here we will place the content -->
             $this->renderSection('content') 
html
<!-- home.php -->
 $this->extend('layout') 
html
<!-- layout.php -->

<html>
    <head>
        <title>Rangkai</title>
    </head>
    <body>
        <header>
            <!-- We are including header here -->
             $this->