Gallery: 主题:参考:区块:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
Modules can provide blocks that can be placed anywhere in your Gallery layout. Think of [http://en.wikipedia.org/wiki/Lego Lego] bricks, you can build your own layout by arranging blocks any way you want.
模块提供的区块能够放置到Gallery布局中的任意位置。想想[http://en.wikipedia.org/wiki/Lego 乐高(Lego)]砖吧,通过任意布置区块,你可以创建自己的布局样式。


==用法==
==用法==
第7行: 第7行:
* 使用中的'''g->block'''例子可以在Gallery附带的模板源代码中找到,例如在[http://svn.sourceforge.net/viewcvs.cgi/gallery/trunk/gallery2/themes/floatrix/templates/album.tpl?annotate=13913#l9 Floatrix外观主题]中
* 使用中的'''g->block'''例子可以在Gallery附带的模板源代码中找到,例如在[http://svn.sourceforge.net/viewcvs.cgi/gallery/trunk/gallery2/themes/floatrix/templates/album.tpl?annotate=13913#l9 Floatrix外观主题]中


==Blocks==
==区块==


* '''albumselect.AlbumSelect'''
* '''albumselect.AlbumSelect'''
** Show album list in a select box
** 在选择框中显示相册列表


* '''albumselect.AlbumTree'''
* '''albumselect.AlbumTree'''
** Show album list in a dynamic tree
** 在动态树型结构中显示相册列表


* '''cart.ShowCart'''
* '''cart.ShowCart'''
** Block with summary info about cart contents and a link to view cart
** 带有cart内容摘要信息的区块,以及一个链接供查看cart之用


* '''comment.ViewComments''' [item=..] [show=..]
* '''comment.ViewComments''' [item=..] [show=..]
** Block to show given number of recent comments on given item
** 显示特定项目指定数量的最新评论的区块
** Item defaults to $theme.item; Show defaults to 3
** 项目默认为$theme.item;显示默认为3


* '''comment.AddComment''' [item=..]
* '''comment.AddComment''' [item=..]
** Block to show Add Comment form
** 显示添加评论表单的区块
** Item defaults to $theme.item
** Item defaults to $theme.item


* '''core.BreadCrumb''' [separator=..]
* '''core.BreadCrumb''' [separator=..]
** Show links to ancestor albums
** 显示上级相册的链接
** Data must already be loaded via 'parents' key to loadCommonTemplateData
** 数据必须事先通过loadCommonTemplateData的'parents'键被载入
** Optional separator string is placed between each album name
** 可选的分隔字串被置于各相册名称之间


* '''core.EmergencyEditItemLink''' [permissions=..] [checkBlocks=..]
* '''core.EmergencyEditItemLink''' [permissions=..] [checkBlocks=..]
** Show "Edit" link if core.ItemLinks block is not found in specified block lists and user can edit the current item
** 如core.ItemLinks区块在特定区块列表中没有被找到的话,则会显示"编辑(Edit)"链接,用户可以编辑当前项目
** Permissions default to $theme.permissions
** 权限默认为$theme.permissions
** Old checkSidebarBlocks/checkAlbumBlocks/checkPhotoBlocks parameters are deprecated; use parameter like checkBlocks="sidebar,album" instead
** 旧的checkSidebarBlocks/checkAlbumBlocks/checkPhotoBlocks参量被弃用;取而代之地使用类似checkBlocks="sidebar,album"的参量


* '''core.GuestPreview'''
* '''core.GuestPreview'''
** Show block to registered users to select guest preview mode
** 显示给已注册用户区块以选择游客预览模式


* '''core.ItemInfo''' [item=..] [showDate=true] [showOwner=true] [showSize=true] [showViewCount=true] [showSummaries=true]
* '''core.ItemInfo''' [item=..] [showDate=true] [showOwner=true] [showSize=true] [showViewCount=true] [showSummaries=true]
** Block to show specified data about the given item
** 用以显示给定项目特定数据的区块
** showSummaries displays all available item summary info, such as item keywords, count of comments, rating interface, etc.
** showSummaries显示所有可用的项目摘要信息,如项目关键词,评论计数以及评分界面等。


* '''core.ItemLinks''' [item=..] [links=..] [useDropdown=..] [lowercase=..]
* '''core.ItemLinks''' [item=..] [links=..] [useDropdown=..] [lowercase=..]
** Item defaults to $theme.item; Links defaults to $theme.itemLinks (loaded via loadCommonTemplateData)
** 项目默认为$theme.item;链接默认为$theme.itemLinks(通过loadCommonTemplateData载入)
** If useDropdown=true then show multiple links in a select list <br> If false or there is only one link then show all the links
** 如useDropdown=true那么就在一个选择列表中显示多个链接<br> 如果为false或仅有一个链接则显示所有的链接
** Add lowercase=true parameter to convert all link text to lowercase
** 添加lowercase=true参量来讲所有链接文本转换为小写


* '''core.LanguageSelector'''
* '''core.LanguageSelector'''
** Show select list of available language to allow user to change language
** 显示可以语言选择列表以供用户修改语言


* '''core.LoginBlock'''
* '''core.LoginBlock'''
** If user is a guest then show login form
** 如果用户为游客身份则显示登入表单


* '''core.NavigationLinks''' [navigationLinks=..]
* '''core.NavigationLinks''' [navigationLinks=..]
** Links to previous locations (Back to photo, etc.)
** 稍前位置的链接(返回相片等)
** '''Note:''' Removed in Gallery 2.3. This block only exists in Gallery 2.0 - 2.2.
** '''注:''' 在Gallery2.3中被移除了。该模块仅存于Gallery 2.0到2.2版本中。


* '''core.Navigator''' [navigator=..] [reverseOrder=..] [prefix=..] [suffix=..] [currentPage=..] [totalPages=..] [currentItem=..] [totalItems=..]
* '''core.Navigator''' [navigator=..] [reverseOrder=..] [prefix=..] [suffix=..] [currentPage=..] [totalPages=..] [currentItem=..] [totalItems=..]
** Use itemNavigator or pageNavigator key for loadCommonTemplateData and then pass navigator=$theme.navigator
**为loadCommonTemplateData使用itemNavigator或pageNavigator键,并传送navigator=$theme.navigator
** Set reverseOrder=true to swap the order of next/last and first/previous sections (useful if css float is used in display)
** 设置reverseOrder=true来交换下一个/上一个以及第一个/前一个部分的次序(如css浮点被用于显示中则很有用)
** Prefix = text to place before first/previous links; Suffix = text to place after next/last links
** Prefix = text置于第一个/前一个链接之前;Suffix = text置于下一个/上一个链接之后
** Include currentPage/totalPages to add Page x of y between navigator links (usually get values from $theme.currentPage and $theme.totalPages).
** 包括currentPage/totalPages在导航链接中添加x/y页(Page x of y)(常自$theme.currentPage和$theme.totalPages取值)。
** Include currentItem/totalItems to add x of y between navigator links (can use core.LoadPeers callback to get values).
** 包括currentItem/totalItems 在导航链接中添加x/y(x of y )(可使用core.LoadPeers callback来取值)。


* '''core.Pager'''
* '''core.Pager'''
** Block with current page number and links to other pages
** 具有当前页数及至其他页面链接的区块
** Data must already be loaded via 'jumpRange' key to loadCommonTemplateData
** 数据必须已通过loadCommonTemplateData的'jumpRange'键被载入


* '''core.PeerList''' [item=..] [windowSize=..]
* '''core.PeerList''' [item=..] [windowSize=..]
** Links to some peer items; item defaults to $theme.item and windowSize defaults to 7
** 某些peer项目的链接;项目默认为$theme.item而windowSize默认为7


* '''core.PhotoSizes'''
* '''core.PhotoSizes'''
** Block to show image sizes and links to view each size
** 显示图片尺寸及查看各尺寸链接的区块
** Data must already be loaded via 'imageViews' key to loadCommonTemplateData
**数据必须已通过loadCommonTemplateData的'imageViews'键被载入


* '''core.SystemLink''' [linkId=..]
* '''core.SystemLink''' [linkId=..]
** If given linkId was loaded by 'systemLinks' key to loadCommonTemplateData then show the link
** 如给定的linkId通过loadCommonTemplateData的'systemLinks'键被载入的话,则显示对应的链接


* '''core.SystemLinks''' [order=..] [othersAt=..] [separator=..]
* '''core.SystemLinks''' [order=..] [othersAt=..] [separator=..]
** Show all system links; data must already by loaded via 'systemLinks' key to loadCommonTemplateData
** 显示所有系统链接;数据必须已通过loadCommonTemplateData的'systemLinks'键被载入
** Order is a space separated list of known link ids to give the order links should be displayed
** Order为由空格隔开的已知链接id的列表以给出需要显示的order链接
** OthersAt is the position where any links not given in the "order" value should be place (1 = first)
** OthersAt为"order"值中未被给出的所有链接的位置(其中1 = 第一个)
** Separator is a string to include after each link
** 分隔符为各链接之后所包括的字串


* '''core.ThemeSettingsForm''' [formId=..] [message=..]
* '''core.ThemeSettingsForm''' [formId=..] [message=..]


* '''customfield.CustomFields''' [item=..]
* '''customfield.CustomFields''' [item=..]
** Show 'detail' custom fields for given item (defaults to $theme.item)
** 为给定项目显示'细节(detail)'自定义字段(默认为$theme.item)


* '''exif.ExifInfo''' [item=..]
* '''exif.ExifInfo''' [item=..]
** Show EXIF data for given item (defaults to $theme.item) with controls to select summary or detail view
**为给定项目显示带有控制以选择摘要或是详细视图的EXIF数据(默认为$theme.item)


* '''imageblock.ImageBlock''' [parameters..]
* '''imageblock.ImageBlock''' [parameters..]
** Image block; see Site Admin -> Image Block for a list of available parameters (e.g. use blocks= instead of g2_blocks=)
** 图片区块(Image block);见站点管理(Site Admin) -> 图片区块(Image Block)来获取可用参量列表(如使用blocks= 取代g2_blocks=
** Example: {g->block type="imageblock.ImageBlock" blocks="randomAlbum|randomImage" showDate=0 showOwner=1 showViews=1 showTitle=1 showHeading=0 useDefaults=0}
** 举例:{g->block type="imageblock.ImageBlock" blocks="randomAlbum|randomImage" showDate=0 showOwner=1 showViews=1 showTitle=1 showHeading=0 useDefaults=0}
** useDefaults=0 is required if you want to override the site defaults which are set in Site Admin -> Image Block
** 如果你希望覆盖站点管理(Site Admin) -> 图片区块(Image Block)中设定的站点默认的话,那么就需要useDefaults=0
** repeatBlock=.. will repeat the given blocks parameter that many times (eg. blocks=recentImage|recentImage is the same as blocks=recentImage repeatBlock=2)
** repeatBlock=.. 将会重复给定区块参量相应的次数(例如,blocks=recentImage|recentImage与blocks=recentImage repeatBlock=2的效果是一样的)


* '''imageframe.ImageFrame''' (container)  [frame=..] [width=..] [height=..] [maxSize=..]
* '''imageframe.ImageFrame''' (container)  [frame=..] [width=..] [height=..] [maxSize=..]
** Render given frame type around content in this container
** 在该容器中对内容周围的指定边框类型进行渲染
** Image in content should have %CLASS% in its class attribute and %ID% for its id
** 内容中的图片在其类别属性中应具有%CLASS%以及%ID% 作为其id
** ImageFrame definitions must already be loaded by imageframe->init() calls from modules/themes using imageframes
** ImageFrame的定义必须经使用imageframe的模块/外观主题的imageframe->init()呼叫被载入过了
** Supply width/height parameters to generate a fixed-size imageframe (this is most cross-browser compatible).  Optionally add maxSize parameter to scale given dimensions to fit that size (see g->image).
** 提供宽/高来生成固定尺寸的imageframe (大多浏览器都可兼容)。可选地添加maxSize参量来调整给定规格尺寸以符合要求(见g->image)。
** Omit width/height to generate an imageframe that dynamically resizes to fit its content, even if the content size changes (via javascript) after the page loads.  However, this type of imageframe may not render properly on Opera or Safari browsers.
** 忽略宽/高以生成根据自身内容动态调整尺寸的imageframe,这在页面读取后内容尺寸改变(通过javascript)时仍如此。然而,此类imageframe在Opera或Safari浏览器中可能无法正确地进行渲染。


* '''keyalbum.KeywordLinks''' [forItem=..] [item=..] [onlyPublic=..] [showCloud=..] [maxCloudFontEnlargement=..]
* '''keyalbum.KeywordLinks''' [forItem=..] [item=..] [onlyPublic=..] [showCloud=..] [maxCloudFontEnlargement=..]
** Show links into Keyword Albums
** 显示关键词相册(Keyword Albums)的链接
** If forItem is true (it defaults to true) then show simple list of links for keywords of given item (item defaults to $theme.item)
** 如forItem为true(默认为true)则显示给定项目关键词的链接简化列表(项目默认为$theme.item)
** If forItem is false then load all keywords (onlyPublic defaults to true; load keywords for public items or all items) and show a select list or keyword cloud (showCloud defaults to false)
** 如forItem为false则载入所有关键词(onlyPublic默认为true;载入公共项目或所有项目的关键词)并显示一选择列表或关键词云(keyword cloud)(showCloud默认为false)
** maxCloudFontEnlargement is how many pixels bigger the font size should be for the most common keyword, default is 5
** maxCloudFontEnlargement为最常见关键词字体尺寸的像素值,默认为5


* '''members.MembersSummary'''
* '''members.MembersSummary'''
** Block with number of members and link to members list (if user has access)
** 具有成员数及成员列表链接的区块(如用户可进行访问的话)


* '''quotas.QuotasSummary'''
* '''quotas.QuotasSummary'''
** Show disk usage and quota for current user
** 显示当前用户的磁盘用量及分区


* '''rating.Rating''' [item=..]
* '''rating.Rating''' [item=..]
** Show rating interface for given item (defaults to $theme.item)
** 为给定项目显示评分界面(默认为$theme.item)


* '''rss.RssBlock'''
* '''rss.RssBlock'''
** Show links for RSS feeds
** 显示RSS feed的链接


* '''search.SearchBlock''' [showAdvancedLink=..]
* '''search.SearchBlock''' [showAdvancedLink=..]
** Block with text input for searching the Gallery
** 带有供搜索Gallery之用的文本输入的区块
** Show link to advanced search unless specified (showAdvancedLink defaults to true)
** 除非特别指定,均显示高级搜索链接(showAdvancedLink默认为true)


==模板位置==


==Template Locations==
各区块的模板都位于一标准位置中,我们以''cart.ShowCart''为例。模板位于:
 
The template for each block is in a standard location. As an example we'll use ''cart.ShowCart''. The template is located in:
  modules/''cart''/templates/blocks/''ShowCart''.tpl
  modules/''cart''/templates/blocks/''ShowCart''.tpl
If there's a parameter you think might exist but isn't documented above, try viewing the template to see if it does in fact exist in the template. If it does, you can go ahead and use it when you load a block.
如果你发现有参量可能存在但未被记录的话,请查看模板来确定该参量实际是否存在于模板中,如存在的话,就可以在载入区块时使用它了。


== Block Parameters ==
== Block参量==
* Required fields: description, type, default
* 需要字段:description,type,default
* Optional fields: overrides
* 可选字段:overrides
* Allowed types: boolean, choice, text
* 被允许的类型:boolean,choice,text


=== Text Parameter ===
=== Text参量===
* Allowed values: Any text
*允许值:所有文本
* Example (text here used as container for any number):
* 举例(文本在此用作任意数字的容器):
<pre>
<pre>
             'sizeLimit' => array(
             'sizeLimit' => array(
                 'description' => $gallery->i18n('Maximum number of keywords (empty for no limit)'),
                 'description' => $gallery->i18n('关键词的最大数量(为空的话则表示无限制)'),
                 'type' => 'text',
                 'type' => 'text',
                 'default' => ''),
                 'default' => ''),
</pre>
</pre>


=== Boolean Parameter ===
=== Boolean参量===
* Allowed values: 'true', 'false'
*允许值: 'true', 'false'
* Example:
*举例:
<pre>
<pre>
             'onlyPublic' => array(
             'onlyPublic' => array(
                 'description' => $gallery->i18n('Keywords from public items only'),
                 'description' => $gallery->i18n('仅来自公共项目的关键词'),
                 'type' => 'boolean',
                 'type' => 'boolean',
                 'default' => 'true'),
                 'default' => 'true'),
</pre>
</pre>


=== Choice Parameter ===
=== Choice参量===
* Allows values: Any text
* 允许值:所有文本
* Example:
* 举例:
<pre>
<pre>
             'show' => array(
             'show' => array(
                 'description' => $gallery->i18n('Number of comments'),
                 'description' => $gallery->i18n('评论数量'),
                 'type' => 'choice',
                 'type' => 'choice',
                 'default' => '2',
                 'default' => '2',
                 'choices' => array(
                 'choices' => array(
                     '1' => $gallery->i18n('1 comment'),
                     '1' => $gallery->i18n('1条评论'),
                     '2' => $gallery->i18n('2 comments'),
                     '2' => $gallery->i18n('2条评论'),
                     '5' => $gallery->i18n('5 comments'),
                     '5' => $gallery->i18n('5条评论'),
                     '10' => $gallery->i18n('10 comments'),
                     '10' => $gallery->i18n('10条评论'),
                     '100' => $gallery->i18n('100 comments'))))),
                     '100' => $gallery->i18n('100条评论'))))),
</pre>
</pre>
Note: The array key of choices is the value that is passed to the block. The array value is the text shown to the user as a choice in the theme settings (e.g. in ''Site Admin'' -> ''Themes'').
注:Choice的数组键为被传送到区块的数值。数组值作为外观主题设定中的一个choice以文本形式显示给用户(比如在''站点管理(Site Admin)'' -> ''外观主题(Themes)''中)。


=== Overrides ===
=== Overrides ===
* A parameter can override other parameters. If overrides are specified, then the listed parameters will be greyed out by default. The overridden parameters can only be edited when the value of the master parameter is 'false' (unchecked checkfield).
* 一个参量可以覆盖其他的参量。如果覆盖是特定的,那么被列出的参量默认会变灰(即不可用)。被覆盖的参量仅当主参量为'false'时才可被编辑(unchecked checkfield)。
* Example:
* Example:
<pre>
<pre>
             'forItem' => array(
             'forItem' => array(
                 'description' =>
                 'description' =>
                     $gallery->i18n('Keywords for current item (uncheck to show all keywords)'),
                     $gallery->i18n('当前项目的关键词(uncheck以显示所有关键词)'),
                 'type' => 'boolean',
                 'type' => 'boolean',
                 'default' => 'true',
                 'default' => 'true',
                 'overrides' => array('onlyPublic', 'sizeLimit')),
                 'overrides' => array('onlyPublic', 'sizeLimit')),
             'onlyPublic' => array(
             'onlyPublic' => array(
                 'description' => $gallery->i18n('Keywords from public items only'),
                 'description' => $gallery->i18n('仅来自公共项目的关键词'),
                 'type' => 'boolean',
                 'type' => 'boolean',
                 'default' => 'true'),
                 'default' => 'true'),
             'sizeLimit' => array(
             'sizeLimit' => array(
                 'description' => $gallery->i18n('Maximum number of keywords (empty for no limit)'),
                 'description' => $gallery->i18n('关键词的最大数量(为空的话则表示无限制)'),
                 'type' => 'text',
                 'type' => 'text',
                 'default' => ''),
                 'default' => ''),
</pre>
</pre>
Note: In this example, the user needs to click on the "forItem" checkbox to enable the other parameter fields.
注:在此例中,用户需要点击"forItem"复选框以启用其他的参量字段。


== Creating New Blocks ==
== 新区块的创建==
See [[Gallery:How_To_Create_Blocks|How To Create Blocks]]
参看[[Gallery:How_To_Create_Blocks|如何创建区块]]


[[Category:Gallery 2:Development]]
[[Category:Gallery 2:Development]]

2008年11月4日 (二) 17:01的最新版本

模块提供的区块能够放置到Gallery布局中的任意位置。想想乐高(Lego)砖吧,通过任意布置区块,你可以创建自己的布局样式。

用法[ ]

用法:{g->block type=blockType [block-specific parameters]}

  • g->block在模板中插入Gallery区块。这与通过站点管理界面所配置的相册,相片一类的区块相似
  • 使用中的g->block例子可以在Gallery附带的模板源代码中找到,例如在Floatrix外观主题

区块[ ]

  • albumselect.AlbumSelect
    • 在选择框中显示相册列表
  • albumselect.AlbumTree
    • 在动态树型结构中显示相册列表
  • cart.ShowCart
    • 带有cart内容摘要信息的区块,以及一个链接供查看cart之用
  • comment.ViewComments [item=..] [show=..]
    • 显示特定项目指定数量的最新评论的区块
    • 项目默认为$theme.item;显示默认为3
  • comment.AddComment [item=..]
    • 显示添加评论表单的区块
    • Item defaults to $theme.item
  • core.BreadCrumb [separator=..]
    • 显示上级相册的链接
    • 数据必须事先通过loadCommonTemplateData的'parents'键被载入
    • 可选的分隔字串被置于各相册名称之间
  • core.EmergencyEditItemLink [permissions=..] [checkBlocks=..]
    • 如core.ItemLinks区块在特定区块列表中没有被找到的话,则会显示"编辑(Edit)"链接,用户可以编辑当前项目
    • 权限默认为$theme.permissions
    • 旧的checkSidebarBlocks/checkAlbumBlocks/checkPhotoBlocks参量被弃用;取而代之地使用类似checkBlocks="sidebar,album"的参量
  • core.GuestPreview
    • 显示给已注册用户区块以选择游客预览模式
  • core.ItemInfo [item=..] [showDate=true] [showOwner=true] [showSize=true] [showViewCount=true] [showSummaries=true]
    • 用以显示给定项目特定数据的区块
    • showSummaries显示所有可用的项目摘要信息,如项目关键词,评论计数以及评分界面等。
  • core.ItemLinks [item=..] [links=..] [useDropdown=..] [lowercase=..]
    • 项目默认为$theme.item;链接默认为$theme.itemLinks(通过loadCommonTemplateData载入)
    • 如useDropdown=true那么就在一个选择列表中显示多个链接
      如果为false或仅有一个链接则显示所有的链接
    • 添加lowercase=true参量来讲所有链接文本转换为小写
  • core.LanguageSelector
    • 显示可以语言选择列表以供用户修改语言
  • core.LoginBlock
    • 如果用户为游客身份则显示登入表单
  • core.NavigationLinks [navigationLinks=..]
    • 稍前位置的链接(返回相片等)
    • 注: 在Gallery2.3中被移除了。该模块仅存于Gallery 2.0到2.2版本中。
  • core.Navigator [navigator=..] [reverseOrder=..] [prefix=..] [suffix=..] [currentPage=..] [totalPages=..] [currentItem=..] [totalItems=..]
    • 为loadCommonTemplateData使用itemNavigator或pageNavigator键,并传送navigator=$theme.navigator
    • 设置reverseOrder=true来交换下一个/上一个以及第一个/前一个部分的次序(如css浮点被用于显示中则很有用)
    • Prefix = text置于第一个/前一个链接之前;Suffix = text置于下一个/上一个链接之后
    • 包括currentPage/totalPages在导航链接中添加x/y页(Page x of y)(常自$theme.currentPage和$theme.totalPages取值)。
    • 包括currentItem/totalItems 在导航链接中添加x/y(x of y )(可使用core.LoadPeers callback来取值)。
  • core.Pager
    • 具有当前页数及至其他页面链接的区块
    • 数据必须已通过loadCommonTemplateData的'jumpRange'键被载入
  • core.PeerList [item=..] [windowSize=..]
    • 某些peer项目的链接;项目默认为$theme.item而windowSize默认为7
  • core.PhotoSizes
    • 显示图片尺寸及查看各尺寸链接的区块
    • 数据必须已通过loadCommonTemplateData的'imageViews'键被载入
  • core.SystemLink [linkId=..]
    • 如给定的linkId通过loadCommonTemplateData的'systemLinks'键被载入的话,则显示对应的链接
  • core.SystemLinks [order=..] [othersAt=..] [separator=..]
    • 显示所有系统链接;数据必须已通过loadCommonTemplateData的'systemLinks'键被载入
    • Order为由空格隔开的已知链接id的列表以给出需要显示的order链接
    • OthersAt为"order"值中未被给出的所有链接的位置(其中1 = 第一个)
    • 分隔符为各链接之后所包括的字串
  • core.ThemeSettingsForm [formId=..] [message=..]
  • customfield.CustomFields [item=..]
    • 为给定项目显示'细节(detail)'自定义字段(默认为$theme.item)
  • exif.ExifInfo [item=..]
    • 为给定项目显示带有控制以选择摘要或是详细视图的EXIF数据(默认为$theme.item)
  • imageblock.ImageBlock [parameters..]
    • 图片区块(Image block);见站点管理(Site Admin) -> 图片区块(Image Block)来获取可用参量列表(如使用blocks= 取代g2_blocks=)
    • 举例:{g->block type="imageblock.ImageBlock" blocks="randomAlbum|randomImage" showDate=0 showOwner=1 showViews=1 showTitle=1 showHeading=0 useDefaults=0}
    • 如果你希望覆盖站点管理(Site Admin) -> 图片区块(Image Block)中设定的站点默认的话,那么就需要useDefaults=0
    • repeatBlock=.. 将会重复给定区块参量相应的次数(例如,blocks=recentImage|recentImage与blocks=recentImage repeatBlock=2的效果是一样的)
  • imageframe.ImageFrame (container) [frame=..] [width=..] [height=..] [maxSize=..]
    • 在该容器中对内容周围的指定边框类型进行渲染
    • 内容中的图片在其类别属性中应具有%CLASS%以及%ID% 作为其id
    • ImageFrame的定义必须经使用imageframe的模块/外观主题的imageframe->init()呼叫被载入过了
    • 提供宽/高来生成固定尺寸的imageframe (大多浏览器都可兼容)。可选地添加maxSize参量来调整给定规格尺寸以符合要求(见g->image)。
    • 忽略宽/高以生成根据自身内容动态调整尺寸的imageframe,这在页面读取后内容尺寸改变(通过javascript)时仍如此。然而,此类imageframe在Opera或Safari浏览器中可能无法正确地进行渲染。
  • keyalbum.KeywordLinks [forItem=..] [item=..] [onlyPublic=..] [showCloud=..] [maxCloudFontEnlargement=..]
    • 显示关键词相册(Keyword Albums)的链接
    • 如forItem为true(默认为true)则显示给定项目关键词的链接简化列表(项目默认为$theme.item)
    • 如forItem为false则载入所有关键词(onlyPublic默认为true;载入公共项目或所有项目的关键词)并显示一选择列表或关键词云(keyword cloud)(showCloud默认为false)
    • maxCloudFontEnlargement为最常见关键词字体尺寸的像素值,默认为5
  • members.MembersSummary
    • 具有成员数及成员列表链接的区块(如用户可进行访问的话)
  • quotas.QuotasSummary
    • 显示当前用户的磁盘用量及分区
  • rating.Rating [item=..]
    • 为给定项目显示评分界面(默认为$theme.item)
  • rss.RssBlock
    • 显示RSS feed的链接
  • search.SearchBlock [showAdvancedLink=..]
    • 带有供搜索Gallery之用的文本输入的区块
    • 除非特别指定,均显示高级搜索链接(showAdvancedLink默认为true)

模板位置[ ]

各区块的模板都位于一标准位置中,我们以cart.ShowCart为例。模板位于:

modules/cart/templates/blocks/ShowCart.tpl

如果你发现有参量可能存在但未被记录的话,请查看模板来确定该参量实际是否存在于模板中,如存在的话,就可以在载入区块时使用它了。

Block参量[ ]

  • 需要字段:description,type,default
  • 可选字段:overrides
  • 被允许的类型:boolean,choice,text

Text参量[ ]

  • 允许值:所有文本
  • 举例(文本在此用作任意数字的容器):
            'sizeLimit' => array(
                'description' => $gallery->i18n('关键词的最大数量(为空的话则表示无限制)'),
                'type' => 'text',
                'default' => ''),

Boolean参量[ ]

  • 允许值: 'true', 'false'
  • 举例:
            'onlyPublic' => array(
                'description' => $gallery->i18n('仅来自公共项目的关键词'),
                'type' => 'boolean',
                'default' => 'true'),

Choice参量[ ]

  • 允许值:所有文本
  • 举例:
            'show' => array(
                'description' => $gallery->i18n('评论数量'),
                'type' => 'choice',
                'default' => '2',
                'choices' => array(
                    '1' => $gallery->i18n('1条评论'),
                    '2' => $gallery->i18n('2条评论'),
                    '5' => $gallery->i18n('5条评论'),
                    '10' => $gallery->i18n('10条评论'),
                    '100' => $gallery->i18n('100条评论'))))),

注:Choice的数组键为被传送到区块的数值。数组值作为外观主题设定中的一个choice以文本形式显示给用户(比如在站点管理(Site Admin) -> 外观主题(Themes)中)。

Overrides[ ]

  • 一个参量可以覆盖其他的参量。如果覆盖是特定的,那么被列出的参量默认会变灰(即不可用)。被覆盖的参量仅当主参量为'false'时才可被编辑(unchecked checkfield)。
  • Example:
            'forItem' => array(
                'description' =>
                    $gallery->i18n('当前项目的关键词(uncheck以显示所有关键词)'),
                'type' => 'boolean',
                'default' => 'true',
                'overrides' => array('onlyPublic', 'sizeLimit')),
            'onlyPublic' => array(
                'description' => $gallery->i18n('仅来自公共项目的关键词'),
                'type' => 'boolean',
                'default' => 'true'),
            'sizeLimit' => array(
                'description' => $gallery->i18n('关键词的最大数量(为空的话则表示无限制)'),
                'type' => 'text',
                'default' => ''),

注:在此例中,用户需要点击"forItem"复选框以启用其他的参量字段。

新区块的创建[ ]

参看如何创建区块