Pure PHP/HTML Header menu

 Clash Royale CLAN TAG#URR8PPP
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
So, normally when I am trying to learn PHP and create some random sites I'm lazy and OR use a templating language for that or just paste the full menu in HTML and include it in every page.
This time around I tried something new for me. I'm still including the header menu on every page but I didn't use full HTML.
This is my code:
<header>
<div class="navbar">
 <?php
 $nCurrentpage = $_SESSION['laatstGebruiktePagina'];
 $aMenu = array(
 'indexcontent' => array('text' => 'Home', 'url' => '?page=indexcontent', 'class' => 'leftalign', 'subpages' => false),
 'Interface' => array(
 'text' => 'Interface',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorld' => array('text' => 'Opdracht 1 Hello World', 'url' => '?page=Opdracht1HelloWorld'),
 'Opdracht2HelloWorldCSS' => array('text' => 'Opdracht 2 Hello World CSS', 'url' => '?page=Opdracht2HelloWorldCSS'),
 'Opdracht3Menu' => array('text' => 'Opdracht 3 Menu', 'url' => '?page=Opdracht3Menu'),
 'Opdracht4Form' => array('text' => 'Opdracht 4 Form', 'url' => '?page=Opdracht4Form')
 ),
 ),
 'Communiceren' => array(
 'text' => 'Communiceren',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorldPHP' => array('text' => 'Opdracht 1 Hello World PHP', 'url' => '?page=Opdracht1HelloWorldPHP'),
 'Opdracht2InvoerOpvragenPHP' => array('text' => 'Opdracht 2 Invoer Opvragen PHP', 'url' => '?page=Opdracht2InvoerOpvragenPHP'),
 'Opdracht3Interactief' => array('text' => 'Opdracht 3 Interactief', 'url' => '?page=Opdracht3Interactief'),
 'Opdracht4Schermindeling' => array('text' => 'Opdracht 4 Schermindeling', 'url' => '?page=Opdracht4Schermindeling')
 ),
 ),
 'Kennismaking met PHP' => array(
 'text' => 'Kennismaking met PHP',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1Variabelen' => array('text' => 'Opdracht 1 Variabelen', 'url' => '?page=Opdracht1Variabelen'),
 'Opdracht2IfPuzzels' => array('text' => 'Opdracht 2 If Puzzels', 'url' => '?page=Opdracht2IfPuzzels'),
 'Opdracht3Tafels' => array('text' => 'Opdracht 3 Tafels', 'url' => '?page=Opdracht3Tafels'),
 'Opdracht4Vergevingsgezind' => array('text' => 'Opdracht 4 Vergevingsgezind', 'url' => '?page=Opdracht4Vergevingsgezind'),
 'Opdracht5Puzzels' => array('text' => 'Opdracht 5 Puzzels', 'url' => '?page=Opdracht5Puzzels'),
 'Opdracht6StringFunc' => array('text' => 'Opdracht 6 String Func', 'url' => '?page=Opdracht6StringFunc'),
 'Opdracht7WoordOmdraaien' => array('text' => 'Opdracht 7 Woord Omdraaien', 'url' => '?page=Opdracht7WoordOmdraaien'),
 'Opdracht8NummeriekeFuncties' => array('text' => 'Opdracht 8 Nummerieke Functies', 'url' => '?page=Opdracht8NummeriekeFuncties'),
 'Opdracht9RekenOpdrachten' => array('text' => 'Opdracht 9 Reken Opdrachten', 'url' => '?page=Opdracht9RekenOpdrachten'),
 'Opdracht10Rekenmachine' => array('text' => 'Opdracht 10 Rekenmachine', 'url' => '?page=Opdracht10Rekenmachine'),
 'Opdracht11DatumFuncties' => array('text' => 'Opdracht 11 Datum Functies', 'url' => '?page=Opdracht11DatumFuncties'),
 'Opdracht12LogischeOpdrachten' => array('text' => 'Opdracht 12 Logische Opdrachten', 'url' => '?page=Opdracht12LogischeOpdrachten'),
 'Opdracht13Cijferlijst' => array('text' => 'Opdracht 13 Cijferlijst', 'url' => '?page=Opdracht13Cijferlijst')
 ),
 ),
 'login' => array('text' => 'login', 'url' => '?page=login', 'class' => 'rightalign', 'subpages' => false)
 );
 $aNamenMain = ;
 $nCounterMain = 0;
 $aNamenMain = array_merge($aNamenMain, array_keys($aMenu));
 foreach ($aMenu as $hoofditem)
 //Als het alleen een knopje is zonder sub menu.
 if ($hoofditem['subpages'] == false)
 echo "<a href='" . $hoofditem['url'] . ".php' class='" . (($nCurrentpage == $aNamenMain[$nCounterMain] . ".php")?"active":"") . " " . $hoofditem['class'] . "'>" . $hoofditem['text'] . "</a>";
 
 //Anders heeft het een submenu.
 else 
 $aNamenSub = ;
 $nCounterSub = 0;
 $aNamenSub = array_merge($aNamenSub, array_keys($hoofditem['subpages']));
 //echo $aNamenSub[4];
 echo "<div class='";
 foreach ($hoofditem['subpages'] as $subitem)
 echo (($nCurrentpage == $aNamenSub[$nCounterSub] . '.php')?"active":"");
 $nCounterSub++;
 
 $nCounterSub = 0;
 echo " " . $hoofditem['class'] . "'>";
 echo "<button class='dropbtn'>" . $aNamenMain[$nCounterMain] . "</button>";
 echo "<div class='dropdown-content'>";
 foreach ($hoofditem['subpages'] as $subitem) 
 echo "<a href='" . $subitem['url'] . ".php' class='" . (($nCurrentpage == $aNamenSub[$nCounterSub] . ".php") ? "active" : "") . "'>" . $subitem['text'] . "</a>";
 
 echo "</div>";
 echo "</div>";
 
 $nCounterMain++;
 
 ?>
