PHP code example of simettric / sense
1. Go to this page and download the library: Download simettric/sense 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/ */
simettric / sense example snippets
class TestController extends AbstractController{
/**
* @Route("/profile/{name_slug}", name="profile_detail")
*/
function demoAction($name_slug, \WP_Query $wp_query, \Request $request) {
$repository = $this->get("repository.user");
$user = $repository->findBy("username", $name_slug);
return $this->resultTemplate('User/profile.php', array(
"user" => $user
));
}
}
//your-plugin-path/View/User/profile.php
get_header();
$user = sense_view()->get("user");