Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 769 Bytes

Common.md

File metadata and controls

45 lines (34 loc) · 769 Bytes

Common Helper

A CakePHP helper to handle some common topics.

Setup

Include helper in your AppView class as

$this->loadHelper('Tools.Common', [
    ...
]);

Singular vs Plural

echo $this->Common->sp('Singular', 'Plural', $count, true);

If using explicit translations or if no I18n translation is necessary, you don't need the 4th argument:

echo $this->Common->sp(__('Singular'), __('Plural'), $count);

Meta tags

Canonical URL:

echo $this->Format->metaCanonical($url);

Alternate content URL:

echo $this->Format->metaAlternate($url, $language);

RSS link:

echo $this->Format->metaRss($url, $title);

Generic meta tags:

echo $this->Format->metaEquiv($type, $value, $escape)