...">

What is the best way to save my php files with php code only?

I have a file with php and html codes, for example:

echo "<tr class='somthing'>";

What is the best way to save my php files with php code only?

+5
source share
6 answers

There are several statements about this, so Iโ€™ll just say that whatever you choose, stick to it.

As a rule, you can use a template system (for example, Smarty) so that your files are formally cleared of PHP code, but this has some drawbacks in the speed department.

Alternatively, you can use minimal code, tearing out display-related fragments and using small PHP fragments in it, for example

<?php foreach ($myArray as $myElement): ?>
<tr>
    <td><?php echo $myElement; ?></td>
</tr>
<?php endforeach; ?>

, HTML, - ; , Smarty - , . , codeigniter Zend Framework (, Smarty, ).

, - . , 100% ( , /) , .

+4

, Smarty. , .

. , - . , . , , , .

+2

"" "". - Model, View, Controller (MVC)

PHP MVC. Zend Framework Codeignitor.

+2
+1
+1

, โ€‹โ€‹ Smarty, . :

PHP

, HTML PHP

+1

All Articles