Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2008
    Posts
    685
    Thanks
    15
    Thanked 105 Times in 104 Posts

    How to Do New Line In Source Code?

    Hi,

    Just a quick question,

    Say i'm just doing a simple loop which in it outputs a bunch of <li></li>

    Now this is fine, but say I go to view the page in my source code all the <li>'s are on the same line, is there a way I can get them to appear on a new line in the Source Code?

    I just need it so I know what's going on when I view my page from the Source Code.

  • #2
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    Make a regular expression replace.
    Replace the following:
    Code:
    </li><li>
    with this:
    Code:
    </li>\n<li>
    Do not forget to use regular expression replace.

    Another thing, it might be that your editor does not contain a regular expression search (notepad for example).
    Software and cathedrals are much the same - first we build them, then we pray.

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    like this for a new line;
    [code]<li></li>\n[code]

    like this for a tab and a new line;
    [code]\t<li></li>\n[code]

    this will help keep your source nicely formatted.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    ..and keep in mind that you need to use double quotes for wrapping those special characters.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •