PHP code example of velosipedist / beatrix

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

    

velosipedist / beatrix example snippets


// inside of init.php
Beatrix::init(array(
	Beatrix::SETTINGS_TEMPLATES_DIR => $_SERVER['DOCUMENT_ROOT'].'/.tpl' // where to look for templates
	//... any Slim options are acceptable
));

Beatrix::app()->render('my/template', ['var1'=>$anyData, /* etc */]); // will seek /.tpl/my/template.php

Beatrix::layout()->setLayout('any/existing/template', ['varToBePassed'=>$var]);

// in any template or even outsid of it
Beatrix::layout()->setSection('name', $contents);

// news/index.php with .htaccess in same dir:
Beatrix::app()->get('/', function(){
  /* news list */
  Beatrix::app()->render('blade/template', ['var' => $val]);
});
Beatrix::app()->get('/:category+', function($category){/* news list inside category, optionally nested*/});
Beatrix::app()->get('/:category+/:id', function($category, $id){/* news detail */});

// in the end of page, start listening http requests captured with .htaccess
Beatrix::app()->run();

php phing-latest.phar

 Beatrix::templateHeader();

 Beatrix::templateFooter();