Changing individual picture titles

CV

Joined: 2008-12-03
Posts: 12
Posted: Thu, 2008-12-04 04:28

Hey guys,
I want to be able to have my individual picture pages reflect the album title instead of the crappy looking picture file names.
Is there a way to tweak this part of the code: {$theme.item.title|markup}
in order to make it take the title of the album.

For example: I want to make each picture in the "Ferrari" album say "Ferrari" at the top, not "ferrari_f550_1.jpg" without changing the individual titles.

Thanks much,
David.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2008-12-04 04:49

{$theme.parent.title}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
CV

Joined: 2008-12-03
Posts: 12
Posted: Thu, 2008-12-04 05:19

YOU ARE AMAZING SIR! Thanks for the help

 
CV

Joined: 2008-12-03
Posts: 12
Posted: Thu, 2008-12-04 05:44

I had another quick one. Any idea where to insert a <title> tag? I want to use the same {$theme.parent.title} with Photos after it, but I am not sure where to add it. Here is the top of my code.

{*
* $Revision: 16235 $
* Read this before changing templates! http://codex.gallery2.org/Gallery2:Editing_Templates
*}

{if !empty($theme.imageViews)}
{assign var="image" value=$theme.imageViews[$theme.imageViewsIndex]}
{/if}

<h2>{$theme.parent.title} Photos</h2>

Just wondering if there is a way.

Thanks,
D

 
CV

Joined: 2008-12-03
Posts: 12
Posted: Thu, 2008-12-04 06:18

I am also trying to create a code that I can put into the theme template that will read the {$theme.item.title|markup} for the albums page and the {$theme.parent.title} for the pictures page into the title and keyword tags. Any ideas if I can do that?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2008-12-04 14:50

the <title> tag is generated in theme.tpl:
<title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title>

if you want to change it for the photo page only then you will have to work in a {if} statement. se lower down in the code for an example

Dave
____________________________________________
Blog & G2 || floridave - Gallery Team

 
CV

Joined: 2008-12-03
Posts: 12
Posted: Fri, 2008-12-05 00:35

Got it, and just for reference, here is how I did it:

{if $theme.pageType == 'photo'}
<title>{$theme.parent.title}</title>
<meta name="description" content="{$theme.parent.title}">
<meta name="keywords" content="{$theme.parent.title}">
{elseif empty($head.title)}
<title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title>
<meta name="description" content="{$theme.item.title|markup}">
<meta name="keywords" content="{$theme.item.title|markup}">
{/if}

It tells the server that if it is one of my photo pages, it needs to get the wording from the parent page's title and if it is any other page, get it from that page's title.
Easy stuff, took 5 minutes and I have never written a line of code in my life.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2008-12-05 01:00
Quote:
Easy stuff, took 5 minutes and I have never written a line of code in my life.

Cool! :-)
now you can call yourself a theme developer as well :-)

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team