Subalbum gallerytitle

When I hover my subalbum gallerytitle there is no popup like the rest of my albums/photos, here is my gallerytitle:

[code]
<div id="gallerytitle">
<h3>" title="<?php echo gettext('Return to index'); ?>">Index
| <?php printParentBreadcrumb("", " | "); printAlbumBreadcrumb("", " | "); ?>
<?php printImageTitle(true); ?></h3>
</div>
[/code]

A small example how the gallerytitle is build up right now:

Index | 2009 | Amsterdam (EHAM) | US Airways - N941UW

When I hover index I see: Return to index.
When I hover 2009 I see nothing.
When I hover Amsterdam (EHAM) I see: Return to album tumbnails.

My Question: How can I insert the title= so I can see the hover on 2009.
I tried something with the printParentBreadcrumb but without succes.

TIA

Comments

  • acrylian Administrator, Developer
    You are actually talking about the album title. In Zenphoto terms the "gallery title" is the name of your whole Zenphoto installation.

    The hover (actually a tooltip) should show an excerpt of the description of the album. If there is none it shows nothing. You can't add that without hacking the functions which we naturally don't recommend.
  • The Title text for printParentBreadcrumb() appears to include html formatting tags. Is there any way to get rid of those, as it looks unprofessional with etc all over in it. Thanks.
  • acrylian Administrator, Developer
    Could you please be more specific maybe?
  • Sure,
    A real obvious example is here:
    http://share.gospelriver.com/Music/Array-Hymn/

    Mouse over "Music" in the nav and you will see what I mean.
  • Sure, don't put html into titles. Probably you really meant that text as a description anyway.
  • Confused... All I have for a title is "Music" which is what shows up in the nav and what is coming up as the "title" of the link is what is contained in the description <div>...
  • Seems the breadcrump function will display the description if it exists. In that case the HTML tags need to be stripped.
  • I see. For anyone with the same issue, I changed the following block as follows in printParentBreadcrumb method in /zp-core/template-functions.php -- of course this will have to be saved and redone again after an upgrade. If there's a better way please let me know.

    `
    foreach($parents as $parent) {
    if ($i > 0) echo $between;
    $url = rewrite_path("/" . pathurlencode($parent->name) . "/", "/index.php?album=" . pathurlencode($parent->name));
    $desc = $parent->getDesc();
    $desc = strip_tags($desc);
    $replaceThese = array("&","
    ","
    ","
    ");
    $desc = str_ireplace($replaceThese," ",$desc);
    $desc = substr($desc, 0, 25)."...";
    if (!empty($desc) && $truncate) $desc = truncate_string($string, $length, $elipsis);
    printLink($url, $parent->getTitle(), $desc);
    $i++;
    }
    `
  • Edit: I don't know why
    `if (!empty($desc) && $truncate) $desc = truncate_string($string, $length, $elipsis);` doesn't appear to function for me, but I truncated the desc beforehand instead.
  • The stript_tags should have been sufficient. THere then should have been no tags as those would have bees stripped by the function. Not sure why you are removing the ampersand. But if there are such in the description that are not already `&` then that is what they should be turned into.

    Not sure on the truncate--did you pass `true` to that parameter or just leave it unspecified? If the latter, then of course truncate was not chosen.
  • Oh, I had the wrong order in my code. It should be like this:
    `
    foreach($parents as $parent) {
    if ($i > 0) echo $between;
    $url = rewrite_path("/" . pathurlencode($parent->name) . "/", "/index.php?album=" . pathurlencode($parent->name));
    $desc = $parent->getDesc();
    $replaceThese = array("
    ","
    ","
    ");
    $desc = str_ireplace($replaceThese," ",$desc);
    $desc = str_ireplace("&","&",$desc);
    $desc = strip_tags($desc);
    $desc = substr($desc, 0, 25)."...";
    if (!empty($desc) && $truncate) $desc = truncate_string($string, $length, $elipsis);
    printLink($url, $parent->getTitle(), $desc);
    $i++;
    }
    `
    This way, line breaks are replaced with spaces before de-tagging. If you just remove the tags, words after a line break are put up against the previous word with no space.

    You're right about & - I changed that to & instead. Otherwise it was displaying as & even though in the description it is & (but not in the html of course).

    I didn't try to figure out how to pass true to the parameter... and I only wanted to modify that one function. I assuming I would have to modify more code to do what you mention.
  • * edit: my post was changed due to processing the html. The ampersand part should be

    You're right about & amp; - I changed that to & instead. Otherwise it was displaying as & amp; even though in the description it is & (but not in the html of course).
  • `printParentBreadcrumb('', ' | ',' | ', )`

    But that will not work without also changing the line in the function to
    `if (!empty($desc) && $truncate) $desc = truncate_string($desc , $truncate, $elipsis);`
  • Ah, now I get it. Thanks.
  • ARG, posting about ampersands is really confusing on this site!

    So unfortunately I am not clear on what you did. Did you change & amp; into &? or the other way around?
  • You're right, reviewing my code, it replaced my & amp; with & above. I was changing from the html coded amp to the string amp. So the line should I think be (without the space after &)
    `$desc = str_ireplace("& amp;","&",$desc);`

    Yes, I wondered where the $length variable came from. What you wrote makes more sense. I was confused because a search of my template-functions file yields only one location of $length (in that line) so I'm still uncertain how it is supposed to get that value. Did you forget the $elipsis='...' parameter in your modified declaration?

    ... also just notice now that the $replaceThese is displaying wrong. It changed every break to the same thing when it should be three different versions. I think the "code" functionality on this forum needs some work :) But I guess that is likely by design to clean up the code.

    $replaceThese = array("<b r />","<b r/>","<b r>");
  • Thanks for the update. I have used a preg_replace to get past the issue of the spaces.

    In PHP, if a parameter has a default ($elipsis='...') you can omit the parameter and it will take on its default. Of course the rub is that you cannot omit intermediate parameters. Generally we have used a default of NULL for default parameters and have code in the body to set them to default if NULL is passed. Makes omitting parameters a little easier, but for some reason that was not done in this function.
  • The original function has it included I think?
    `function printParentBreadcrumb($before = '', $between=' | ', $after = ' | ', $truncate=NULL, $elipsis='...') {`

    So now that I understand the php default terminology your function makes sense.

    This wasn't meant to be an analysis of the function, and obviously I don't know much about php, but I'm not sure where the $string variable in the original function comes from either...

    `if (!empty($desc) && $truncate) $desc = truncate_string($string, $length, $elipsis);`

    I'm good to go on this. Thanks again.
  • The original code did not make any sense. The line I posted above should be correct. Anyway, all changes are in the nightly build now.
Sign In or Register to comment.