ZenphotoCMS Forum
Pulling my hair out - Can someone help with my Title Tag - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Pulling my hair out - Can someone help with my Title Tag (/thread-9432.html)



Pulling my hair out - Can someone help with my Title Tag - darkufo - 2012-01-17

Ok.

I have an album eg this one.

http://www.spoilertv.co.uk/images/30-rock/season-1/cast-promotional-photos/

Now at the top you can see the Album and breadcrumbs.

ie this

SpoilerTV | Photo Archive | 30 Rock | Season 1 | Cast Promotional Photos

This is all great and working dandy Smile

However if you look at my <title> tag the Page title is

Photo Archive | Cast Promotional Photos

I'm trying to set the Title Tag to be the same as this

SpoilerTV | Photo Archive | 30 Rock | Season 1 | Cast Promotional Photos

However when I try it appears to be inserting html/link.

It seems that <?php printParentBreadcrumb(); ?> provides all the link/html.

Is there a similar function that will just get the text of the breadcrumb etc

Any help/advice/links most appreciated.


Pulling my hair out - Can someone help with my Title Tag - acrylian - 2012-01-17

No, sorry, there is no direct simple function for that. The easiest would be to make a custom function out of that one without the html tags.

Perhaps we should have indeed a "get" variant for this. Best you open a ticket for that so we don't forget.


Pulling my hair out - Can someone help with my Title Tag - darkufo - 2012-01-17

Thanks Acrylian.

Where would I find the printParentBreadcrumb function. Which file would it be in?


Pulling my hair out - Can someone help with my Title Tag - darkufo - 2012-01-17

It's ok found it Smile


Pulling my hair out - Can someone help with my Title Tag - gjr - 2012-01-17

I use the following function in a few of my themes to get the album/image parent breadcrumb. I would call this in the title tag on album.php and image.php, along with the rest of the title info.
`
// Sets expanded titles (breadcrumbs) for Title meta
function getTitleBreadcrumb($before = ' ( ', $between=' | ', $after = ' ) ') {
global $_zp_gallery, $_zp_current_search, $_zp_current_album, $_zp_last_album;
$titlebreadcrumb = '';
if (in_context(ZP_SEARCH_LINKED)) {
$dynamic_album = $_zp_current_search->dynalbumname;
if (empty($dynamic_album)) {
$titlebreadcrumb .= $before.gettext("Search Result").$after;
if (is_null($_zp_current_album)) {
return;
} else {
$parents = getParentAlbums();
}
} else {
$album = new Album($_zp_gallery, $dynamic_album);
$parents = getParentAlbums($album);
if (in_context(ZP_ALBUM_LINKED)) {
array_push($parents, $album);
}
}
} else {
$parents = getParentAlbums();
}
$n = count($parents);
if ($n > 0) {
$titlebreadcrumb .= $before;
$i = 0;
foreach($parents as $parent) {
if ($i > 0) $titlebreadcrumb .= $between;
$titlebreadcrumb .= $parent->getTitle();
$i++;
}
$titlebreadcrumb .= $after;
}
return $titlebreadcrumb;
}
`


Pulling my hair out - Can someone help with my Title Tag - darkufo - 2012-01-17

Awesome, I'll give that a go


Pulling my hair out - Can someone help with my Title Tag - darkufo - 2012-01-17

gjr You are a SUPERSTAR!

Thank you SO much!


Pulling my hair out - Can someone help with my Title Tag - acrylian - 2012-01-17

Yep, that is what I was suggesting. I guess we should have that on board... Not sure why we don't have the usual get/print pair of functions here at all.


Pulling my hair out - Can someone help with my Title Tag - pvankempen - 2013-01-27

Several months ago, we started with the zpmasonry theme and customized / expanded it for our needs. One zpmasonry function that we kept (in our theme's functions.php) is getTitleBreadcrumb. It is exactly the same (character for character) as above (gjr's posting from a year ago).

Our site was working fine until we just now upgraded to 1.4.4. Now it causes an error when we try to view an image in a dynamic album: "Fatal error: Cannot access protected property SearchEngine::$dynalbumname in ...".

Did 1.4.4 modify property dynalbumname?

Any suggestions on how to re-write function getTitleBreadcrumb?


Pulling my hair out - Can someone help with my Title Tag - gjr - 2013-01-27

Try replacing:

$_zp_current_search->dynalbumname;

with:

$_zp_current_search->getDynamicAlbum();


Pulling my hair out - Can someone help with my Title Tag - pvankempen - 2013-01-27

Thanks gjr - that almost did it. That gets the album, but not its name. This actually fixed it:

$_zp_current_search->getDynamicAlbum()->AlbumName