31 lines
791 B
PHP
31 lines
791 B
PHP
<?php
|
|
|
|
/*
|
|
* Smarty plugin
|
|
* -------------------------------------------------------------
|
|
* File: block.change_currency.php
|
|
* Type: block
|
|
* Name: change_currency
|
|
* Purpose: Override active currency for content inside block
|
|
* -------------------------------------------------------------
|
|
*/
|
|
function smarty_block_change_currency($params, $content, Smarty_Internal_Template $template, &$repeat)
|
|
{
|
|
// Initial call
|
|
if ($repeat) {
|
|
if (!array_key_exists('currency', $params)) {
|
|
user_error('Block change_currency: Missing parameter "currency"');
|
|
$params['currency'] = 'CZK';
|
|
}
|
|
|
|
changeCurrency($params['currency']);
|
|
}
|
|
|
|
// Ending call
|
|
if (!$repeat) {
|
|
changeCurrency();
|
|
|
|
return $content;
|
|
}
|
|
}
|