Summary:
Add new template variables with information about parent gallery
Detailed Description:
When working with sub-galleries, being able to create breadcrumb-like navigation
structures would be very helpful. This could be aided by adding more template
variables that provide information about the parent gallery. At this moment, the
following ones exist:
{$parentid} - id for the parent of the current gallery (only in default action)
{$parentlink} - link to the parent folder
{$parent_url} - url to the parent folder
{$parent_txt} - text to create a link with above url
Unfortunately, there is no variable that provides access to the title of the
parent gallery, or the custom fields (which can be of interest for multilingual
sites).
As a simple measure, I have introduced a {$parenttitle} variable in my own
installation (Gallery 2.5.1), using the following patch against
action.default.php:
--- action.default.php-orig Wed Oct 21 11:59:56 2026
+++ action.default.php Wed Oct 21 12:21:54 2026
@@ -200,6 +200,8 @@
}
$smarty->assign('galleryid', $galleryinfo['fileid']);
$smarty->assign('parentid', $galleryinfo['galleryid']);
+ $parentinfoID =
Gallery_utils::Getgalleryinfobyid($galleryinfo['galleryid']);
+ $smarty->assign('parenttitle', $parentinfoID['title']);
$paramslink['dir'] = strpos($params['dir'], '/') === FALSE ? ''
: '/' . str_replace('%2F', '/', rawurlencode(preg_replace('/^(.*)(\/.+)$/',
'$1', $params['dir'])));
$prettyurl = $urlprefix . $paramslink['dir'] . '/' .
@@ -409,4 +411,4 @@
';
}
}
-?>
\ No newline at end of file
+?>
I realise that there already is a "$parentinfo"-variable present in that file;
however, in my case, it appeared to be empty in all cases - which is why I
created a second "$parentinfoID" variable using Getgalleryinfobyid. That seems
to work well.
In addition to {$parenttitle}, something like {$parentfields} would be fantastic
- if I find the time, I may try my hand at an additional patch...