untidy source code

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
justin2008
Forum Newbie
Posts: 1
Joined: Tue Jun 03, 2008 4:51 am

untidy source code

Post by justin2008 »

Please have a look of following codes

1.

Code: Select all

 
<div>
   <div>
      <!-- Main contents here -->
      <div>
         <div>
             <h1>Justin here !</h1>
             <p>This is sample paragraph statement </p>
         </div>
      </div>
      <!-- Main contents ends here -->
    </div>
</div>
 
When we take the source code after run this code in the browser, it shows neatly same as above ( correctly intended)

2.

If we create a new php file for the "Main content are of above code and it call inside other php script such as

Code: Select all

 
<div>
   <div>
      <!-- Main contents here -->
      <?php include("main_content.php"); ?>
      <!-- Main contents ends here -->
    </div>
</div>
 
When we take the source code after run this code in the browser, it shows untidy( tags are not properly intended) as below

Code: Select all

 
<div>
   <div>     
      <!-- Main contents here -->
<div>
 <div>
     <h1>Justin here !</h1>
     <p>This is sample paragraph statement </p>
 </div>
</div>
<!-- Main contents ends here -->
 
  
    </div>
</div>
 
What is the reason of this alignment issue? Anyone can help?
Last edited by justin2008 on Tue Jun 03, 2008 7:04 am, edited 1 time in total.
User avatar
vargadanis
Forum Contributor
Posts: 158
Joined: Sun Jun 01, 2008 3:48 am
Contact:

Re: untidy source code

Post by vargadanis »

Just a remark: we won't be able to help you with the intends unless you put your code into [ code ] tags (PHPBB code).
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: untidy source code

Post by Weirdan »

What is the reason of this alignment issue? Anyone can help?
There's no issue, actually =). main_content.php doesn't have that levels of indenting inside it, that's all. php won't indent something it includes since it doesn't care about indenting at all. Especially about indent levels of something outside of php tags (like your html).
Post Reply