Current location: Hot Scripts Forums » Programming Languages » PHP » Php making html source code look terrible!!!


Php making html source code look terrible!!!

Reply
  #1 (permalink)  
Old 08-04-04, 03:36 AM
v1brazy v1brazy is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Newcastle - UK
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Question Php making html source code look terrible!!!

Hya,

I was wondering, is there a way to make the html code gererated by a php script look neat?

I have a page that runs 3 for loops, it works fine, but when i look the source code in the html page it has about 1000 blank lines. Is there a way around that??

Thank you all
Reply With Quote
  #2 (permalink)  
Old 08-04-04, 06:55 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Show the code?
Do you have alot of \n's repeating?
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Reply With Quote
  #3 (permalink)  
Old 08-04-04, 07:20 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
All I'll say is that PHP is your slave and it does exactly what you tell it to do.
Reply With Quote
  #4 (permalink)  
Old 08-04-04, 02:10 PM
infinitylimit's Avatar
infinitylimit infinitylimit is offline
Code Guru
 
Join Date: Jun 2004
Location: Oregon
Posts: 758
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah Keith is right here. It's up to you to put in the proper \n\t in your strings if you don't it will not have the indentions. But then again who cares?
__________________
Hawk Enterprises -- Home to PHP games, open-source code, tutorials and free downloads
Reply With Quote
  #5 (permalink)  
Old 08-05-04, 10:02 PM
AmberLR's Avatar
AmberLR AmberLR is offline
Newbie Coder
 
Join Date: Jul 2004
Location: Atlanta, GA USA
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah, PHP does exactly what you tell it, but I have noticed that some browsers' 'View Source' will put in more whitespace than others.
__________________
~~ Amber ~~
http://amber.tangerinecs.com
http://www.ambersites.com

"Listen here young lady / All that matters is what makes you happy" -- Liz Phair
Reply With Quote
  #6 (permalink)  
Old 08-05-04, 10:22 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
That's odd, it's not the browser that reads the PHP and white space, it's the server that parss it and outputs it to the browser.
Reply With Quote
  #7 (permalink)  
Old 08-06-04, 12:52 AM
darkfreak's Avatar
darkfreak darkfreak is offline
Newbie Coder
 
Join Date: Jun 2004
Location: Kuopio, Finland, Europe
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Also, at least in my older version (can't remember the number) of PHP there's a little catch: if you include (e.g. function declaration) files that have accidental linefeeds after the ending ?> tag, they will show up in the beginning of the outputted html as blank lines. In Fedora Linux, I guess this also screwed up the meaning of the meta-tags that declared my charset and my browser used some default charset that messed up my special characters (I'm scandinavian).

But yet - PHP just did what it was told
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 11:19 AM
PHP code on a remote file tonniar .rm PHP 2 05-24-04 02:32 AM
How to sale php code to customer without giving him code pradeep_soft PHP 4 03-12-04 12:10 PM


All times are GMT -5. The time now is 04:18 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.