PHP code example of nikomtis / phbeam

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

    

nikomtis / phbeam example snippets




return [
    '' => [
        'file' => 'home',
        'name' => 'Home',
        'layout' => '',
        'body_class' => '',
    ],
];



return [
    '' => [
        'file' => 'home',
        'name' => 'Home',
        'layout' => '',
        'body_class' => '',
    ],
    'about' => [ // Page will be available on example.com/about
        'file' => 'about', // Page file with HTML code is "content/about.php"
        'name' => 'About us', // We want this name in navigation menu
    ]
];

...
'menus' => [
    'main',
    'secondary', // Separate menu for sidebar
],
...



return [
    'sidebar' => [
        'navbar'
    ]
];



return [
    'sidebar' => [
        'navbar',
        'fancy_title' => [
            'text' => 'Home', // $params['text'] in the module file
            'image' => '/img/home.jpg' // $params['image']
        ]
    ]
];



return [
    'allowed_url_params' => [
        'yclid',
    ],
    ...
];



return [
    'iphone_x_256_silver' => [
        'name' => 'iPhone X 256GB Silver',
        'image' => '/img/catalog/iphones/iphone_x_256_silver.png',
        'memory' => '256',
        'display' => '5,8',
    ],
    'iphone_8_64_gold' => [
        'name' => 'iPhone 8 64GB Gold',
        'image' => '/img/catalog/iphones/iphone_8_64_gold.png',
        'memory' => '64',
        'display' => '4,7',
    ],
];
html
<head>
    ...
     phb_insert_css('main'); 
html
 phb_insert_js('main'); 
html
<div class="container">
     echo $GLOBALS['article']; 
html
<ul class="nav">
     foreach ($GLOBALS['menu_main'] as $alias => $menu_item): 
html
<div class="container">
     if (phb_get_position_modules('sidebar')): 
html
<div class="fancy-title" style="background-image: url( echo $params['image']; 
html
 phb_insert_module('fancy_title', ['text' => 'Home', 'image' => '/img/home.jpg']); 
html
<div class="catalog">
     foreach (phb_get_data_from_php("resources/catalog_{$params['category']}") as $key => $product): 
 phb_insert_module('navbar'); 
 phb_insert_position('sidebar'); 
 phb_insert_module('catalog', ['category' => 'iphones']);