HTML Tidy Do not add end tags

I have three files.

header.php index.php footer.php 

The header file contains <html> to <div id='content'> The index file contains the contents of the page. The footer file contains </div> to </html> Together they contain a regular HTML file with PHP

When I use Tidy HTML to organize the HTML file of php files, it does something wrong. When I remove header.php, it adds closing tags in my div content, and it should not. The div continues through index.php and closes in footer.php to indicate the contents of the file.

Is it possible to make HTML Tidy ignore missing end tags?

+4
source share
2 answers

This can be solved as follows:

 <html> <head> <?php include "head.php" ?> </head> <body> <?php include "header.php" ?> <?php include "index.php" ?> <?php include "footer.php" ?> </body> </html> 

And the index.php, head.php, header.php, and footer.php files should now have start and end tags. The program does this because it thinks you missed the private tags. I saw Tidy HTML and automatically puts close tags.


Source: my experience makes sites this way

+1
source

It looks like you need hide-endtags: yes in config :

 Type: Boolean Default: no Example: y/n, yes/no, t/f, true/false, 1/0 

This option indicates whether Tidy should omit additional end tags when creating fairly printed markup. This parameter is ignored if you output in XML.

According to the specification associated here , the initial html and body tags are also optional, and my Tidy also removes them, which should not be a problem, the cfg file:

 hide-endtags: yes // Don't add optional end tags. Also hides optional start tags like HTML and BODY. tidy-mark: no // Don't add generator meta tag. 

However, it still closes the div . This alternative offered here works as intended.

0
source

All Articles