Gallery2:How Do I Remove the Root Album Link - Gallery Codex
Personal tools

Gallery2:How Do I Remove the Root Album Link

From Gallery Codex

Important: This can only be done by the albums' administrator, because you have to do changes in a core template, called "BreadCrumb.tpl"!

Here is a step by step guide which descipes how to remove the root album link. Removing the root album link is a good idea if you want visitors of a users' album not to get outside of this album.

Step by step:

1. First create new subdir "local" in "gallery2/modules/core/templates/blocks/".

2. Copy BreadCrumb.tpl to this new subdir

3. Change local/BreadCrumb.tpl in the following way:

{*
 * $Revision: 1.4 $
 * If you want to customize this file, do not edit it directly since future upgrades
 * may overwrite it.  Instead, copy it into a new directory called "local" and edit that
 * version.  Gallery will look for that file first and use it if it exists.
 *}
{*
 * Go through each breadcrumb and display it as a link.
 *
 * G2 uses the highlight id to figure out which page to draw when you follow the
 * breadcrumbs back up the album tree.  Don't make the last item a link.
 *}
<div class="{$class}">
  {section name=parent loop=$theme.parents}
  
  {if !$smarty.section.parent.last}
	{if !$smarty.section.parent.first}
  		

		<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.parents[parent].id`"
			   arg3="highlightId=`$theme.parents[parent.index_next].id`"}"
	     class="BreadCrumb-{counter name="BreadCrumb"}">
	    {$theme.parents[parent].title|default:$theme.parents[parent].pathComponent|markup:strip}</a>
	    {if isset($separator)} {$separator} {/if}
	{else}
             {* further in sub-album tree*}
	{/if}
  {else}
  	{if $smarty.section.parent.first}
		{* first sub-album*}
	{else}
	  <a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$theme.parents[parent].id`"
			   arg3="highlightId=`$theme.item.id`"}"
	     class="BreadCrumb-{counter name="BreadCrumb"}">
	    {$theme.parents[parent].title|default:$theme.parents[parent].pathComponent|markup:strip}</a>
	    {if isset($separator)} {$separator} {/if}
  	{/if}
  {/if}
	  {/section}

	  {if ($theme.pageType == 'admin' || $theme.pageType == 'module')}
	  <a href="{g->url arg1="view=core.ShowItem"
			   arg2="itemId=`$theme.item.id`"}" class="BreadCrumb-{counter name="BreadCrumb"}">
	     {$theme.item.title|default:$theme.item.pathComponent|markup:strip}</a>
	  {else}
		<span class="BreadCrumb-{counter name="BreadCrumb"}">
		{$theme.item.title|default:$theme.item.pathComponent|markup:strip}</span>
	  {/if}
</div>