IPTC Caption to page title
|
pumaka
Joined: 2007-05-14
Posts: 40 |
Posted: Fri, 2008-01-04 02:58
|
|
Hello, Anyone know how to do it? Thanks in advance! |
|
| Login or register to post comments |

Posts: 16315
First you will want to edit photo.tpl for the photo pages. Then:
http://gallery.menalto.com/node/70717#comment-254616
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
Hi Dave,
this is not what I'm looking for or perhaps I misunderstood?
I want the <title> of the page (<title>page title</title) to be what my IPTC: Caption is for any given image. And in my first post I incorrectly said "album.tpl" while I meant "theme.tpl". I want to edit this file because this is the only place where I found <title> and as I understand, it sets the title for the entire site.
I figured out how to display Album name in page title, but would also like to include the IPTC Caption.
Thank you.
Posts: 16315
When viewing a album where do you want to get the IPTC: Caption data?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
When a thumbnail is clicked (so you're at the photo page), I want IPTC Caption to be the title of the page.
Title of the page - I mean title that's in HTML between tags <title> and </title>. For example the title of this forum page in the browser (at the top left) is "IPTC Caption to title | Gallery". This is where I want IPTC Caption to show up.
Thank you.
Posts: 16315
How farmilar are you with smarty tags and {if} statements? The code from the thread I mentioned is the vast majority of the code required to extract a single field from the EXIF data of a photo.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
I'm not very familiar with them. Pretty much everything I've been able to achieve manipulating the tags was by lengthy trial and error. I tried putting different parts of your code into my <title> but it's not working.
Here's my title right now:
<title>
{$theme.item.title|markup:strip|default:$theme.item.pathComponent}
{$theme.item.description|markup}
{$theme.item.IPTC.Caption} </title>
This displays the Album name AND Photo Description. However, not all my pictures have descriptions, some of them only have IPTC: Caption. Can I somehow carry over the IPTC: Caption to be also Photo description automatically?
Thank you for your patience! I'm just stumbling in the dark here.
Posts: 16315
So you want to check to see if {$theme.item.IPTC.Caption} is not empty and use {$theme.item.description|markup} if it is empty?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 16315
Just to confirm, You managed to get {$theme.item.IPTC.Caption} to display if it has the data in the photos EXIF data?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
{$theme.item.IPTC.Caption} shows what I enter manually in the "Description" field (under Edit Photo, where it says "This is the long description of the item.")
Posts: 16315
Can you show me in your template code where you are using:
{$theme.item.IPTC.Caption}
?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
Hi Dave,
please see attached file.
Posts: 40
For some reason I can't view my attachment above (no permissions). In case you're unable to view it too, here's the code (relevant part):
{*
* $Revision: 15342 $
*}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="{g->language}">
<head>
{* Let Gallery print out anything it wants to put into the <head> element *}
{g->head}
{* If Gallery doesn't provide a header, we use the album/photo title (or filename) *}
{if empty($head.title)}
{*Here's the title*}
<title>AR Stock - Rights-Managed Stock Photography - {$theme.item.title|markup:strip|default:$theme.item.pathComponent} {$theme.item.description|markup}
{$theme.item.IPTC.Caption} </title>
{*end title*}
{/if}
{* Include this theme's style sheet *}
<link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/>
</head>
<body class="gallery">
Posts: 16315
{$theme.item.IPTC.Caption} does nothing. Where did you get that from?
Did you add some code from that post or are you lost now.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
I just deleted that part and you're correct, it didn't change anything at all (manually entered description still shows up in page titles and "IPTC: Caption" does not).
To answer your question, I got {$theme.item.IPTC.Caption} from some module code. I was randomly copying/pasting stuff hoping something would show up as I wanted it.
I AM pretty confused at this point. If there is no manually entered description, can IPTC: Caption automatically take its place?
Do you teach kindergarten by any chance? You are very patient. Thank you
Posts: 16315
Not tested but I think it should work. Most of the code from the other post.
Edit theme.tpl
{* If Gallery doesn't provide a header, we use the album/photo title (or filename) *} {if empty($head.title)} <title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title> {/if}{* If Gallery doesn't provide a header, we use the album/photo title (or filename) *} {* If a photo page the extract the IPTC: Caption for the title *} {if $theme.pageType == 'photo'} {if empty($item)} {assign var=item value=$theme.item} {/if} {* Load up the EXIF data *} {g->callback type="exif.LoadExifInfo" itemId=$item.id} {if !empty($block.exif.LoadExifInfo.exifData)} {assign var="exif" value=$block.exif.LoadExifInfo} {if !empty($exif.exifData)} {section name=outer loop=$exif.exifData step=2} {section name=inner loop=$exif.exifData start=$smarty.section.outer.index max=2} {* If have IPTC: Caption use it as the title ELSE show the item title *} {if ($exif.exifData[inner].title == "IPTC: Caption")} <title>{$exif.exifData[inner].value}</title> {else} <title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title> {/if} {/section} {/section} {/if} {/if} {else} {if empty($head.title)} <title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title> {/if} {/if}Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 40
It works! Never would've figured it out on my own.
Thank you very very much
Posts: 16315
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team