PHP code example of venca-x / nette-stargazer

1. Go to this page and download the library: Download venca-x/nette-stargazer 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/ */

    

venca-x / nette-stargazer example snippets


protected function beforeRender()
{
    parent::beforeRender();

    $this->template->addFilter('stargazer', function ($text) {
        //$stargazer = new VencaX\Stargazer('<i class="fa fa-star"></i>', '<i class="fa fa-star-o"></i>');
        //$stargazer = new VencaX\Stargazer();
        $stargazer = new VencaX\Stargazer($star = "1", $starEmpty = "0", $starCount = 10);
        return $stargazer->makeStargazer($text);
    });
}

protected function renderDefault()
{
    $this->template->score = 5;
}

{$o->score|stargazer|noescape}
{$o->score|stargazer}