Gallery2:Modules:replica:How to link to the original item - Gallery Codex
Personal tools

Gallery2:Modules:replica:How to link to the original item

From Gallery Codex

How to make Replica links go to the original item

I needed my replicas to link back to the original items when the users clicked on them. I modified my album.tpl file to force all items that are links to link back to the original. Below is a partial excerpt from my album.tpl file:

               {if ($child.canContainChildren || $child.entityType == 'GalleryLinkItem')}
                 {assign var=frameType value="albumFrame"}
                 {capture assign=linkUrl}{g->url arg1="view=core.ShowItem"
                                                 arg2="itemId=`$child.id`"}{/capture}
               {else}
                 {assign var=frameType value="itemFrame"}
                 {* !!!! Change Starts Here *}
                 {if isset($theme.guestPreviewMode) && $user.isAdmin}
                   {if isset($child.linkId) && $theme.guestPreviewMode == 0}
                     {g->text text="(linked)"}
                   {/if}
                 {/if}                                   
                 {if isset($child.linkId)}
                       {assign var=linkId value=$child.linkId}
                 {else}
                       {assign var=linkId value=$child.id}
                 {/if}
                 {* !!!! /change. *}
                 {capture assign=linkUrl}{strip}
                   {if $theme.params.dynamicLinks == 'jump'}
                     {* !!!! change *}
                     {g->url arg1="view=core.ShowItem" arg2="itemId=`$linkId`"}
                   {else}
                     {* !!!! change *}
                     {g->url params=$theme.pageUrl arg1="itemId=`$linkId`"}
                   {/if}
                 {/strip}{/capture}
               {/if}

It is worth mentioning that I also add the text "(linked)" above the thumbnails so that I can, in admin mode, easily identify which items are replicas/links. It does not show up otherwise.