Make photo titles "Album title - Photo title"
|
nocloo
Joined: 2005-08-18
Posts: 36 |
Posted: Sun, 2006-02-05 05:16
|
|
Where can I change in the template to make the title of a photo when clicked on "Album name - Photo name" instead of "Photo Name" as title ? Thanks, |
|
| Login or register to post comments |

Posts: 8598
you can turn of buffered debug output in config.php and reload a page to get a popup that shows all the data available to the tpl.... i think you can use {$theme.parent.title|markup} - {$theme.item.title|markup} to show album/photo titles in photo.tpl
Posts: 36
I found out it's in theme.tpl
I change the line to add pageType
{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title $theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}
But somehow it doesn't append the filename to $theme.parent.title. I did try various combos but didn't get it to work. Any ideas ?
Thanks
==
Posts: 8598
you need separate { } for each variable you use...
{$theme.parent.title|markup:strip} {$theme.item.title|default:$theme.item.pathComponent|markup:strip}
Posts: 36
Many thanks ... This is my final fix and it works, my thanks to mindless !! I just want to post for those who wants to improve their ranking in search engines.
theme.tpl
{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title|markup:strip} - {$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}
Posts: 12
Here's my small tweak to this code. My only issue with it was the title defaulted to the pathComponent in nocloo's version. For example, let's say you have a gallery called 'Toyota Cars', and in that gallery you have a picture with a filename 'sweet-car.jpg', and then give that picture a title '1994 Twin Turbo Supra MKIV'. With nocloo's version, the title would be:
Toyota Cars - sweet-car.jpg
With my little tweak, G2 will use the image title first, and default to the filename if the image title doesn't exist. With mine, the title tag would read:
Toyota Cars - 1994 Twin Turbo Supra MKIV
Better for spiders, *and* better for the users and search CTR since that title tag is way more descriptive of the image.
The tweaked code:
{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title|markup:strip} - {$theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}
--Illah
Posts: 2
I've found another way to do this. I took the code found in /gallery2/modules/core/templates/blocks/BreadCrumb.tpl and just stripped out the hyperlinks. I wasn't happy with the two examples given above as I wanted the full path shown in the title. I have it setup so it copies the style of the breadcrumb in the pages. Example image here. Below is what I've used in my theme.tpl
<title>Hotelblues.com {if isset($separator)} {$separator} {/if} {foreach name=parent from=$theme.parents item=parent} {if !$smarty.foreach.parent.last} » {$parent.title|markup:strip|default:$parent.pathComponent} {else} » {$parent.title|markup:strip|default:$parent.pathComponent} {/if} {if isset($separator)} {$separator} {/if} {/foreach} {if ($theme.pageType == 'admin' || $theme.pageType == 'module')} {else} » {$theme.item.title|markup:strip|default:$theme.item.pathComponent} {/if}</title>