Download the PHP package chemaclass/knob-base without Composer
On this page you can find all versions of the php package chemaclass/knob-base. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chemaclass/knob-base
More information about chemaclass/knob-base
Files in chemaclass/knob-base
Package knob-base
Short Description Project base to use Knob MVC PHP Framework.
License MIT
Homepage http://knob.chemaclass.com
Informations about the package knob-base
README
What's this repository?
- Knob-base: project base to use Knob MVC PHP Framework
- This is a PHP MVC Framework to create WordPress templates easier and funnier than ever before.
- Author: José María Valera Reales
Knob-base is the kernel from Knob-mvc
- This is a Framework based on MVC pattern.
- Knob-base should not be focus on any style of the page, but deal with WP and provide models instead.
- Inspired by latest frameworks we have nowadays for web development such Symfony or Laravel.
- Regarding any question about WP kernel: take a look the official WP documentation: WP Codex and WP Reference.
Creating basic controllers and views
HomeController
: Controller for all files from WP:- author.php
->getAuthor()
: render thebase/author.mustache
template - archive.php
->getArchive()
: render thebase/search.mustache
template - category.php
->getCategory()
: render thebase/search.mustache
template - home.php
->getHome()
: render thebase/home.mustache
template - search.php
->getSearch()
: render thebase/search.mustache
template - single.php
->getSingle($type = 'post')
: render thebase/[post|page].mustache
template - tag.php
->getTag()
: render thebase/search.mustache
template - 404.php
->get404()
: render thebase/error_404.mustache
template
- author.php
Calling a controller from a WordPress template page.
Create a template for WordPress, for example single.php which is used when a Post is loaded.
Models to get all values from your DB
-
You can find all models as Entities from your DB in 'Knob\Models' (src/models/ directory). For example
Post
: -
You will be provided with libraries to prepare your
Actions
andFilters
(from WordPress). For exampleActions
: -
Also you will be able to create your own widgets as new models. You have the basics in
Knob\Widgets
(src/widgets/ directory). For example PagesWidget: - All of these on the best&easy way ever in
Knob\libs
(src/libs/ directory)
Views based on Mustache templates
- All you have to care basically are your templates. That's why we choose Mustache. Is simple, flexible and fun.
Controllers to pull everything together
- From
Knob\Controllers
(src/controllers/ directory) -
You will be provided a
Knob\Controllers\BaseController
to extends your own controllers. - Then your
HomeController
could seems like:
Before the start... you'll need!
Install ruby and compass
- sudo apt-get install ruby
- sudo gem update --system
- sudo apt-get install ruby1.9.1-dev
- sudo gem install compass
- sudo gem install rake
Then, you will be able to compile the scss in the directory of your project:
- /knob-mvc $> rake watch_scss
You'll need a PHP graphics library to be able to use the image editor:
- apt-get install php-imagick php7.0-gd
- service apache2 reload