L
L
LordPrimes2018-02-21 23:33:46
PHP
LordPrimes, 2018-02-21 23:33:46

Correct writing?

Good afternoon. I figured out how to do one task correctly, but I want the opinion of a couple more people :) I wrote this bullshit echo

echo '<li><div class="images-tovar"><img src="'.$img_path.'"width="'.$width.'"height="'.$height.'"></div>
        <p class = "style-title"><a href="view_content?id='.$row["products_id"].'">'.$row["title"].'</a></p>
        <ul class = "reviews">
        
        <li><img src=""></li>
        <li><img src=""><input type="submit" value="Купить" class="button7"></li>
        <a class ="add-cart"></a>
        <p class="style-price"><strong>'.$row["price"].' </strong>грн. </p>
        <div class = "description">'.$row["features"].'</div>
         </ul>
        </li>
    
     '

', and then I realized that it's better to write these html tags correctly on a separate page and make short inserts from the database like <?=$row["price"]?>.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-22
@Stalker_RED

Yes, you're right, it's better to put templates in separate files. You can also check out popular templating engines such as twig, blade, smarty, and so on. Even if you do not use them, look at least a brief overview of their capabilities and principles of work - get ideas.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question