Code Monkey home page Code Monkey logo

cihmvcparser's Introduction

Codeigniter 3.1.10 + Templating Parser + HMVC

This library used original templating engine from Codeigniter to provide the clean php code

Introduction to Codeigniter

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

Read more about codeigniter - https://www.codeigniter.com/

Introduction to HMVC

Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications. HMVC stands for Hierarchical Model View Controller. Module Controllers can be used as normal Controllers or HMVC Controllers and they can be used as widgets to help you build view partials.

Read more about HMVC - https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/src/codeigniter-3.x/

Installation Process

  1. Clone by "git clone https://github.com/we-pe/cihmvcparser.git" or download this repository to your local server
  2. Hit the url by browser "http://localhost/cihmvcparser"

Usage

  <!DOCTYPE html>
  <html lang="en">
  <head>
    {header}
  </head>
  <body>
    {content}
  </body>
  </html>

.htaccess file to remove the index.php form urls

   <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

My_Controller.php in application/core

<?php
 defined('BASEPATH') OR exit('No direct script access allowed');
   class MY_Controller extends CI_Controller {

       protected $data = array();

       function __construct(){
           parent::__construct();
           $this->load->library('parser');
       }

       protected function load_page($content=null, $layout=true){
           if ($layout==true){
             $this->data['header'] = $this->parser->parse('partials/header', $this->data, TRUE);
             $this->data['content'] = (is_null($content)) ? '' : $this->parser->parse($content, $this->data, TRUE);
             $this->parser->parse('index', $this->data);
           }
           else {
             $this->parser->parse($content, $this->data);
           }
       }
   }

Welcome.php in application/modules/welcome/controllers

  class Welcome extends MY_Controller {
    public function index(){
      $this->data = array(
        'blog_title' => 'Welcome to CodeIgniter',
        'blog_heading' => 'Welcome to CodeIgniter with HMVC and Parser Library!'
      );
      $this->load_page('welcome/message');
    }
  }

message.php in application/modules/welcome/views

  {blog_heading}

For any query please contact via email at [email protected] or facebook at https://www.facebook.com/bagoes.we.pe

cihmvcparser's People

Contributors

we-pe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.