PHP code example of openclerk / pages

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

    

openclerk / pages example snippets


// inc/global.php

use \Pages\PageRenderer;
use \Openclerk\Router;

PageRenderer::addTemplatesLocation(__DIR__ . "/../templates");
PageRenderer::addStylesheet(Router::urlFor("css/default.css"));
PageRenderer::addJavascript(Router::urlFor("js/default.js"));


// templates/index.php

if ($user) {
  echo "<h2>Logged in successfully as $user</h2>";
} else {
  echo "<h2>Could not log in</a>";
}

// site/index.php

use \Pages\PageRenderer;

$user = get_user();

PageRenderer::header(array("title" => "My page title"));
PageRenderer::