</div>
</header>
Question 1: In Pure PHP HTML is this an acceptable solution?
Question 2: Is it possible to convert the Multidimensional array to an SQL database structure.
php array html
add a comment |Â
up vote
0
down vote
favorite
So, normally when I am trying to learn PHP and create some random sites I'm lazy and OR use a templating language for that or just paste the full menu in HTML and include it in every page.
This time around I tried something new for me. I'm still including the header menu on every page but I didn't use full HTML.
This is my code:
<header>
<div class="navbar">
 <?php
 $nCurrentpage = $_SESSION['laatstGebruiktePagina'];
 $aMenu = array(
 'indexcontent' => array('text' => 'Home', 'url' => '?page=indexcontent', 'class' => 'leftalign', 'subpages' => false),
 'Interface' => array(
 'text' => 'Interface',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorld' => array('text' => 'Opdracht 1 Hello World', 'url' => '?page=Opdracht1HelloWorld'),
 'Opdracht2HelloWorldCSS' => array('text' => 'Opdracht 2 Hello World CSS', 'url' => '?page=Opdracht2HelloWorldCSS'),
 'Opdracht3Menu' => array('text' => 'Opdracht 3 Menu', 'url' => '?page=Opdracht3Menu'),
 'Opdracht4Form' => array('text' => 'Opdracht 4 Form', 'url' => '?page=Opdracht4Form')
 ),
 ),
 'Communiceren' => array(
 'text' => 'Communiceren',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorldPHP' => array('text' => 'Opdracht 1 Hello World PHP', 'url' => '?page=Opdracht1HelloWorldPHP'),
 'Opdracht2InvoerOpvragenPHP' => array('text' => 'Opdracht 2 Invoer Opvragen PHP', 'url' => '?page=Opdracht2InvoerOpvragenPHP'),
 'Opdracht3Interactief' => array('text' => 'Opdracht 3 Interactief', 'url' => '?page=Opdracht3Interactief'),
 'Opdracht4Schermindeling' => array('text' => 'Opdracht 4 Schermindeling', 'url' => '?page=Opdracht4Schermindeling')
 ),
 ),
 'Kennismaking met PHP' => array(
 'text' => 'Kennismaking met PHP',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1Variabelen' => array('text' => 'Opdracht 1 Variabelen', 'url' => '?page=Opdracht1Variabelen'),
 'Opdracht2IfPuzzels' => array('text' => 'Opdracht 2 If Puzzels', 'url' => '?page=Opdracht2IfPuzzels'),
 'Opdracht3Tafels' => array('text' => 'Opdracht 3 Tafels', 'url' => '?page=Opdracht3Tafels'),
 'Opdracht4Vergevingsgezind' => array('text' => 'Opdracht 4 Vergevingsgezind', 'url' => '?page=Opdracht4Vergevingsgezind'),
 'Opdracht5Puzzels' => array('text' => 'Opdracht 5 Puzzels', 'url' => '?page=Opdracht5Puzzels'),
 'Opdracht6StringFunc' => array('text' => 'Opdracht 6 String Func', 'url' => '?page=Opdracht6StringFunc'),
 'Opdracht7WoordOmdraaien' => array('text' => 'Opdracht 7 Woord Omdraaien', 'url' => '?page=Opdracht7WoordOmdraaien'),
 'Opdracht8NummeriekeFuncties' => array('text' => 'Opdracht 8 Nummerieke Functies', 'url' => '?page=Opdracht8NummeriekeFuncties'),
 'Opdracht9RekenOpdrachten' => array('text' => 'Opdracht 9 Reken Opdrachten', 'url' => '?page=Opdracht9RekenOpdrachten'),
 'Opdracht10Rekenmachine' => array('text' => 'Opdracht 10 Rekenmachine', 'url' => '?page=Opdracht10Rekenmachine'),
 'Opdracht11DatumFuncties' => array('text' => 'Opdracht 11 Datum Functies', 'url' => '?page=Opdracht11DatumFuncties'),
 'Opdracht12LogischeOpdrachten' => array('text' => 'Opdracht 12 Logische Opdrachten', 'url' => '?page=Opdracht12LogischeOpdrachten'),
 'Opdracht13Cijferlijst' => array('text' => 'Opdracht 13 Cijferlijst', 'url' => '?page=Opdracht13Cijferlijst')
 ),
 ),
 'login' => array('text' => 'login', 'url' => '?page=login', 'class' => 'rightalign', 'subpages' => false)
 );
 $aNamenMain = ;
 $nCounterMain = 0;
 $aNamenMain = array_merge($aNamenMain, array_keys($aMenu));
 foreach ($aMenu as $hoofditem)
 //Als het alleen een knopje is zonder sub menu.
 if ($hoofditem['subpages'] == false)
 echo "<a href='" . $hoofditem['url'] . ".php' class='" . (($nCurrentpage == $aNamenMain[$nCounterMain] . ".php")?"active":"") . " " . $hoofditem['class'] . "'>" . $hoofditem['text'] . "</a>";
 
 //Anders heeft het een submenu.
 else 
 $aNamenSub = ;
 $nCounterSub = 0;
 $aNamenSub = array_merge($aNamenSub, array_keys($hoofditem['subpages']));
 //echo $aNamenSub[4];
 echo "<div class='";
 foreach ($hoofditem['subpages'] as $subitem)
 echo (($nCurrentpage == $aNamenSub[$nCounterSub] . '.php')?"active":"");
 $nCounterSub++;
 
 $nCounterSub = 0;
 echo " " . $hoofditem['class'] . "'>";
 echo "<button class='dropbtn'>" . $aNamenMain[$nCounterMain] . "</button>";
 echo "<div class='dropdown-content'>";
 foreach ($hoofditem['subpages'] as $subitem) 
 echo "<a href='" . $subitem['url'] . ".php' class='" . (($nCurrentpage == $aNamenSub[$nCounterSub] . ".php") ? "active" : "") . "'>" . $subitem['text'] . "</a>";
 
 echo "</div>";
 echo "</div>";
 
 $nCounterMain++;
 
 ?>
