承接 am-impact/amnav 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

am-impact/amnav

Composer 安装命令:

composer require am-impact/amnav

包简介

Navigation Plugin for Craft

README 文档

README

Navigations in Craft, made easy

Functionality

In the plugin's settings you can adjust the plugin's name for your customers and disable adding, editing and deleting navigations for non-admins.

Settings

The navigations overview. If you disabled the Can add, edit and delete setting in the plugin's settings, non-admins will only see the created navigations and the link to start building their navigation.

Navigations

When you create or edit a navigation, you can set the following settings:

Setting Explanation
Max Levels The maximum number of levels this navigation can have. Leave blank if you don’t care.
Can move from level Whether non-admins can move nodes from a specific level. Leave blank if you don’t care.
Can delete from level Whether non-admins can delete nodes from a specific level. Leave blank if you don’t care.

Edit

Let's start building a navigation! Non-admins don't see the Display navigation section. This is for admins only so they know what to put in the templates. You have the option to add existing entries, categories, assets or..

Build

.. add your own URLs.

Your own URL

When you have saved your nodes in the navigation, you can edit them later by double clicking on the node, or use the setting button behind the node when you hover over a node.

Edit node

Variables

You have two ways to fetch your navigation. You can get an array with your added nodes, or let a&m nav create the HTML for you.

{% set nav = craft.amNav.getNavRaw("yourNavigationHandle") %}

or

{{ craft.amNav.getNav("yourNavigationHandle") }}

Build the way you like it

Now you can add your own HTML if necessary!

{% set nav = craft.amNav.getNavRaw("yourNavigationHandle") %}

{% macro addNodeToNavigation(node, index) %}
    {%- set nodeClasses = [] -%}
    {%- if node.hasChildren -%}
        {%- set nodeClasses = nodeClasses|merge(['has-children']) -%}
    {%- endif -%}
    {%- if node.active or node.hasActiveChild -%}
        {%- set nodeClasses = nodeClasses|merge(['active']) -%}
    {%- endif -%}
    {%- if node.level == 1 and index == 1 -%}
        {%- set nodeClasses = nodeClasses|merge(['first']) -%}
    {%- endif -%}
    {%- if node.listClass|length -%}
        {%- set nodeClasses = nodeClasses|merge([node.listClass]) -%}
    {%- endif -%}

    <li{% if nodeClasses|length %} class="{{ nodeClasses|join(' ') }}"{% endif %}>
        <a href="{{ node.url }}" title="{{ node.name }}"{% if node.blank %} target="_blank"{% endif %}>{{ node.name }}</a>
        {% if node.hasChildren %}
            <ul class="nav__level{{ (node.level + 1) }}">
                {% for subnode in node.children %}
                    {{ _self.addNodeToNavigation(subnode, loop.index) }}
                {% endfor %}
            </ul>
        {% endif %}
    </li>
{% endmacro %}

<nav class="navmain">
    <ul class="nav">
        {% for node in nav %}
            {{ _self.addNodeToNavigation(node, loop.index) }}
        {% endfor %}
    </ul>
</nav>

Parameters

Parameter Explanation
maxLevel Build the navigation till a certain level.
overrideStatus Includes every node whatever the status.
startFromId Begin the navigation at a specific node ID.

Let amnav do the trick

{{ craft.amNav.getNav("yourNavigationHandle") }}

or with parameters..

{{ craft.amNav.getNav("yourNavigationHandle", {
    id: 'navigation',
    class: 'navigation'
}) }}

Parameters

Parameter Explanation
id ID for the navigation UL.
class Class name for the navigation UL.
classActive Class name for the active nodes.
classBlank Class name for hyperlinks that have a _blank target.
classLevel2 Class name for the children UL. You can add a classLevel for every level you need (e.g.: classLevel2, classLevel3).
classChildren Class name for a node that has children.
classFirst Class name for the first node in the navigation.
excludeUl Exclude the main UL wrapper.
maxLevel Build the navigation till a certain level.
overrideStatus Includes every node whatever the status.
startFromId Begin the navigation at a specific node ID.

Breadcrumbs

Breadcrumbs are not based on a created navigation. They are based on the current URL segments.

{{ craft.amNav.getBreadcrumbs() }}

or with parameters..

{{ craft.amNav.getBreadcrumbs({
    id: 'breadcrumbs',
    class: 'breadcrumbs'
}) }}

Parameters

Parameter Explanation
id ID for the breadcrumbs wrapper.
class Class name for the breadcrumbs wrapper.
classDefault Default class name for every breadcrumb.
classFirst Class name for the first breadcrumb.
classLast Class name for the last breadcrumb.
wrapper Wrapper element without the < and >.
beforeText Text before the first item, like 'You are here:'.
renameHome Change the title of the home entry.
lastIsLink Whether the last breadcrumb should be a link.

Contact

If you have any questions, suggestions or noticed any bugs, don't hesitate to contact us.

am-impact/amnav 适用场景与选型建议

am-impact/amnav 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26.51k 次下载、GitHub Stars 达 167, 最近一次更新时间为 2015 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 am-impact/amnav 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 am-impact/amnav 我们能提供哪些服务?
定制开发 / 二次开发

基于 am-impact/amnav 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 26.51k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 167
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 167
  • Watchers: 14
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-04-17