dev-master
9999999-dev http://www.waga.itAn helper component for MVC in Wordpress
GPL-2.0+
The Requires
by Waga Team
An helper component for MVC in Wordpress
MVC paradigm for Wordpress templates., (*1)
This component provide the ability to effectively split code from templates in Wordpress., (*2)
HTMLView is the default view type provided by component. You can use is to display HTML templates., (*3)
$v = new \WBF\components\mvc\HTMLView("path/to/template.php");
$vars = [ 'title' => "Hello World" ]; $v->display();
<?php echo $title; ?>
The View has some really interesting features:, (*4)
php
//If you are in a twentysixteen child called "foobar"...
$v = new \WBF\components\mvc\HTMLView("path/to/template.php");
/* Will looking for (in order):
/wp-content/themes/foobar/path/to/template.php
/wp-content/themes/twentysixteen/path/to/template.php
*/
require
.$v = new \WBF\components\mvc\HTMLView("path/to/template.php"); $v->for_dashboars()->display([ 'page_title' => "My awesome title", 'my_name' => "Maya" ]);
With template.php:, (*5)
Hello <?php echo $my_name ?>!
Will display:, (*6)
<div class="wrap"> <h1>My awesome title</h1> Hello Maya! </div>
$v = new \WBF\components\mvc\HTMLView("path/to/template.php"); $v->display([ 'page_title' => "My awesome title", 'wrapper_class' => "my_wrap", 'wrapper_el' => "section" 'title_wrapper' => "<span>%s</span>" 'my_name' => "Maya" ]);
With template.php:, (*7)
Hello <?php echo $my_name ?>!
Will display:, (*8)
<section class="my_wrap"> <span>My awesome title</span> Hello Maya! </section>
An helper component for MVC in Wordpress
GPL-2.0+