PHP code example of ahmjw / php-dom-view

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

    

ahmjw / php-dom-view example snippets


composer 

php composer.phar install




$view_data = array(
  'title' => 'People',
  'people' => array(
    array(
      'name' => 'Adam Smith',
      'nationality' => 'USA'
     ),
    array(
      'name' => 'Kenji Yamada',
      'nationality' => 'Japan'
     ),
    array(
      'name' => 'Surya Wijaya',
      'nationality' => 'Indonesia'
     )
   )
);

$layout_data = array(
  'meta_title' => 'My Blog',
);

$links = array(
  array('link' => array('Link 1', 'href' => '#first')),
  array('link' => array('Link 2', 'href' => '#second')),
  array('link' => array('Link 3', 'href' => '#third')),
);

$layout->renderWidget('sidebar', array(
  new View('menu', array(
    'menu_title' => 'My Menu',
    'links' => $links
  )),
));