How to properly insert an html template into a PHP site?

I made a site design in html, now I don’t know how it would be more correct to put it on a site written in php. I tried to divide into blocks and insert include. And also in html to insert php codes. I don’t know how it would be better. What can you recommend?

Answer 1, authority 100%

In most cases, you will have a file(s).phpwhere the HTML and PHP content resides.

If the site uses a CMS (content management system), then they usually have templates that are responsible for displaying pages (HTML+PHP).

And here is an example of insertion:

<? echo "Hello, this is PHP" ?>     HTML <? echo "    PHP" ?>
<? echo "<a href=\"\"></a> -     PHP,    HTML" ?>

Not a very correct question at all.

Answer 2, authority 100%

  1. html text <? print $text;?>html text
  2. html text <? print"html text";?>html text
  3. html text <?=$text?>html text
  4. <? print "html text".$text;?>html text
  5. <? print "html text".$text."html text";?>

There are many more ways.
Instead of print, you can use echo
html text – plain text

Answer 3, authority 33%

  • PHP: <?php $var='';?>
  • HTML: <H2> <?php echo $var;?> </H2>

Answer 4

Use any MVC framework. For example Smarty. The code will be “readable”, and most importantly, editing the template will be as easy as shelling pears.

In any case, show the code so that we can give more specific advice.

Answer 5

Never mix logic with templates and statics… Use template engines (smarty) or you can hack from DLE…