mrnebbi/craft-query-strings 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrnebbi/craft-query-strings

Composer 安装命令:

composer require mrnebbi/craft-query-strings

包简介

Add your query strings back into your Craft CMS pagination. Pull an array of all query strings, including duplicate keys

README 文档

README

Craft Query Strings

A Craft CMS plugin to provide twig filters and functions to help with query string management. This is especially helpful for adding query strings back to pagination.

version 1.0.7

preserveQueryStrings

The Preserve Query String filter allows you to add |preserveQueryStrings to any URL output in twig, and it will keep the query strings as they should appear in the URL.

E.g.

{% if pageInfo.prevUrl %}<a href="{{ pageInfo.prevUrl|preserveQueryStrings }}">Previous Page</a>{% endif %}
{% if pageInfo.nextUrl %}<a href="{{ pageInfo.nextUrl|preserveQueryStrings }}">Next Page</a>{% endif %}

getQueryStrings

Pull an array of query strings from Craft. This gets around the problem of duplicated query string keys being lost, turning them into an array you can loop through.

An array will be returned with objects. Use .key and .value.

Return all URL queries

{% for query in getQueryStrings() %}
  {{ query.key }} - {{ query.value }}
{% endfor %}

Return only URL queries that match a key

{% for query in getQueryStrings('lookForKey') %}
  {{ query.key }} - {{ query.value }}
{% endfor %}

getQueryFormFields

Sometimes you want to use query fields in a form, to preserve these values you can use the following in your templates.

{{ getQueryFormFields() }}

which is shorthand/equivalent to:

{% for query in getQueryStrings() %}
  <input type="hidden" name="{{ query.key }}" value="{{ query.value }}">
{% endfor %}

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-09-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固