Giter VIP home page Giter VIP logo

yii2-faq's Introduction

yii2-faq-module

FAQ module for Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist vladkukushkin/yii2-faq "*"

or add

"vladkukushkin/yii2-faq": "*"

to the require section of your composer.json file.

Make migration

php yii migrate --migrationPath=@vendor/vladkukushkin/yii2-faq/migrations/

Usage

You should add module to your config:

'modules' => [
        ...
        'faq' => [
                    'class' => \vladkukushkin\faq\Module::className(),
                    'imagesUrl' => 'http://my_site_name/upload/faq/',
                    'imagesPath' => '@frontend/web/upload/faq/',//realpath(__DIR__.'/../../frontend/web/upload/faq/')
                ],
    ],

You should use 'imagesUrl' and 'imagesPath' to define folder to store your images for FAQ. This variables should define same directory. In above example images will be saved in '@frontend/web/upload/faq' directory. You should define both variables because Imperavi widget used in this module and they needed to this widget.

If you use advanced project template you should configure both config.php with the same values

You can add link to this module in your backend navbar:

$menuItems[] = ['label' => 'FAQ', 'url' => ['/faq/default/index']];

To display FAQ just add:

echo \vladkukushkin\faq\widgets\FaqWidget\FaqWidget::widget();

Widget have two parameters - 'title' and 'breadcrumbs' with default value 'false', which means that no title and no breadcrumbs will be applied on page with widget. It is useful if you will place widget on existing page with other information. If you locate widget on separate page and want to specify title or breadcrumbs (or maybe both of them) you can call widget like this:

echo \vladkukushkin\faq\widgets\FaqWidget\FaqWidget::widget([
    'title' => Yii::t('app', 'FAQ'),
    'breadcrumbs' => Yii::t('app', 'FAQ page'),
]);

It is possible that you have to change minimum stability section of your composer.json file to dev

"minimum-stability": "dev",

Module support Russian and English languages. By default language for Imperavi widget is Russian ('ru'). You can change it to English by adding to module config

'imperaviLanguage' => 'en'

The module is under construction

yii2-faq's People

Contributors

vladkukushkin avatar

Stargazers

Андрей Коломенский avatar

Watchers

 avatar

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.