Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorkanjigirl
    • CommentTimeNov 6th 2005
     
    I was using a <br> to split my long album names into two lines, which works fine on the albums page but not on the individual album page (it also inserts that <br> and makes the breadcrumb appear on two lines, which looks wrong).

    Now I'm using the first line of the album name in the title and the second line in description, and I've modified the PHP file as follows to display both:

    In gallery.php file, find the following line of code on line 517

    $output.= $row["name"].'

    Change that to

    $output.= $row["name"].'<br />'.$row["description"].'

    And that works fine on the albums page:

    http://parallaxwebdesign.com/projects/waterline/plogger/index.php?level=collection&id=1

    But again screws up the breadcrumbs (half the title's missing because it's now in description):

    http://parallaxwebdesign.com/projects/waterline/plogger/index.php?level=album&id=5

    Can I show the title AND description in the breadcrumb list? How would I do that? Or is there some other way to get around the long title issue without using a <br>?

    Thanks

    Debbie
    • CommentAuthorddejong
    • CommentTimeNov 6th 2005
     
    Yes, there are tons of workaround methods with a little PHP.

    You could add an n (newline) then use the nl2br() function to convert it in album view but not picture view. So, in albums:
    $output = "Family nPictures";
    echo $output; // "Family Pictures" -- HTML will ignore the line break
    echo nl2br($output);
    // "Family
    // Pictures" -- PHP converted the line break, which got ignored before, into a <br />

    One thing I don't know is whether nl2br uses a closed br tag, which would suck if you were trying to create a strict XHTML site template.

    So, better, and alternatively, I would suggest replacing spaces in the title with <br />, and using &nbsp; (non-breaking space) for words you don't want to separate in the title -- like "My Family" you probably don't want to be:
    "My
    Family"

    So you would input it as "My&nbsp;Family". But "Really Long Title" would become:

    "Really
    Long
    Title"

    Just an idea. Use a preg_replace() or ereg_replace() function to search for whitespace (can't think of how that would look, I'm not good with regex). Look them up at php.net, and if you still need help post a reply; I would write out the function, but am on my way out the door. ;)

    Best of luck,
    Derek
    • CommentAuthorddejong
    • CommentTimeNov 6th 2005
     
    I'm an idiot. Just use str_replace(), don't bother using regex unless you wanted to create a list (like "My ", "Our ", "A ") of expressions you don't want to replace.

    -- Derek
    • CommentAuthorkanjigirl
    • CommentTimeNov 7th 2005
     
    Derek -

    I am very new to PHP - I have no clue how to write this str_replace function nor where to put it in the PHP file so it affects album names but not breadcrumbs. And what do I replace the whitespace with?

    I'd highly appreciate further instructions...

    Debbie
    • CommentAuthorkanjigirl
    • CommentTimeNov 7th 2005
     
    And Derek what about captions? All of my photo captions need to be in this format:

    Project name
    Project location
    Photo description

    And right now I'm using <br>'s again to separate them as you can see on this sample page:

    http://parallaxwebdesign.com/projects/waterline/plogger/index.php?level=picture&id=1

    Is there a better way to do this?

    Thanks much.
    • CommentAuthorddejong
    • CommentTimeNov 7th 2005 edited
     
    No problem, Debbie. Keep in mind I've modified my installation a lot, so the line numbers will be a bit off.

    gallery.php, line ~395:
    Below this expression:
    if (strlen($filename) > $config["truncate"] && $config["truncate"] != 0)
    $filename = substr($filename, 0, $config["truncate"])."...";

    Insert/replace:
    $output .= '<span class="thumb-title">';
    if (!$row['caption']) {
    $output .= $filename;
    } else {
    $output .= stripslashes(str_replace(" ", "<br />",trim($title)); // from inside out: trim ending whitespace from "title", replace " " with "<br />", take out any escaped characters we needed to put the title into mySQL
    }
    $output .= '</span>';

    gallery.php, line ~715:
    Below here:

    $row = mysql_fetch_assoc($result);

    Insert/replace:
    if (!$row['caption']) {
    $picture_name = basename($row["path"]);
    } else {
    $picture_name = stripslashes($row['caption']);
    }

    Looks like you shouldn't have to do anything to allow the "&nbsp;" for spaces you don't want to split in the album view. (If it ran htmlspecialchars(), it would replace the & with &amp; and cause problems. If it does, we'll find it.)

    Good luck, lemme know how it goes,

    Derek
    • CommentAuthorkanjigirl
    • CommentTimeNov 7th 2005
     
    Okay - I entered the code you provided and get an error on this line (my 458):

    $output .= stripslashes(str_replace(" ", "<br />",trim($title));

    It says 'Parse error: parse error, unexpected ';' in /usr/home/dac/www/htdocs/projects/waterline/plogger/gallery.php on line 458'

    I only see one ; so I tried removing it. That gave me another error:

    Parse error: parse error, unexpected '}' on line 459. I don't think that's right so set the ; back into 458.

    Not sure what I should do to fix this now... I commented out the first section of text but now of course I have a really long album name again. Can you shed any light on this error?

    Thanks,

    Debbie
    • CommentAuthorddejong
    • CommentTimeNov 7th 2005
     
    Should have three ending brackets ")". It's only got two, so it thought the ";" was in stripslashes(), and threw an error. The line SHOULD be:

    $output .= stripslashes(str_replace(" ", "<br />",trim($title)));

    Now the brackets balance (three open, three closed).

    Regards,
    Derek
    • CommentAuthorkanjigirl
    • CommentTimeNov 7th 2005
     
    I changed it and reuploaded - no errors now but no results either. Is this how I should format this name if I want it to appear on the albums page as:

    Keirland Commons
    Town Center

    Keirland&nbsp;Commons Town&nbsp;Center

    That's how I have it, but the name under Albums is not splitting to two lines.

    Here's the complete block of code I have in gallery.php:

    //original text
    //$output .= $filename.'<br />';

    // from inside out: trim ending whitespace from "title", replace " " with "<br />"
    // take out any escaped characters we needed to put the title into mySQL
    $output .= '<span class="thumb-title">';
    if (!$row['caption']) {
    $output.= $filename;
    } else {
    $output.= stripslashes(str_replace(" ", "<br />",trim($title)));
    }
    $output.= '</span>';

    Sorry I'm not getting this.... Any other suggestions? I appreciate your helpfulness.

    Debbie
    • CommentAuthorddejong
    • CommentTimeNov 7th 2005
     
    Is it printing out the title at all? Looks like I screwed up. I initially passed the value of caption to $title in my code because I did something else with it. However, you should instead use this:

    $output.= stripslashes(str_replace(" ", "<br />",trim($row['caption'])));

    Sorry, I know this is a pain. But I tested it, and it's working for me. If it's still not working, change "<br />" to "<br>", though I don't imagine that should be a problem (it's XHTML rather than HTML, but should be backwards-compatible).

    HTH,
    Derek
    • CommentAuthorkanjigirl
    • CommentTimeNov 8th 2005
     
    It is (and was) showing the album titles. I made the change above and it's still unfortunately not splitting them:

    Keirland&nbsp;Commons Town&nbsp;Center

    Is still showing up as one long line:

    http://parallaxwebdesign.com/projects/waterline/plogger/index.php?level=collection&id=1

    It's also not picking up the span class "thumb-title", it's just showing as a regular font and I have "thumb-title" set to a blue font now.

    I put the code you gave me further down in gallery.php so it affected the images, and it worked perfectly - split every image name where I had a space and showed them in the blue "thumb-title" font. So I don't get why it's not working on the albums. Sorry to be so much trouble.

    Is there any other way to do this? Or would it help if I could send you my gallery.php file?

    Debbie
    • CommentAuthorkanjigirl
    • CommentTimeNov 10th 2005
     
    Does anyone else have any suggestions? Please comment if you do.
    • CommentAuthorddejong
    • CommentTimeNov 10th 2005
     
    Deb,

    Contact me off-list (click on my username to see my email) and I'll see if I can't help you further; I've been trying to figure out the best way to go about it, and it may just be getting temporary FTP access or doing this over IM.

    Regards,
    Derek