HTML within HTML

0

I have a question here.

I have the following code in HTML:

<html>

    <head>

        <?php

    $logado =  'my name';

    ?>

<link rel="stylesheet" type="text/css" href="cabecalho.css"/>

<nav id="menu">
    <ul>
        <yp><?php echo '<p>'.$logado.'</p>'; ?></yp>
        <li><a href="/projetos/index.php">Home</a></li>
        <li><a href="/projetos/historico.php">Histórico</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
    </ul>
</nav> 
  </head>
  <body>
  </body>
</html>

As you can see, I'm calling page features for a Css file

I wanted to know if it's possible to mount a file that contains

<nav> 
<ul>
        <yp><?php echo '<p>'.$logado.'</p>'; ?></yp>
        <li><a href="/projetos/index.php">Home</a></li>
        <li><a href="/projetos/historico.php">Histórico</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
    </ul>
</nav> 

and that I insert inside the page in a similar way with css?

Type:

<html>

    <head>

        <?php

    $logado =  'my name';

    ?>

<link rel="stylesheet" type="text/css" href="cabecalho.css"/>

<link chamar 'nav' aqui dentro/> 
  </head>
  <body>
  </body>
</html>

Thank you!

    
asked by anonymous 21.09.2017 / 19:21

2 answers

3
Header.php

<nav id="menu">
    <ul>
        <yp><?php echo '<p>'.$logado.'</p>'; ?></yp>
        <li><a href="/projetos/index.php">Home</a></li>
        <li><a href="/projetos/historico.php">Histórico</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
        <li><a href="#">Em breve</a></li>
    </ul>
</nav>

Now on the files you want to include use

<?php
   require("Header.php");
?>
    
21.09.2017 / 19:51
1

If I understood correctly, do the following:

Create a .php file containing all your nav and call this file wherever you like using the include or require method of php.

    
21.09.2017 / 19:47