Gallery2:Themes:Embedded Theme Considerations - Gallery Codex
Personal tools

Gallery2:Themes:Embedded Theme Considerations

From Gallery Codex

NOTE: This documentation is for the g2bridge module for Drupal 4, 5 or 6.
For Drupal 7+, please refer to the G2Drupal Bridge

Gallery can be embedded within other applications, including content management systems (CMS) like Wordpress, Drupal, and Joomla, among others. This ability creates feature-rich applications but presents certain user interface challenges for web designers. This section will discuss theme design and development considerations when integrating Gallery with other applications.

Gallery and the CMS in which it is embedded usually have similar interface components, such as sidebars, page titles, and breadcrumbs. Gallery integration developers have taken this fact into account during development. For example, the Gallery module for Drupal addresses repeated elements by stripping page blocks, like the sidebar, at runtime. Style sheets are also used to turn off the visual display of items through the CSS display property.

General Theme Considerations

There are a few theme development and integration points that apply to all themes, regardless of the application with which Gallery is integrated.

Style Sheets

Since both Gallery and CMS's are designed as stand-alone applications, their style sheets are developed to stand-alone. After embedding Gallery, it's not unusual to see inconsistent font properties, colors, and spacing issues. Gallery's style sheets are often called before the CMS, as they should be, and this means that CMS style definitions usually override or extend Gallery's styles definitions. Theme developers must edit the CMS and Gallery's style sheets to resolve CSS inheritance and specificity issues.

Theme designers should carefully consider where styles should be defined.


Embedded-Only Style Sheets

One method to resolve style conflicts in embedded galleries is to add an embedded style sheet to Gallery themes. This style sheet should be included in the theme only when Gallery is embedded and can adjust style declarations or hide Gallery theme elements altogether.

To add an embedded style sheet, add the following to your theme's standardSettings array, contained in the theme.inc file:

 'isEmbedded' => GalleryUtilities::isEmbedded()

Then add an isEmbedded check to your theme.tpl head area.

 {if $isEmbedded }
 <link href="{g->theme url="embedded.css"}" rel="stylesheet" type="text/css" media="screen" />
 {/if}

Finally, create the embedded.css style sheet in gallery2/yourtheme/. The following is an example for a Drupal-embedded Gallery theme.

 /* embedded styles */
 
 /* Zero out album and image container margins, let the CMS's CSS takeover */
 #doc3, #bd { margin: 0; padding: 0; }
 
 /* Let the CMS display item titles and breadcrumbs */
 .block-core-BreadCrumb, .giInfo h1 { display: none; }

Drupal Theme Considerations

Wordpress Theme Considerations

WordPress plugin specifically designed for Gallery: http://wpg2.galleryembedded.com

Joomla Theme Considerations

Xaraya Theme Considerations