Git Product home page Git Product logo

yii2-shortcodes-pack's Introduction

Yii2-shortcodes-pack

Latest Stable Version Total Downloads License

Yii2-shortcodes-pack is part of the Yii2-plugins-system that have more usefull shortcodes for our site

"Shortcodes"

0. Shortcodes in pack

Shortcode Description Usage Code
yt YouTube link on original video [yt code="*"] Link on video [/yt] see
youtube Embed YouTube video with parameters [youtube code="" w="" h="*"] see
code All the blocks of text enclosed in the shortcode [code], will be highlighted [code style="" lang=""] ... [/code] see
container Bootstrap 3 grid - container (default or fluid) [container] ... [/container] see
row Bootstrap 3 grid - row [row] ... [/row] see
col Bootstrap 3 grid - column (lg, md, sm, xs) [col md=6] ... [/col] see
alert Bootstrap 3 alert messages [alert close=1] ... [/alert] see
label Bootstrap 3 labels [label text="*"] see
tabs Bootstrap 3 tabs or pills [tabs] [tab] ... [/tab] [/tabs] see

and more in future releases...

How create my shortcode?


1. Download

Yii2-shortcodes-pack be installed using composer. Run following command to download and install Yii2-shortcodes-pack:

composer require "loveorigami/yii2-shortcodes-pack":"*"

2. Update database schema

The last thing you need to do is updating your database schema by applying the migrations. Make sure that you have properly configured db application component and run the following command:

$ php yii migrate/up --migrationPath=@vendor/loveorigami/yii2-plugins-system/migrations

3. Configure application

Let's start with defining module in @backend/config/main.php:

'modules' => [
    'plugins' => [
        'class' => 'lo\plugins\Module',
        'pluginsDir'=>[
            '@lo/plugins/core', // default dir with core plugins
			'@lo/shortcodes' // dir with shortcodes pack
            '@common/shortcodes', // dir with our plugins with shortcodes
        ]
    ],
],

That's all, now you have module installed and configured in advanced template.

Next, open @frontend/config/main.php and add following:

...
'components' => [
    'plugins' => [
        'class' => lo\plugins\components\PluginsManager::class,
        'appId' => 1 // lo\plugins\BasePlugin::APP_FRONTEND,
        // by default
        'enablePlugins' => true,
        'shortcodesParse' => true,
        'shortcodesIgnoreBlocks' => [
            '<pre[^>]*>' => '<\/pre>',
            //'<div class="content[^>]*>' => '<\/div>',
        ]
    ],
    'view' => [
        'class' => lo\plugins\components\View::class,
    ]
    ...
]

Also do the same thing with @backend/config/main.php:

...
'components' => [
    'plugins' => [
        'class' => lo\plugins\components\PluginsManager::class,
        'appId' => 2 // lo\plugins\BasePlugin::APP_BACKEND
    ],
    'view' => [
        'class' => lo\plugins\components\View::class,
    ]
    ...
]

yii2-shortcodes-pack's People

Contributors

loveorigami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yii2-shortcodes-pack's Issues

Shortcodes tab is empty

Hi Andrey,

After I installed plug system and shortcodes pack via composer, I am not able to use the bootstrap shortcodes, e.g., alert.
There is no data in the shortcodes tab. I have followed your instruction. Is there anything missing?
Thanks for your help.

badge

[badge type="success" text="12"]

show hide

[show only='admin'] content [/show]
[show from='01.01.2017'] content [/show]
[hide] content [/hide]

composer update error

composer require "loveorigami/yii2-shortcodes-pack": "*"
Could not find package * at any version for your minimum-stability (dev). Check the package spelling or your minimum

need to remove a space "loveorigami/yii2-shortcodes-pack": and "*"
the correct command should be
composer require "loveorigami/yii2-shortcodes-pack":"*"

doesnt work need help

hey andrey
what i missed?
im tried follow step by step to using this "shortcodes"
even im embbedd into view index of plugin controller
screenshot 508

test on frontend
screenshot 509

backend config
'bootstrap' => ['log', 'plugins'], 'modules' => [ 'plugins' => [ 'class' => 'lo\plugins\Module', 'pluginsDir'=>[ '@lo/plugins/core', // default dir with core plugins '@lo/shortcodes', // dir with shortcodes pack '@common/shortcodes', // dir with our plugins with shortcodes ] ], ], 'components' => [ 'plugins' => [ 'class' => lo\plugins\components\PluginsManager::class, 'appId' => 2 // lo\plugins\BasePlugin::APP_BACKEND ], 'view' => [ 'class' => lo\plugins\components\View::class, ], ........

frontend config
'plugins' => [ 'class' => lo\plugins\components\PluginsManager::class, 'appId' => 1, // lo\plugins\BasePlugin::APP_FRONTEND, // by default 'enablePlugins' => true, 'shortcodesParse' => true, 'shortcodesIgnoreBlocks' => [ '<pre[^>]*>' => '<\/pre>', //'<div class="content[^>]*>' => '<\/div>', ] ], 'view' => [ 'class' => lo\plugins\components\View::class, ],

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.