示例#1
0
 function formatPrice($price, $default = "")
 {
     if (!empty($price)) {
         //decode charset before using number_format
         $charset = 'UTF-8';
         $decimal_separator = modJeaEmphasisNewestHelper::getComponentParam('decimals_separator', ',');
         $thousands_separator = modJeaEmphasisNewestHelper::getComponentParam('thousands_separator', ' ');
         $currency_symbol = modJeaEmphasisNewestHelper::getComponentParam('currency_symbol', '€');
         $symbol_place = modJeaEmphasisNewestHelper::getComponentParam('symbol_place', 1);
         jimport('joomla.utilities.string');
         if (function_exists('iconv')) {
             $decimal_separator = JString::transcode($decimal_separator, $charset, 'ISO-8859-1');
             $thousands_separator = JString::transcode($thousands_separator, $charset, 'ISO-8859-1');
         } else {
             $decimal_separator = utf8_decode($decimal_separator);
             $thousands_separator = utf8_decode($thousands_separator);
         }
         $price = number_format($price, 0, $decimal_separator, $thousands_separator);
         //re-encode
         if (function_exists('iconv')) {
             $price = JString::transcode($price, 'ISO-8859-1', $charset);
         } else {
             $price = utf8_encode($price);
         }
         //is currency symbol before or after price?
         if ($symbol_place == 1) {
             return htmlentities($price . ' ' . $currency_symbol, ENT_COMPAT, $charset);
         } else {
             return htmlentities($currency_symbol . ' ' . $price, ENT_COMPAT, $charset);
         }
     } else {
         return $default;
     }
 }
<?php

/**
 * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency
 *
 * @version		1.2 2008-07
 * @package		Jea.module.emphasis
 * @copyright	Copyright (C) 2008 PHILIP Sylvain. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla Estate Agency is free software. This version may have been modified pursuant to the
 * GNU General Public License, and as distributed it includes or is derivative
 * of works licensed under the GNU General Public License or other free or open
 * source software licenses.
 *
 */
defined('_JEXEC') or die('Restricted access');
require_once dirname(__FILE__) . DS . 'helper.php';
$params->set('surface_measure', modJeaEmphasisNewestHelper::getComponentParam('surface_measure'));
$rows = modJeaEmphasisNewestHelper::getList($params);
require JModuleHelper::getLayoutPath('mod_jea_emphasis_newest');