<?php

//format number
if(!function_exists('numberFormat')){
    function numberFormat($number,$excepDigitGroup=true){
        $output = $number;
        if($excepDigitGroup){
            $output = number_format($number,(floor($number) == $number ? 0 : 2),'.',' ');
        }
        return $output;
    }
}

//fetch template
if(!function_exists('fetchTpl')){
    function fetchTpl($tpl){
        global $modx;
        $template = "";
        if(substr($tpl, 0, 6) == "@FILE:"){
            $tpl_file = MODX_BASE_PATH . substr($tpl, 6); //todo: error
            $template = file_get_contents($tpl_file);
        }else if(substr($tpl, 0, 6) == "@CODE:"){
            $template = substr($tpl, 6);
        }else if($modx->getChunk($tpl) != ""){
            $template = $modx->getChunk($tpl);
        }else{
            $template = false;
        }
        return $template;
    }
}

?>