</div>
</header>
Question 1: In Pure PHP HTML is this an acceptable solution?
Question 2: Is it possible to convert the Multidimensional array to an SQL database structure.
php array html
 
 
 
 
 
 
 Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
 â Your Common Sense
 Feb 9 at 8:55
 
 
 
 
 
 
 
 
 
 @YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
 â H. Brendan
 Feb 9 at 9:09
 
 
 
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So, normally when I am trying to learn PHP and create some random sites I'm lazy and OR use a templating language for that or just paste the full menu in HTML and include it in every page.
This time around I tried something new for me. I'm still including the header menu on every page but I didn't use full HTML.
This is my code:
<header>
<div class="navbar">
 <?php
 $nCurrentpage = $_SESSION['laatstGebruiktePagina'];
 $aMenu = array(
 'indexcontent' => array('text' => 'Home', 'url' => '?page=indexcontent', 'class' => 'leftalign', 'subpages' => false),
 'Interface' => array(
 'text' => 'Interface',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorld' => array('text' => 'Opdracht 1 Hello World', 'url' => '?page=Opdracht1HelloWorld'),
 'Opdracht2HelloWorldCSS' => array('text' => 'Opdracht 2 Hello World CSS', 'url' => '?page=Opdracht2HelloWorldCSS'),
 'Opdracht3Menu' => array('text' => 'Opdracht 3 Menu', 'url' => '?page=Opdracht3Menu'),
 'Opdracht4Form' => array('text' => 'Opdracht 4 Form', 'url' => '?page=Opdracht4Form')
 ),
 ),
 'Communiceren' => array(
 'text' => 'Communiceren',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorldPHP' => array('text' => 'Opdracht 1 Hello World PHP', 'url' => '?page=Opdracht1HelloWorldPHP'),
 'Opdracht2InvoerOpvragenPHP' => array('text' => 'Opdracht 2 Invoer Opvragen PHP', 'url' => '?page=Opdracht2InvoerOpvragenPHP'),
 'Opdracht3Interactief' => array('text' => 'Opdracht 3 Interactief', 'url' => '?page=Opdracht3Interactief'),
 'Opdracht4Schermindeling' => array('text' => 'Opdracht 4 Schermindeling', 'url' => '?page=Opdracht4Schermindeling')
 ),
 ),
 'Kennismaking met PHP' => array(
 'text' => 'Kennismaking met PHP',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1Variabelen' => array('text' => 'Opdracht 1 Variabelen', 'url' => '?page=Opdracht1Variabelen'),
 'Opdracht2IfPuzzels' => array('text' => 'Opdracht 2 If Puzzels', 'url' => '?page=Opdracht2IfPuzzels'),
 'Opdracht3Tafels' => array('text' => 'Opdracht 3 Tafels', 'url' => '?page=Opdracht3Tafels'),
 'Opdracht4Vergevingsgezind' => array('text' => 'Opdracht 4 Vergevingsgezind', 'url' => '?page=Opdracht4Vergevingsgezind'),
 'Opdracht5Puzzels' => array('text' => 'Opdracht 5 Puzzels', 'url' => '?page=Opdracht5Puzzels'),
 'Opdracht6StringFunc' => array('text' => 'Opdracht 6 String Func', 'url' => '?page=Opdracht6StringFunc'),
 'Opdracht7WoordOmdraaien' => array('text' => 'Opdracht 7 Woord Omdraaien', 'url' => '?page=Opdracht7WoordOmdraaien'),
 'Opdracht8NummeriekeFuncties' => array('text' => 'Opdracht 8 Nummerieke Functies', 'url' => '?page=Opdracht8NummeriekeFuncties'),
 'Opdracht9RekenOpdrachten' => array('text' => 'Opdracht 9 Reken Opdrachten', 'url' => '?page=Opdracht9RekenOpdrachten'),
 'Opdracht10Rekenmachine' => array('text' => 'Opdracht 10 Rekenmachine', 'url' => '?page=Opdracht10Rekenmachine'),
 'Opdracht11DatumFuncties' => array('text' => 'Opdracht 11 Datum Functies', 'url' => '?page=Opdracht11DatumFuncties'),
 'Opdracht12LogischeOpdrachten' => array('text' => 'Opdracht 12 Logische Opdrachten', 'url' => '?page=Opdracht12LogischeOpdrachten'),
 'Opdracht13Cijferlijst' => array('text' => 'Opdracht 13 Cijferlijst', 'url' => '?page=Opdracht13Cijferlijst')
 ),
 ),
 'login' => array('text' => 'login', 'url' => '?page=login', 'class' => 'rightalign', 'subpages' => false)
 );
 $aNamenMain = ;
 $nCounterMain = 0;
 $aNamenMain = array_merge($aNamenMain, array_keys($aMenu));
 foreach ($aMenu as $hoofditem)
 //Als het alleen een knopje is zonder sub menu.
 if ($hoofditem['subpages'] == false)
 echo "<a href='" . $hoofditem['url'] . ".php' class='" . (($nCurrentpage == $aNamenMain[$nCounterMain] . ".php")?"active":"") . " " . $hoofditem['class'] . "'>" . $hoofditem['text'] . "</a>";
 
 //Anders heeft het een submenu.
 else 
 $aNamenSub = ;
 $nCounterSub = 0;
 $aNamenSub = array_merge($aNamenSub, array_keys($hoofditem['subpages']));
 //echo $aNamenSub[4];
 echo "<div class='";
 foreach ($hoofditem['subpages'] as $subitem)
 echo (($nCurrentpage == $aNamenSub[$nCounterSub] . '.php')?"active":"");
 $nCounterSub++;
 
 $nCounterSub = 0;
 echo " " . $hoofditem['class'] . "'>";
 echo "<button class='dropbtn'>" . $aNamenMain[$nCounterMain] . "</button>";
 echo "<div class='dropdown-content'>";
 foreach ($hoofditem['subpages'] as $subitem) 
 echo "<a href='" . $subitem['url'] . ".php' class='" . (($nCurrentpage == $aNamenSub[$nCounterSub] . ".php") ? "active" : "") . "'>" . $subitem['text'] . "</a>";
 
 echo "</div>";
 echo "</div>";
 
 $nCounterMain++;
 
 ?>
