Entrar | Registrar | FAQ
Anonymous

Question about using PHP in HTML

+ Postar uma resposta

1 Mensagem Página 1 de 1


Question about using PHP in HTML

por smallwalrus » Seg Jul 09, 2018 5:08 am

So, I just finished up a website development course and I have a question that didn't really dawn on my until recently.

Why would I use PHP to print lines for my NAV instead of just typing them in html?

example from my class:

Código: Selecionar tudo
<nav>
    <ol>
        <?php
        // Home(index) page
        print '<li class="';
        if ($path_parts['filename'] == "home") {
            print ' active Page ';
        }
        print '">';
        print '<a href="index.php">Home</a>';
        print '</li>';

        print '<li class="';
        if ($path_parts['filename'] == "beachRules") {
            print ' active Page ';
        }
        print '">';
        print '<a href="beachRules.php">Beach Rules</a>';
        print '</li>';

        // Beach Clean Up page
        print '<li class="';
        if ($path_parts['filename'] == "beachCleanUp") {
            print ' active Page ';
        }
        print '">';
        print '<a href="beachCleanUp.php">Beach Clean Up</a>';
        print '</li>';

        // Surf Report page
        print '<li class="';
        if ($path_parts['filename'] == "surfReport") {
            print ' active Page ';
        }
        print '">';
        print '<a href="surfReport.php">Surf Report</a>';
        print '</li>';
       
        // QEBA Council page
        print '<li class="';
        if ($path_parts['filename'] == "qebaCouncil") {
            print ' active Page ';
        }
        print '">';
        print '<a href="qebaCouncil.php">QEBA Council</a>';
        print '</li>';

        // About page
        print '<li class="';
        if ($path_parts['filename'] == "about") {
            print ' active Page ';
        }
        print '">';
        print '<a href="about.php">About</a>';
        print '</li>';
        ?>       
    </ol>
</nav>
Avatar de usuário

smallwalrus

  • Mensagens: 1
  • Data de registro: Seg Jul 09, 2018 4:58 am


+ Postar uma resposta

Página 1 de 1