PHP code example of mvccore / ext-view-helper

1. Go to this page and download the library: Download mvccore/ext-view-helper 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/ */

    

mvccore / ext-view-helper example snippets


// located in `/App/Views/Helpers/FormatNumber.php`

namespace App\Views\Helpers;

class FormatNumber {
	public function FormatNumber ($number) { // $number = 1234.56;
		return number_format($number); // english notation - 1,234
	}
}

// located in `/App/Views/Helpers/FormatNumber.php`

namespace App\Views\Helpers;

class FormatNumber extends \MvcCore\Ext\Views\Helpers\AbstractHelper
	public function FormatNumber ($number) { // $number = 1234.56;
		if ($this->request->GetLang() == 'fr') {
			return number_format($number, 2, ',', ' '); // french notation: 1 234,56
		} else {
			return number_format($number); // english notation: 1,234
		}
	}
}