PHP code example of nowise / uup-site

1. Go to this page and download the library: Download nowise/uup-site 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/ */

    

nowise / uup-site example snippets


// 
// Assume virtual host defines include path to root directory:
// 
Page
{
    // Define the printContent() member function at least.
};

$page = new IndexPage();
$page->render();

// 
// The dispatcher.php (router) has already setup autoloading, no need
// to explicit call render() either.
// 
class IndexPage extends StandardPage
{
    // Define the printContent() member function at least.
};

$router = new Router();
$router->setNamespace("\\");                        // Use global namespace
$router->handle();

$router = new Router();
$router->setNamespace("\\MyApp\\Controllers\\");    // Harmonize with application namespace
$router->handle();

class MyPage extends StandardPage
{

    public function __construct()
    {
        parent::__construct(_("My page"));
        $this->locale->setTextDomain("dir2");
    }
     
}

// 
// Naive example support for LDAP using hypotetical object:
// 
'edit' => array(
    'user' => function($user) use($ldap) {
        return $ldap->exist(array('uid' => $user));
    },
)