PHP code example of gorriecoe / silverstripe-sreg

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

    

gorriecoe / silverstripe-sreg example snippets


class MyObject extends DataObject
{
    private static $has_one = [
        'Relation' => 'SomeObject',
        'AFallBack' => 'SomeObject',
    ];

    public function SomeFunction()
    {
        return 'Some text';
    }

    public function getValue()
    {
        return $this->sreg('Lorem ipsum {$Relation.Title|AFallBack.Title|Fall back text} {$SomeFunction}');
    }
}