Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-16-2009, 06:54 PM   PM User | #1
Scriptet
Regular Coder

 
Join Date: Apr 2008
Posts: 685
Thanks: 15
Thanked 105 Times in 104 Posts
Scriptet is on a distinguished road
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.
Scriptet is offline   Reply With Quote
Old 09-16-2009, 06:56 PM   PM User | #2
ckeyrouz
Senior Coder

 
ckeyrouz's Avatar
 
Join Date: Jun 2009
Location: Montreal, Canada
Posts: 1,044
Thanks: 5
Thanked 179 Times in 179 Posts
ckeyrouz is on a distinguished road
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.
ckeyrouz is offline   Reply With Quote
Old 09-16-2009, 07:07 PM   PM User | #3
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
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.
angst is offline   Reply With Quote
Old 09-17-2009, 07:48 AM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
..and keep in mind that you need to use double quotes for wrapping those special characters.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:37 PM.


Advertisement
Log in to turn off these ads.