</div>
</header>
Question 1: In Pure PHP HTML is this an acceptable solution?
Question 2: Is it possible to convert the Multidimensional array to an SQL database structure.
php array html
So, normally when I am trying to learn PHP and create some random sites I'm lazy and OR use a templating language for that or just paste the full menu in HTML and include it in every page.
This time around I tried something new for me. I'm still including the header menu on every page but I didn't use full HTML.
This is my code:
<header>
<div class="navbar">
 <?php
 $nCurrentpage = $_SESSION['laatstGebruiktePagina'];
 $aMenu = array(
 'indexcontent' => array('text' => 'Home', 'url' => '?page=indexcontent', 'class' => 'leftalign', 'subpages' => false),
 'Interface' => array(
 'text' => 'Interface',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorld' => array('text' => 'Opdracht 1 Hello World', 'url' => '?page=Opdracht1HelloWorld'),
 'Opdracht2HelloWorldCSS' => array('text' => 'Opdracht 2 Hello World CSS', 'url' => '?page=Opdracht2HelloWorldCSS'),
 'Opdracht3Menu' => array('text' => 'Opdracht 3 Menu', 'url' => '?page=Opdracht3Menu'),
 'Opdracht4Form' => array('text' => 'Opdracht 4 Form', 'url' => '?page=Opdracht4Form')
 ),
 ),
 'Communiceren' => array(
 'text' => 'Communiceren',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1HelloWorldPHP' => array('text' => 'Opdracht 1 Hello World PHP', 'url' => '?page=Opdracht1HelloWorldPHP'),
 'Opdracht2InvoerOpvragenPHP' => array('text' => 'Opdracht 2 Invoer Opvragen PHP', 'url' => '?page=Opdracht2InvoerOpvragenPHP'),
 'Opdracht3Interactief' => array('text' => 'Opdracht 3 Interactief', 'url' => '?page=Opdracht3Interactief'),
 'Opdracht4Schermindeling' => array('text' => 'Opdracht 4 Schermindeling', 'url' => '?page=Opdracht4Schermindeling')
 ),
 ),
 'Kennismaking met PHP' => array(
 'text' => 'Kennismaking met PHP',
 'url' => null,
 'class' => 'dropdown',
 'subpages' => array(
 'Opdracht1Variabelen' => array('text' => 'Opdracht 1 Variabelen', 'url' => '?page=Opdracht1Variabelen'),
 'Opdracht2IfPuzzels' => array('text' => 'Opdracht 2 If Puzzels', 'url' => '?page=Opdracht2IfPuzzels'),
 'Opdracht3Tafels' => array('text' => 'Opdracht 3 Tafels', 'url' => '?page=Opdracht3Tafels'),
 'Opdracht4Vergevingsgezind' => array('text' => 'Opdracht 4 Vergevingsgezind', 'url' => '?page=Opdracht4Vergevingsgezind'),
 'Opdracht5Puzzels' => array('text' => 'Opdracht 5 Puzzels', 'url' => '?page=Opdracht5Puzzels'),
 'Opdracht6StringFunc' => array('text' => 'Opdracht 6 String Func', 'url' => '?page=Opdracht6StringFunc'),
 'Opdracht7WoordOmdraaien' => array('text' => 'Opdracht 7 Woord Omdraaien', 'url' => '?page=Opdracht7WoordOmdraaien'),
 'Opdracht8NummeriekeFuncties' => array('text' => 'Opdracht 8 Nummerieke Functies', 'url' => '?page=Opdracht8NummeriekeFuncties'),
 'Opdracht9RekenOpdrachten' => array('text' => 'Opdracht 9 Reken Opdrachten', 'url' => '?page=Opdracht9RekenOpdrachten'),
 'Opdracht10Rekenmachine' => array('text' => 'Opdracht 10 Rekenmachine', 'url' => '?page=Opdracht10Rekenmachine'),
 'Opdracht11DatumFuncties' => array('text' => 'Opdracht 11 Datum Functies', 'url' => '?page=Opdracht11DatumFuncties'),
 'Opdracht12LogischeOpdrachten' => array('text' => 'Opdracht 12 Logische Opdrachten', 'url' => '?page=Opdracht12LogischeOpdrachten'),
 'Opdracht13Cijferlijst' => array('text' => 'Opdracht 13 Cijferlijst', 'url' => '?page=Opdracht13Cijferlijst')
 ),
 ),
 'login' => array('text' => 'login', 'url' => '?page=login', 'class' => 'rightalign', 'subpages' => false)
 );
 $aNamenMain = ;
 $nCounterMain = 0;
 $aNamenMain = array_merge($aNamenMain, array_keys($aMenu));
 foreach ($aMenu as $hoofditem)
 //Als het alleen een knopje is zonder sub menu.
 if ($hoofditem['subpages'] == false)
 echo "<a href='" . $hoofditem['url'] . ".php' class='" . (($nCurrentpage == $aNamenMain[$nCounterMain] . ".php")?"active":"") . " " . $hoofditem['class'] . "'>" . $hoofditem['text'] . "</a>";
 
 //Anders heeft het een submenu.
 else 
 $aNamenSub = ;
 $nCounterSub = 0;
 $aNamenSub = array_merge($aNamenSub, array_keys($hoofditem['subpages']));
 //echo $aNamenSub[4];
 echo "<div class='";
 foreach ($hoofditem['subpages'] as $subitem)
 echo (($nCurrentpage == $aNamenSub[$nCounterSub] . '.php')?"active":"");
 $nCounterSub++;
 
 $nCounterSub = 0;
 echo " " . $hoofditem['class'] . "'>";
 echo "<button class='dropbtn'>" . $aNamenMain[$nCounterMain] . "</button>";
 echo "<div class='dropdown-content'>";
 foreach ($hoofditem['subpages'] as $subitem) 
 echo "<a href='" . $subitem['url'] . ".php' class='" . (($nCurrentpage == $aNamenSub[$nCounterSub] . ".php") ? "active" : "") . "'>" . $subitem['text'] . "</a>";
 
 echo "</div>";
 echo "</div>";
 
 $nCounterMain++;
 
 ?>
