Formatting plain text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • panther45
    New Member
    • Apr 2010
    • 6

    Formatting plain text

    I want to format 5,000 lines of plain text with the easiest way possible (due to tennis elbow injury). I have no php or programming experience. Below is what I have been told it should look like. With places to add peoples names later.

    Code:
    echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX<br />";
    echo "XXXXXXXXX XXXXXXXX<br />";
    echo "<br />";
    echo "XXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX XX<br />";
    echo "XXXXXX XXXXX XXXX XXXXXXXXX XXXXX<br />";
    echo "Mr. $lastname1 XXXXXXXXXXX XXX $firstname2 XXXXX<br />";
    echo "XXXXXXXXXXXX $firstname2 $lastname2 XXXXXXXXXXXX<br />";
    and

    Code:
    fwrite($fh,"$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX\n");
    fwrite($fh,"XXXXXXXXX XXXXXXXX\n");
    fwrite($fh,"\n");
    I hope that is enough information. (The uneditied versions match).

    Is there a program that I should be using to do this formatting?

    Cheers
    Chris
    Last edited by Dormilich; Apr 13 '10, 08:20 PM. Reason: Please use [code] tags when posting code
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Don't understand what you mean by format but you don't need a new function call (echo and fwrite) for every new line.
    it can be done in one call only
    Code:
    echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX<br />XXXXXXXXX XXXXXXXX<br />......."
    Where is this text coming from?

    Comment

    • panther45
      New Member
      • Apr 2010
      • 6

      #3
      I have the text.

      I have to put stories on a website.

      Comment

      • panther45
        New Member
        • Apr 2010
        • 6

        #4
        That's exactly what I am looking for. I didn't know that.
        "you don't need a new function call (echo and fwrite) for every new line.
        it can be done in one call only"
        How do I do it?

        Comment

        • panther45
          New Member
          • Apr 2010
          • 6

          #5
          Also the inverted commas and <br />

          Comment

          • panther45
            New Member
            • Apr 2010
            • 6

            #6
            I assume the call is added with the text already in place?

            Comment

            • code green
              Recognized Expert Top Contributor
              • Mar 2007
              • 1726

              #7
              How do I do it
              I did post an example. Just place the <br> anywhere you like in the text I'll do it again
              Code:
              echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX
              <br>XXXXXXXXX XXXXXXXX<br>
              <br>XXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXX XX<br>";
              The same idea for fwrite,

              Comment

              • panther45
                New Member
                • Apr 2010
                • 6

                #8
                Hello. How are you today? Code Green.
                This is a simple message for formatting a php page.
                Cheers
                Chris

                Comment

                Working...