how to make photo.header output image name

ermannob
ermannob's picture

Joined: 2004-01-22
Posts: 28
Posted: Mon, 2007-11-05 09:24

Hi,
I'm trying to customize breadcrumbs. I'd like to make appear all the path to the photo. I've already been able to do that with albums, modifying gallery.header, album.header and photo.header.
I'm having a problem with photo.header. I can output the path to the album, but not the name of the photo.
With the word "path" I mean something like "Homepage > Gallery > albumname > photoname".

Here's the code I put in photo.header:
<div id="path"><a href="/">Home</a><?php if ($gallery->album->fields['returnto'] != 'no') {
foreach ($gallery->album->getParentAlbums() as $navAlbum) {
echo (' &gt; <a href="'. $navAlbum['url'] . '">'.
$navAlbum['title'] . "</a>");
}
}
echo (' &gt; <a href="'. $gallery->album->getAlbumDirURL("full") . '">' . $gallery->album->fields["title"] . '</a>');
echo (' &gt; ' . $title );
?></div>

$title seems not to work. I tried also other variables, but I'm not a PHP programmer, so I don't know what to do.
Can anyone help me?
Thanks a lot!

-ermannob

The following information is required to get an answer:
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): development local copy of www.museosanpiox.it/gallery (my last modifications aren't online)
Gallery version: 1.5.7
Apache version: 2.2.6
PHP version (don't just say PHP 4, please): 5.2.4
Operating system: Gentoo Linux

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Mon, 2007-11-05 10:59

Hello Ermanno,

your code *should* work.

I suggest this:
Get a recent copy of Gallery 1.6 (e.g. from my archive http://jems.de/archive)
Open lib/album.php
Have a look at 'function returnToPathArray'

To show the breadcrumb you just need to do this:

$breadcrumb['text'] = returnToPathArray($gallery->album, true, true);
/* -- breadcrumb text --- */
foreach($breadcrumb["text"] as $nr => $text) {
    echo "\t\t$text\n";
}

See view_photo.php and layout/breadcrumb.inc

To add a link to the photo i would do:

$breadcrumb["text"][] = $gallery->album->getThumbnailTag($id);

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6

 
ermannob
ermannob's picture

Joined: 2004-01-22
Posts: 28
Posted: Tue, 2007-11-06 10:28

Hi Jens,
thanks for your support!
My code actually doesn't work completely. The name of the photo doesn't come out. Maybe because when Gallery executes my code, it didn't load photo data yet?

So I tried to follow your suggestions. I imported the "returnToPathArray" function into gallery 1.5.7, so the code you suggested started to work. So I got some kind of breadcrumb similar to what I was able to get by myself. Anyway I don't know where to put your last line of code. In view_photo.php or breadcrumb.inc?
(Did you mean I shoud upgrade to Gallery 1.6? Is it stable enough for production?)

Thanks very much!!!

-ermanno

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Tue, 2007-11-06 11:27

Add the line after $breadcrumb['text'] = returnToPathArray($gallery->album, true, true);
I guess you placed it in view_photo.php.

Btw: call in view_album.php should be:
$breadcrumb['text'] = returnToPathArray($gallery->album, false, false);

1.6 is quite stable, but not ready for production. It has security issues.

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6