eab/fancy-gallery-bundle

此包最新版本(0.1.1)没有可用的许可信息。

为eZ Publish提供的简单相册包,使用FancyBox。

0.1.1 2015-11-17 16:09 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:27 UTC


README

##摘要

为eZ Publish提供的简单相册包,使用FancyBox。

##作者

Andy Caiger acaiger@eab.uk

版权

版权(C)2014-2015 Enterprise AB Ltd

许可

GNU通用公共许可证2.0下许可

要求

安装

  1. 使用composer安装EabFancyGalleryBundle

    composer require --update-no-dev --prefer-dist eab/fancy-gallery-bundle
    

    Composer会安装包及其依赖项到vendors目录。

    您可以使用git将其安装到src子目录

    git clone https://github.com/eab-dev/EabFancyGalleryBundle.git src/Eab/FancyGalleryBundle
    
  2. 通过编辑ezpublish/EzPublishKernel.php在内核中启用该包

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Sp\BowerBundle\SpBowerBundle(),
            new Eab\FancyGalleryBundle\EabFancyGalleryBundle(),
            // ...
        );
    }
  3. 安装最新版本的FancyBox

    php ezpublish/console sp:bower:install
    php ezpublish/console assets:install --symlink
    

如果在安装bower资源时看到错误信息

ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/fancyapps/fancyBox.git", exit code of #128 fatal: unable to connect to github.com

快速解决方案是禁用git:协议

git config --global url."https://".insteadOf git://

然后再次运行安装命令。

配置

如果您的包不是扩展eZDemoBundle,则需要告诉EabFancyGalleryBundle要使用哪个pagelayout模板。有两种简单的方法可以做到这一点

  1. 编辑ezpublish/config/config.yml

     eab_fancy_gallery:
         pagelayout: AcmeMyBundle::pagelayout.html.twig
    
  2. 在自己的包中,编辑一个文件,例如src/Acme/MyBundle/Resources/config/services.yml并添加

     parameters:
         eab_fancy_gallery.pagelayout: AcmeMyBundle::pagelayout.html.twig
    

    使用第二种方法,请确保您的包在EabFancyGalleryBundle之后加载。

#自定义

以下设置可以像pagelayout一样进行配置

  • summary_in_full_view - 是否显示摘要
  • page_limit - 每页显示的图片数量
  • children_types - 应在画廊中显示的内容类型数组
  • image_variation - 用于缩略图的图像变体

您还可以通过将Resources/config/override.yaml复制到您自己的包配置中并更改控制器或模板(提示:更改键,例如将image:更改为image_override:)来覆盖模板。

画廊模板加载了FancyBox CSS。如果您想在所有页面上加载它,则需要

  1. 用您的模板覆盖full/gallery.html.twig,该模板不加载CSS。

  2. 编辑您的page_header_style.html.twig模板并包含FancyBox CSS资产

     {% stylesheets filter='cssrewrite,?cssmin'
         ...
         'bundles/eabfancygallery/components/fancybox/source/jquery.fancybox.css'
         ...
     %}
     <link rel="stylesheet" type="text/css" href="{{ asset_url }}"/>
     {% endstylesheets %}
    

#更新

安装此包后,您可以在任何时候运行ezpublish/console sp:bower:install来更新Fancybox资产。请注意:它将更新其他bower资产!

注意事项

  1. 此包假设您的网站使用Bootstrap 3。如果它不这样做,您需要覆盖和修改模板。请参阅Bootstrap 2的示例模板

  2. 此包的配置不是siteaccess感知的。如果您的网站针对不同的siteaccess有不同的布局,您可以针对每个siteaccess覆盖画廊和图像模板,或者重新编程设置'pagelayout'模板变量的方式。因此,请分叉存储库,重写代码并提交拉取请求。谢谢!