PHP/HTML Indentation

Associate
Joined
26 Jun 2003
Posts
1,140
Location
North West
If you have a function which echos html such as

PHP:
function bob()
{
    echo '<b>woo</b>';
}

When you look at the HTML source of this result, it is indentated with however many tabs before the echo, making the HTML very untidy.

Is there any settings on apache to stop this? I like nice and tidy html.

Thx
 
they are appearing. This function:

Here is a slice:


PHP:
class Framework 
{	
	function printSite()
	{	
		echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html>
		<head>
		<title>'.$this->settings['websitetitle'].'</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<meta name="keywords" content="'.$this->settings['keywords'].'" />
		<meta name="description" content="'.$this->settings['description'].'" />
		<meta name="author" content="Jonathan Dawber" />
		<link rel="stylesheet" type="text/css" href="style/style.css" />
		</head>
		</html>';		
	}	
}

The actual code is tabbed twice on each line, but I want to keep these tabs to keep the php file tidy but it indents all of the code.

I dont wanna write echo on each line or outdent the code.

See waht i mean?
Anyway around?
 
Last edited:
As I said, the code I posted was an example!!!

The body tags are missing because its a "slice", read again :p

I just wanted to know if there was anyway to get rid of the tabs automatically or someway, looks like there isnt. Thx anyway
 
Back
Top Bottom