Skip to content

Instantly share code, notes, and snippets.

Created November 5, 2015 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/93f32a0d3f003f348fd4 to your computer and use it in GitHub Desktop.
Save anonymous/93f32a0d3f003f348fd4 to your computer and use it in GitHub Desktop.
---
Name: mysite
After:
- 'framework/*'
- 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
theme: 'one-ring'
SiteConfig:
extensions:
- SiteConfigExtension
Currency:
currency_symbol: 'DKK '
extensions:
- CurrencySymbol
<?php
Class CurrencySymbol extends DataExtension {
public function SymbolNice() {
$val = number_format(abs($this->value) . $this->config()->currency_symbol, 2);
if($this->value < 0) return "($val)";
else return $val;
}
}
<div class="price">
<span>$PricePerNight.SymbolNice</span><p>per night<p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment