PHP Classes

File: class/Files/CreateCodeIndents.php

Recommend this page to a friend!
  Classes of Goffy G   XOOPS Modules Builder   class/Files/CreateCodeIndents.php   Download  
File: class/Files/CreateCodeIndents.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: XOOPS Modules Builder
Generate new modules for the XOOPS CMS
Author: By
Last change:
Date: 3 years ago
Size: 1,053 bytes
 

Contents

Class file image Download
<?php

namespace XoopsModules\Modulebuilder\Files;

/* The 'nl' function */
/**
 * @param int $tabs
 *
 * @return string
 */
function nl($tabs = 0)
{
   
$r = "\n";
    for (
$i = 0; $i < $tabs; ++$i) {
       
$r .= ' ';
    }

    return
$r;
}

/* Usage example */
$show_table = true;

echo
'<!doctype html>';
echo
nl() . '<html>' . nl(1) . '<head>' . nl(2) . '<title>This is a title</title>' . nl(1) . '</head>' . nl(1) . '<body>' . nl(2) . '<div id="some_container">';
if (
$show_table) {
    echo
nl(3) . '<table>' . nl(4) . '<tr>' . nl(5) . '<td>This is a cell in a table</td>' . nl(4) . '</tr>' . nl(3) . '</table>';
}
echo
nl(2) . '</div><!--some_container-->' . nl(2) . '<p>This is some text in a paragraph</p>' . nl(1) . '</body>' . nl() . '</html>';
?>
<!doctype html>
<html>
<head>
    <title>This is a title</title>
</head>
<body>
<div id="some_container">
    <table>
        <tr>
            <td>This is a cell in a table</td>
        </tr>
    </table>
</div><!--some_container-->
<p>This is some text in a paragraph</p>
</body>
</html>