<commit_before># README #

### What's this repository? ###

* Knob MVC
* This is a PHP MVC Framework for creating Wordpress templates easier and with more fun than ever before.
* Version: 2.0
* Author <NAME>

### You'll need [Knob-base](https://github.com/Chemaclass/knob-base/)

You will need install via [Composer](https://getcomposer.org/) the Knob core structure. 

### Views based on Mustache templates

You create views using [Mustache](http://mustache.github.com/).

Here is an example of a header template that displays the above data.

```html
<!DOCTYPE html>
  <html lang="{{currentLang}}">
  <head>
    <title>{{{blogTitle}}}</title>
    <meta charset="{{blogCharset}}">
    <link rel="icon" type="image/x-icon" href="{{publicDir}}/img/favicon.ico">    
    <link media="all" rel="stylesheet" href="{{publicDir}}/css/main.css">
    <script src="{{publicDir}}/js/main.js"></script>
```

### Controllers to pull everything together

A controller talks to the data helpers, loads the mustache template and can then be called from your WordPress template files.

Here's a sample function from a controller that loads all posts, limited by 'posts per page', into the home template.

```php
/**
 * home.php
 */
public function getHome() {
	$args = [
		'posts' => Post::getAll(get_option('posts_per_page'))
	];
	return $this->renderPage('home', $args);
}
```

## Creating basic controllers and views

All controllers are inside mvc/controllers.

* BaseController -> All controller should extend from this one

* AjaxController: Controller for ajax petitions.
* BackendController: Controller  for backend stuff.
* HomeController: Controller for all files from WP:
	- author.php -> getAuthor()
	- archive.php -> getArchive()
	- category.php -> getCategory()
	- home.php -> getHome()
	- index.php -> getIndex()
	- search.php -> getSearch()
	- single.php -> getSingle()
	- tag.php -> getTag()
	
* WidgetController: Controller for register all wigdets using the setup() function. 

### Calling a controller from a WordPress template page.
All this files are already created by Knob-base. So you just need to override the function in your HomeController.

[Create a template for WordPress](http://codex.wordpress.org/Template_Hierarchy), for example single.php which is used when a Post is loaded.

```php<commit_msg>fixed some syntax bugs<commit_after># README #

### What's this repository? ###

* Knob MVC
* This is a PHP MVC Framework for creating Wordpress templates easier and with more fun than ever before.
* Version: 2.0
* Author <NAME>

### You'll need [Knob-base](https://github.com/Chemaclass/knob-base/)

You will need install via [Composer](https://getcomposer.org/) the Knob core structure. 

### Views based on Mustache templates

You create views using [Mustache](http://mustache.github.com/).

Here is an example of a header template that displays the above data.

```html
<!DOCTYPE html>
  <html lang="{{currentLang}}">
  <head>
    <title>{{{blogTitle}}}</title>
    <meta charset="{{blogCharset}}">
    <link rel="icon" type="image/x-icon" href="{{publicDir}}/img/favicon.ico">    
    <link media="all" rel="stylesheet" href="{{publicDir}}/css/main.css">
    <script src="{{publicDir}}/js/main.js"></script>
```

### Controllers to pull everything together

A controller talks to the data helpers, loads the mustache template and can then be called from your WordPress template files.

Here's a sample function from a controller that loads all posts, limited by 'posts per page', into the home template.

```php
/**
 * home.php
 */
public function getHome() {
	$args = [
		'posts' => Post::getAll(get_option('posts_per_page'))
	];
	return $this->renderPage('home', $args);
}
```

## Creating basic controllers and views

All controllers are inside mvc/controllers.

* BaseController: All controller should extend from this one.
* AjaxController: Controller for ajax petitions.
* BackendController: Controller  for backend stuff.
* HomeController: Controller for all files from WP:
	- author.php -> getAuthor()
	- archive.php -> getArchive()
	- category.php -> getCategory()
	- home.php -> getHome()
	- index.php -> getIndex()
	- search.php -> getSearch()
	- single.php -> getSingle()
	- tag.php -> getTag()
	
* WidgetController: Controller for register all widgets using the setup() function. 

### Calling a controller from a WordPress template page.
All this files are already created by [Knob-base](https://github.com/Chemaclass/knob-base/). So you just need to override the function in your HomeController.

[Create a template for WordPress](http://codex.wordpress.org/Template_Hierarchy), for example single.php which is used when a Post is loaded.

```php
{'fraction_non_alphanumeric': 0.13245033112582782, 'fraction_numerical': 0.0008545182653279214, 'mean_word_length': 4.278466741826381, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 46, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '997018', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1337, 'n_words': 494}