All Projects → nystudio107 → pathtools

nystudio107 / pathtools

Licence: MIT license
DEPRECATED This twig plugin for the Craft CMS brings convenient path & url manipulation functions & filters to your Twig templates.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to pathtools

Craft Imageoptimize
Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.
Stars: ✭ 227 (+1094.74%)
Mutual labels:  craftcms, craft-plugin
AssetSubfolderAccess
Limits user groups to only access certain asset subfolders
Stars: ✭ 18 (-5.26%)
Mutual labels:  craftcms, craft-plugin
Spoon
Spoon plugin for Craft CMS - Enhance your Matrix fields with groups, tabs and more!
Stars: ✭ 82 (+331.58%)
Mutual labels:  craftcms, craft-plugin
Retour
DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Stars: ✭ 172 (+805.26%)
Mutual labels:  craftcms, craft-plugin
craft-elementstats
Element Stats widget for Craft CMS
Stars: ✭ 15 (-21.05%)
Mutual labels:  craftcms, craft-plugin
Seo
SEO utilities including a unique field type, sitemap & redirect manager
Stars: ✭ 210 (+1005.26%)
Mutual labels:  craftcms, craft-plugin
craft-donkeytail
A Craft CMS fieldtype for content managing points on images.
Stars: ✭ 53 (+178.95%)
Mutual labels:  craftcms, craft-plugin
Simplemap
A beautifully simple map field type for Craft CMS.
Stars: ✭ 136 (+615.79%)
Mutual labels:  craftcms, craft-plugin
buffer
DEPRECATED Send social updates to Twitter, Facebook, etc. through Buffer.com via Twig templates, URLs, and plugins.
Stars: ✭ 43 (+126.32%)
Mutual labels:  craftcms, craft-plugin
craft3-sitecopy
With this plugin you can copy the content of an entry to another site.
Stars: ✭ 22 (+15.79%)
Mutual labels:  craftcms, craft-plugin
Craft Embedded Assets
Manage YouTube videos, Instagram photos, Twitter posts and more as first class assets in Craft CMS
Stars: ✭ 165 (+768.42%)
Mutual labels:  craftcms, craft-plugin
Craft-User-Manual
📚 Help Section Plugin for Craft CMS.
Stars: ✭ 86 (+352.63%)
Mutual labels:  craftcms, craft-plugin
Linkit
Multi-purpose link plugin for Craft CMS
Stars: ✭ 155 (+715.79%)
Mutual labels:  craftcms, craft-plugin
craft-router
A Craft CMS plugin for using URL segments as filtering criteria on an entry query.
Stars: ✭ 21 (+10.53%)
Mutual labels:  craftcms, craft-plugin
Commerce
Fully integrated ecommerce for Craft CMS
Stars: ✭ 144 (+657.89%)
Mutual labels:  craftcms, craft-plugin
craft3-forms
This craft CMS 3 form plugin makes it easy to create and use custom forms with the features the Yii 2 Framework offers. On top of this, the plugin provides even more functionalities for easy implementation of forms in twig templates.
Stars: ✭ 20 (+5.26%)
Mutual labels:  craftcms, craft-plugin
Craft Fieldlabels
Override Craft CMS field labels and instructions in the field layout designer
Stars: ✭ 128 (+573.68%)
Mutual labels:  craftcms, craft-plugin
Craft Seomatic
SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
Stars: ✭ 135 (+610.53%)
Mutual labels:  craftcms, craft-plugin
smartdown.craft-plugin
Bringing the unbridled joy of Markdown Extra and Smartypants to your Craft websites.
Stars: ✭ 26 (+36.84%)
Mutual labels:  craftcms, craft-plugin
craft-audit
Audit log for Craft 3
Stars: ✭ 18 (-5.26%)
Mutual labels:  craftcms, craft-plugin

No Maintenance Intended

DEPRECATED

This Craft CMS 2.x plugin is no longer supported, but it is fully functional, and you may continue to use it as you see fit. The license also allows you to fork it and make changes as needed for legacy support reasons.

The Craft CMS 3.x version of this plugin can be found here: craft-pathtools and can also be installed via the Craft Plugin Store in the Craft CP.

PathTools twig plugin for Craft

This twig plugin for the Craft CMS brings convenient path & url manipulation functions & filters to your Twig templates.

Related: PathTools for Craft 3.x

Installation

To install PathTools, follow these steps:

  1. Download & unzip the file and place the pathtools directory into your craft/plugins directory
  2. -OR- do a git clone https://github.com/khalwat/pathtools.git directly into your craft/plugins folder. You can then update it with git pull
  3. Install plugin in the Craft Control Panel under Settings > Plugins
  4. The plugin folder should be named pathtools for Craft to see it. GitHub recently started appending -master (the branch name) to the name of the folder for zip file downloads.

Usage

All of the functionality offered by PathTools can be used either as a filter, e.g.:

{{ myAsset.url | basename }}

Or as a function, e.g.:

{% set myBaseName = basename(myAsset.url) %}

php Wrapper Functions

pathinfo

Wrapper for the php pathinfo() function -- http://php.net/manual/en/function.pathinfo.php

basename

Wrapper for the php basename() function -- http://php.net/manual/en/function.basename.php

dirname

Wrapper for the php dirname() function -- http://php.net/manual/en/function.dirname.php

parse_url

Wrapper for the php parse_url() function -- http://php.net/manual/en/function.parse-url.php

parse_str

Wrapper for the php parse_str() function -- http://php.net/manual/en/function.parse-str.php

Utility Functions

swap_extension

Can be passed either a path or a url, and it will return the path or url with the filename extension changed, e.g.:

<source src="{{ myAsset.url | swap_extension('mp4') }}" type='video/mp4' />
<source src="{{ myAsset.url | swap_extension('webm') }}" type='video/webm' />

For myAsset.url = http://www.coolvids.com/content/vids/MyCoolVid.mp4 the output would be:

<source src="http://www.coolvids.com/content/vids/MyCoolVid.mp4" type='video/mp4' />
<source src="http://www.coolvids.com/content/vids/MyCoolVid.webm" type='video/webm' />

swap_directory

Can be passed either a path or a url, and it will return the path or url with the directory path changed, e.g.:

<img src="{{ myAsset.url | swap_directory('/over/there') }}" />

For myAsset.url = http://www.coolvids.com/not/here/rock.pdf the output would be:

<img src="http://www.coolvids.com/over/there/rock.pdf" />

append_suffix

Can be passed either a path or a url, and it will return the path or url with the suffix appended to the filename, e.g.:

<img src="{{ myAsset.url | append_suffix('@2x') }}" />

For myAsset.url = http://www.coolvids.com/img/ux/search.png the output would be:

<img src="http://www.coolvids.com/img/ux/[email protected]" />

Changelog

1.0.2 -- 2016.08.04

  • [Added] Added the parse_str() function
  • [Improved] Updated the README.md

1.0.1 -- 2015.11.23

  • [Added] Added support for Craft 2.5 new plugin features
  • [Improved] Updated the README.md

1.0.0 -- 1/2/2015

  • Initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].