定制 hypejunction/elgg-snippets 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hypejunction/elgg-snippets

Composer 安装命令:

composer require hypejunction/elgg-snippets

包简介

Editable HTML snippets for use in themes and views

README 文档

README

Elgg 2.3

Reusable and editable snippets with variable interpolation

Features

Using plugin settings to alter large chunks of HTML is repetitive and not very efficient: you have to update plugins settings, remember in which plugin a setting lives, figure out how to populate default values, implement weird mechanics to interpolate variables etc.

This plugin makes it easy, just create a snippets in your views and will be available for editing via admin interface. Snippets can then be injected into your views with elgg_snippet().

Usage

Once the plugin is enabled, snippets can be edited under Admin > Appearance > HTML Snippets.

Create a default snippet as a .twig view anywhere in views/default/snippets/:

// my-plugin/views/default/snippets/page/footer.twig
<div class="footer">
  <a class="{{ normalizeUrl('/contact') }}">Contact Us</a>
</div>

Render a snippet where it belongs:

// my-plugin/views/default/somewhere.php
echo elgg_snippet('page/footer');

You can provide the title and the description of the snippet using translations:

// languages/en.php
return [
   'snippet:page/footer' => 'Page Footer Template',
   'snippet:page/footer:help' => 'Displayed on all pages in the footer area',
];

Storage

Snippet overrides are stored in the dataroot, so be sure to copy them over if migrating your site. You can also reset to default template, by deleting a corresponding snippet from the dataroot.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2019-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固