The Titan CMS Photo Block allows users to automatically generate lists of photo thumbnail images with links to large-format versions of the same image. The HTML generated for a Photo Block is defined by an eXtensible Stylesheet Language (XSL) template file that is mapped to the block using Titan Administration. A core feature of Titan CMS is to allow users to create their own XSL files and map them to existing Blocks to generate different HTML content. To integrate Lightbox functionality into the Titan CMS Photo Block, a new XSL file must be created to add the Lightbox attributes to the links created by the Photo Block.
Note: Modifying XSL code, if done incorrectly, could cause a failure on the page attempting to use that code. We do not recommend making changes to these files on a live site until after sufficiently testing the modification.
- Login to your Titan CMS Workstation as a webmaster or administrative user.
- Switch to the Titan Administration module.
- Go to the configuration screen for the Blocks in your specific Globe under the Content Sites node, and expand the Photo Block details.
- Click the Add New Configuration File button, and browse to Blocks > PhotoBlock, and click on the XSL folder. The list on the right will refresh and show all available XSL files for the Photo Block.
- Select the DefaultPhotoBlock.xsl file and click the Download button in the toolbar. This will prompt you to Open or Save. Save the file to your Desktop with the name “LightboxPhotoBlock.xsl”.
- From the file selection dialog, click the Upload button. Using the Select fields, browse to the LightboxPhotoBlock.xsl file on your Desktop and Upload it. Once uploaded, select it from the Titan file list and click OK.
With the new XSL configured for the Photo Block, the last step is to use the Edit button to open Titan CMS’s inline text editor for modifying the new XSL. The default Photo Block code has several locations where a link to the large image is created. Any of these links could also contain the Lightbox attributes. To add the Lightbox attributes to the Filmstrip of small thumbnail images, modify the following code:
Change this:
<xsl:template match="Node" mode="FilmstripThumb">
<img src="{LinkParameter}" title="{DisplayName}"
onclick="ChangeImageSource('webImageDiv{$BlockNumber}', '{LinkParameter}', {$SmallThumbWidth}, {$MediumThumbWidth}, {$BlockNumber});"/>
</xsl:template>
To this:
<xsl:template match="Node" mode="FilmstripThumb">
<a href=”{concat(substring-before(LinkParameter, concat('_T', $SmallThumbWidth)), substring-after(LinkParameter, concat('_T', $SmallThumbWidth)))}” rel=”lightbox[album]”>
<img src="{LinkParameter}" title="{DisplayName}"/>
</a>
</xsl:template>
After the code changes are complete, Save the XSL and Refresh the Site State. This will make it possible for you to modify content pages to use the new block XSL. If you make additional changes to the XSL, you must Refresh the Site State to reset the cached version of the current XSL.