</div>
</header>
Question 1: In Pure PHP HTML is this an acceptable solution?
Question 2: Is it possible to convert the Multidimensional array to an SQL database structure.
php array html
edited Feb 9 at 16:47
mdfst13
16.8k42055
16.8k42055
asked Feb 9 at 8:14


H. Brendan
1086
1086
 
 
 
 
 
 
 Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
 â Your Common Sense
 Feb 9 at 8:55
 
 
 
 
 
 
 
 
 
 @YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
 â H. Brendan
 Feb 9 at 9:09
 
 
 
add a comment |Â
 
 
 
 
 
 
 Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
 â Your Common Sense
 Feb 9 at 8:55
 
 
 
 
 
 
 
 
 
 @YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
 â H. Brendan
 Feb 9 at 9:09
 
 
 
Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
â Your Common Sense
Feb 9 at 8:55
Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
â Your Common Sense
Feb 9 at 8:55
@YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
â H. Brendan
Feb 9 at 9:09
@YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
â H. Brendan
Feb 9 at 9:09
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f187165%2fpure-php-html-header-menu%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Although I don't know what "Pure PHP HTML" is meant here, the code above is acceptable. Yes, it is possible to to convert, google for the hierarchical data in sql. I don't think your question is on topic here though. Basically you post here a code and ask if it cold be improved, not ask for some opinionated remarks as whether some code befits some uncertain paradigm
â Your Common Sense
Feb 9 at 8:55
@YourCommonSense hmm yes sorry my explaining of things is kind of bad. but nevertheless you DID help me, my question was if the code was acceptable and i searched for the SQL so thanks for that at least. i thought this question was for this site but if it isnt then tell me and ill take it down becouse my question is answered.
â H. Brendan
Feb 9 at 9:09