Jump to content

[SOLVED] Displaying content - \n echoing blank information...


Recommended Posts

Alright, simple query.

 

http://www.tenthousandbillboards.com/inf-bin/med/index.php

 

As you can see under the Spain heading, there's a blank entry. The script has been programmed so that there is little to no chance of a line break slipping through so the page will display normally. That one managed to slip in though, so as a precaution I'd like to know the following.

 

          foreach ($infoSort as $infoDraft){
              $infoLines   = explode("#~#", $infoDraft);
              $title       = $infoLines[0];
              $link        = $infoLines[1];
              $location    = "desc/".$infoLines[2].".dat";

              if(file_exists($location)) {
                  $description = file_get_contents($location);
              }

                  if ($infoDraft != "\n") {
                      echo "      <FONT FACE=\"trebuchet ms\" COLOR=\"#FFFFFF\" SIZE=\"2\">";
                      echo "      <BR><FONT FACE=\"trebuchet ms\" COLOR=\"#F3B809\" SIZE=\"2\"><B>$title</B></FONT> - ";
                      echo "      <A HREF=\"".$link."\">$link</A>\n";
                      if ($_COOKIE["u"] == $configUser && $_COOKIE["p"] == $configPass) {
                          echo "<BR><A HREF=\"index.php?option=editEntry&filename=".$infoLines[3]."\">Edit Entry</A>";
                          echo " - <A HREF=\"index.php?option=deleteEntry&filename=".$infoLines[3]."\">Delete Entry</A>";
                      }
                      echo "      </FONT>";

                  }
          }

 

How could I edit the above piece of code to not display blank lines from a data file? You can see my feeble attempt at attempting to not print lines from the $infoDraft variable. It doesn't work.

I got it.

 

I trimmed and checked the $title variable as it was the first instant of the split array.

 

I seem to have a habit of spending hours on a problem, posting here and correcting it not too long after.

 

Cheers.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.