PHP code example of dtkahl / php-page

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

    

dtkahl / php-page example snippets


$page = new \Dtkahl\Page\Page;

$page->meta->set('title', 'foobar');

 echo $page->renderMeta() 

$page->options->set('title_pattern', `%s | foobar.com`);

$page->addJavascript('script'); // ".js" automatically added

$page->addStylesheet('style'); // ".css" automatically added

 echo $page->renderJavascripts() 

 echo $page->renderStylesheets() 

$page->sections->set('foo', 'bar')

 echo $page->sections->get('foo') 

$page->area('sidebar')->push('bar')

 $page->area('sidebar')->each(function ($widget) {
      echo $widget;
  });