PHP code example of vutran / wpmvc-core

1. Go to this page and download the library: Download vutran/wpmvc-core 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/ */

    

vutran / wpmvc-core example snippets




// Instantiate the framework
$app = new \WPMVC\Common\Bootstrap(array(
    'templatePath' => TEMPLATEPATH,
    'templateDir' => str_replace(WP_CONTENT_DIR, '', WP_CONTENT_URL . TEMPLATEPATH),
    'templateUrl' => get_template_directory_uri()
));

// Create a view
$myView = $app->createView('slug-a/slug-b');

// set view variables
$myView->set([
  'foo' => 'Hello',
  'bar' => 'World',
]);

// prints the view
echo $myView->output();



echo $foo . ' ' . $bar;

// outputs "Hello World";