承接 tpoxa/shortcodes 相关项目开发

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

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

tpoxa/shortcodes

Composer 安装命令:

composer require tpoxa/shortcodes

包简介

Wordpress style shorttags support for Yii2

README 文档

README

Wordpress style shortcodes support for Yii2

Most part of the code taken from https://github.com/Easy-Forex/WordPress-Shortcodes

Installation

{
	"require": {
  		"tpoxa/shortcodes": "dev-master"
	}
}

Configuration

In config file

/config/main.php

Add shortcodes component

'components' => array(
        ...
        'shortcodes' => [
            'class' => 'tpoxa\shortcodes\Shortcode',
            'callbacks' => [
                'lastphotos' => ['frontend\widgets\lastPhoto\lastPhoto', 'widget'],
                'anothershortcode'=>function($attrs, $content, $tag){
                ///
                },
                
            ]
        ],

Usage

echo \Yii::$app->shortcodes->parse('
            <div><b>some content</b>  [lastphotos limit=8]  ></div>
    ')

Additional

callbacks - An array of valid PHP callbacks. Keys should contain names of the shortcodes.

lastPhoto example class - common Yii2 widget

namespace frontend\widgets\lastPhoto; // your App class

use yii\base\Widget;
class lastPhoto extends Widget {

    public $limit = 5; // this parameter will be overwritten by 8 

    public function run() {
        // your widget content goes here
    }

}

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 6
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-10-05