/fetch

🐕 A plugin for Craft CMS that adds data fetching for use in templates.

Primary LanguagePHPMIT LicenseMIT

Important

This plugin is no longer maintained.

We recommend using the (other) Fetch plugin instead.

Fetch plugin for Craft CMS

file_get_contents for Craft CMS templates.

Automatically decodes JSON.

Usage

There’s three ways to use Fetch.

Variable
{{ craft.fetch.getFileContents(svgAsset.url) }}
Function
{{ fetch(svgAsset.url) }}
Filter
{{ svgAsset.url|fetch }}

Parameters

It’s possible to pass parameters as a second argument.

{{ fetch(svgAsset.url, {
  cache: false
}) }}
Parameter Description Default
cache Whether to cache the contents. true
suppressErrors Whether to suppress any PHP Notices/Warnings/Errors. true