Difference between revisions of "Gallery2:Themes:Reference:Blocks" - Gallery Codex
Personal tools

Difference between revisions of "Gallery2:Themes:Reference:Blocks"

From Gallery Codex

(Categorization + Small text addition)
(Blocks)
Line 1: Line 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.
 
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.
 +
 +
==Usage==
 +
Usage: {'''g->block''' type=''blockType'' [block-specific parameters]}
 +
 +
* '''g->block''' inserts a Gallery block in a template.  This is similar to the blocks that are configured for albums, photos, etc through the Site Admin interface
 +
* Examples of '''g->block''' in use can be found in the source code of the templates that come with Gallery, for example in the [http://svn.sourceforge.net/viewcvs.cgi/gallery/trunk/gallery2/themes/floatrix/templates/album.tpl?annotate=13913#l9 Floatrix theme]
  
 
==Blocks==
 
==Blocks==

Revision as of 20:14, 13 May 2007

Modules can provide blocks that can be placed anywhere in your Gallery layout. Think of Lego bricks, you can build your own layout by arranging blocks any way you want.

Usage

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

  • g->block inserts a Gallery block in a template. This is similar to the blocks that are configured for albums, photos, etc through the Site Admin interface
  • Examples of g->block in use can be found in the source code of the templates that come with Gallery, for example in the Floatrix theme

Blocks

  • albumselect.AlbumSelect
    • Show album list in a select box
  • albumselect.AlbumTree
    • Show album list in a dynamic tree
  • cart.ShowCart
    • Block with summary info about cart contents and a link to view cart
  • comment.ViewComments [item=..] [show=..]
    • Block to show given number of recent comments on given item
    • Item defaults to $theme.item; Show defaults to 3
  • comment.AddComment [item=..]
    • Block to show Add Comment form
    • Item defaults to $theme.item
  • core.BreadCrumb [separator=..]
    • Show links to ancestor albums
    • Data must already be loaded via 'parents' key to loadCommonTemplateData
    • Optional separator string is placed between each album name
  • 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
    • Permissions default to $theme.permissions
    • Old checkSidebarBlocks/checkAlbumBlocks/checkPhotoBlocks parameters are deprecated; use parameter like checkBlocks="sidebar,album" instead
  • 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]
    • 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.
  • core.ItemLinks [item=..] [links=..] [useDropdown=..] [lowercase=..]
    • Item defaults to $theme.item; Links defaults to $theme.itemLinks (loaded via loadCommonTemplateData)
    • If useDropdown=true then show multiple links in a select list
      If false or there is only one link then show all the links
    • Add lowercase=true parameter to convert all link text to lowercase
  • core.LanguageSelector
    • Show select list of available language to allow user to change language
  • core.LoginBlock
    • If user is a guest then show login form
  • core.NavigationLinks [navigationLinks=..]
    • Links to previous locations (Back to photo, etc.)
  • core.Navigator [navigator=..] [reverseOrder=..] [prefix=..] [suffix=..] [currentPage=..] [totalPages=..] [currentItem=..] [totalItems=..]
    • Use itemNavigator or pageNavigator key for loadCommonTemplateData and then pass 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)
    • Prefix = text to place before first/previous links; Suffix = text to place after next/last links
    • Include currentPage/totalPages to add Page x of y between navigator links (usually get values from $theme.currentPage and $theme.totalPages).
    • Include currentItem/totalItems to add x of y between navigator links (can use core.LoadPeers callback to get values).
  • core.Pager
    • Block with current page number and links to other pages
    • Data must already be loaded via 'jumpRange' key to loadCommonTemplateData
  • core.PeerList [item=..] [windowSize=..]
    • Links to some peer items; item defaults to $theme.item and windowSize defaults to 7
  • core.PhotoSizes
    • Block to show image sizes and links to view each size
    • Data must already be loaded via 'imageViews' key to loadCommonTemplateData
  • core.SystemLink [linkId=..]
    • If given linkId was loaded by 'systemLinks' key to loadCommonTemplateData then show the link
  • core.SystemLinks [order=..] [othersAt=..] [separator=..]
    • Show all system links; data must already by loaded via 'systemLinks' key to loadCommonTemplateData
    • Order is a space separated list of known link ids to give the order links should be displayed
    • OthersAt is the position where any links not given in the "order" value should be place (1 = first)
    • Separator is a string to include after each link
  • core.ThemeSettingsForm [formId=..] [message=..]
  • customfield.CustomFields [item=..]
    • Show 'detail' custom fields for given item (defaults to $theme.item)
  • exif.ExifInfo [item=..]
    • Show EXIF data for given item (defaults to $theme.item) with controls to select summary or detail view
  • imageblock.ImageBlock [parameters..]
    • Image block; see Site Admin -> Image Block for a list of available parameters (e.g. use blocks= instead of g2_blocks=)
    • Example: {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
    • repeatBlock=.. will repeat the given blocks parameter that many times (eg. blocks=recentImage|recentImage is the same as blocks=recentImage repeatBlock=2)
  • 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
    • ImageFrame definitions must already be loaded by imageframe->init() calls from modules/themes using imageframes
    • 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).
    • 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.
  • keyalbum.KeywordLinks [forItem=..] [item=..] [onlyPublic=..] [showCloud=..] [maxCloudFontEnlargement=..]
    • Show links into 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)
    • 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)
    • maxCloudFontEnlargement is how many pixels bigger the font size should be for the most common keyword, default is 5
  • members.MembersSummary
    • Block with number of members and link to members list (if user has access)
  • quotas.QuotasSummary
    • Show disk usage and quota for current user
  • rating.Rating [item=..]
    • Show rating interface for given item (defaults to $theme.item)
  • rss.RssBlock
    • Show links for RSS feeds
  • search.SearchBlock [showAdvancedLink=..]
    • Block with text input for searching the Gallery
    • Show link to advanced search unless specified (showAdvancedLink defaults to true)


Template Locations

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

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.

advertisements