albums text layout wrong after upgrade

Hello,

I recently upgraded to the latest version of Zenphoto (1.4.3.3).
Now the text on the albums lost all the line breaks (the carriage return).
It seems the html "BR" tag is missing.
In the database, the "desc" field of the "albums" table contains only newline characters, no BR. Before the upgrade Zenphoto displayed the text nicely, what should I do to have it work as before?

Thanks for your help :)

Comments

  • the `printField()` function, the underlying code for all these print functions, has a parameter to control converting line breaks into `
    ` HTML. It defaults to false, though. Making those conversions was messing up descriptions entered by the WYSIWYG editors.

    Your best fix is to change the newline characters into `
    ` tags in the database as ofcourse, browsers carefully ignore newline characters.

    Or you could directly call the printField() function to print your descriptions and pass true as the `$convertBR` parameter.
  • Hello,

    Thank you for your answer, I'll do a small PHP script to update the database, using the nl2br() function.

    I'll do it this week-end and post it here in case it can help someone with the same problem.
    Except if it is already available somewhere?
  • acrylian Administrator, Developer
    To my knowledge this has never been reported before.
  • Hello,

    Here is a script:
    <?php
    echo "<p>start";

    $link = mysql_connect ("server", "id", "password");
    mysql_select_db("dbname");

    $requete = "SELECT id, zp__albums.desc FROM zp__albums";
    $resultat = mysql_query($requete);

    while ($donnees = mysql_fetch_array($resultat)) {
    $id = $donnees["id"];
    $desc_nl = $donnees["desc"];
    echo "
    ".$donnees["id"];
    $desc_br = nl2br($desc_nl);
    $requete2 = "UPDATE zp__albums SET zp__albums.desc=\"".mysql_real_escape_string($desc_br)."\" WHERE id=$id";
    if (!$resultat2 = mysql_query($requete2)) echo "KO KO KO";
    else echo "OK\n";
    echo "
    \n";
    }

    echo "<p>end";

    ?>
  • Inserting php code here is not a good result.
    Here is the code in more readable format:
    http://snipt.org/vfHi2
Sign In or Register to comment.