carlcs / craft-glob
Glob plugin for Craft CMS
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- php: >=5.3.0
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2024-11-20 04:58:45 UTC
README
Craft plugin that adds a Twig function to find pathnames in your templates folder matching a pattern.
The plugin uses the PHP glob
function internally.
Installation
To install the plugin, copy the glob/ folder into craft/plugins/. Then go to Settings → Plugins and click the "Install" button next to "Glob".
Twig function
glob( path, pattern )
Find pathnames in your templates folder matching a pattern.
{% set plugins = [ 'Asset Metadata', 'Number Convert', ] %} {% for plugin in plugins %} {% set dirPath = 'tests/' ~ plugin|camel|lower ~ '/' %} {% for path in glob(dirPath) %} <a href="/{{ path }}">{{ path }}</a> {% endfor %} {% endfor %}
Parameters
path
(optional)
: The sub-path in craft/templates/ you want to search in.
pattern
(optional)
: The pattern as described in the PHP glob
documentation (Default value is '*.{html,twig}'
).