定制 matycz/lemo-theme 二次开发

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

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

matycz/lemo-theme

最新稳定版本:4.0.1

Composer 安装命令:

composer require matycz/lemo-theme

包简介

README 文档

README

Lemo\Theme is a Zend Framework 2 module that allows you to switch between various themes. It allows you to create various themes and then switch between them. Themes can be installed in multiple folders.

The current theme can be defined in global.ini or local.ini for whole application. For the module you can set default theme in module.config.php. You can switch theme from any place in application by ServiceManager from instance of ThemeManager too.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

  1. cd my/project/directory

  2. Create a composer.json file with following contents:

    {
        "require": {
            "matycz/lemo-theme": ">=1.0"
        }
    }
  3. Run php composer.phar install

  4. Open my/project/directory/config/application.config.php and add module name Lemo\Theme into key modules like below:

    return array(
        ...
        'modules' => array(
           ...
           'Lemo\Theme'
           ...
        ),
        ...
    );

Installation without composer is not officially supported, and requires you to install and autoload the dependencies specified in the composer.json.

Documentation

In configuration files you can set the default theme that should be used, the list of directories that should be used for selecting the current theme as listed bellow:

'theme_manager' => array(
    'theme' => 'default',
    'theme_paths' => array(
        './theme/'
    ),
),

To get a basic theme up and running you can just copy the default one from examples/theme folder into the theme folder in application root or create a new one by following the tutorial bellow. Make sure that the theme option is set the the name of your new theme.

Examples

<?php

namespace Foo\Controller;

use Lemo\Theme\ThemeManagerInterface;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class BarController extends AbstractActionController
{
    /**
     * @var ThemeManagerInterface
     */
    protected $themeManager;
    
    ...

    /**
     * Page with grid example
     *
     * @return ViewModel
     */
    public function indexAction()
    {
        // Example1 - Set new theme with name foo
        $this->getThemeManager()->setTheme('foo');

        // Example 2 - Set new theme with name foo
        $this->getServiceLocator()->get('ThemeManager')->setTheme('foor');

        return new ViewModel(array(
            ...
        ));
    }
    
    ...
    
    /**
     * @param  ThemeManagerInterface $themeManager
     * @return BarController
     */
    public function setThemeManager(ThemeManagerInterface $themeManager)
    {
        $this->themeManager = $themeManager;

        return $this;
    }

    /**
     * @return ThemeManagerInterface
     */
    public function getThemeManager()
    {
        return $this->themeManager;
    }
}
<p class="current-theme"><?= $this->theme() ?></p>

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-01-12