markocupic/service_link

Contao 4 Service Link 扩展程序

安装: 113

依赖关系: 0

建议者: 0

安全性: 0

星级: 0

关注者: 2

分支: 0

开放问题: 0

语言:CSS

类型:contao-bundle

1.0.2 2020-07-12 12:23 UTC

This package is auto-updated.

Last update: 2024-09-12 21:32:41 UTC


README

Contao >=4.3 的前端模块

使用此模块可以管理和创建相册。该模块非常灵活,提供相册概览和详细视图。

通过composer安装

  • 在composer.json中添加以下条目
{
    ...
    "require": {
        ...
        "markocupic/gallery-creator-bundle": "dev-master"
    },
    ...
}
  • 在app/AppKerne.php中添加以下条目
class AppKernel extends Kernel
{

    public function registerBundles()
    {
        $bundles = [
            ...
            // Other
            new Markocupic\GalleryCreatorBundle\MarkocupicGalleryCreatorBundle(),
        ];

        ...

        return $bundles;
    }
  • 然后通过命令行使用"composer update"安装扩展。
  • 使用"bin/console cache:clear --env=prod"清除缓存。

现在通过安装工具更新数据库。之后,Gallery Creator 应该能够在 Contao 4 中运行。

从 gallery_creator 迁移到 gallery-creator-bundle

将较旧版本的 gallery_creator 迁移到 Contao 3.5 是没有问题的。

额外模板

更多模板可以在以下位置找到: https://gist.github.com/markocupic

"gc_generateFrontendTemplate"-Hook

使用"gc_generateFrontendTemplate"-Hook可以调整前端输出。在处理 Gallery-Creator 前端模板之前执行"gc_generateFrontendTemplate"-Hook。它传递模块对象,在详细视图中传递当前相册对象。期望返回模板对象。

<?php
// config.php
$GLOBALS['TL_HOOKS']['gc_generateFrontendTemplate'][] = array('MyGalleryCreatorClass', 'doSomething');

// MyGalleryCreatorClass.php
class MyGalleryCreatorClass extends \System
{

       /**
        * Do some custom modifications
        * @param Module $objModule
        * @param null $objAlbum
        * @return mixed
        */
       public function doSomething(\Module $objModule, $objAlbum=null)
       {
              global $objPage;
              $objPage->pageTitle = 'Bildergalerie';
              if($objAlbum !== null)
              {
                     // display the album name in the head section of your page (title tag)
                     $objPage->pageTitle = specialchars($objAlbum->name);
                     // display the album comment in the head section of your page (description tag)
                     $objPage->description = specialchars(strip_tags($objAlbum->comment));
                     // add the album name to the keywords in the head section of your page (keywords tag)
                     $GLOBALS['TL_KEYWORDS'] .= ',' . specialchars($objAlbum->name) . ',' . specialchars($objAlbum->event_location);
              }
              return $objModule->Template;
       }
}

祝您使用 Gallery Creator 开心!