Open JeroenHeemskerk opened 1 year ago
In de code hieronder zie je veel herhaling van de <li><a> tags https://github.com/LauraBokkers/educom-webshop-basis/blob/8a93866d8b26b52cf06527360f0ed95c67331834/index.php#L94-L107 Dit is niet D.R.Y. Don't Repeat Yourself
<li><a>
Beter is het om een functie te maken die twee variabelen neemt, bijv. showMenuItem($linkName, $buttonText);
showMenuItem($linkName, $buttonText);
zodat je kan doen:
function showMenu() { echo '<nav> <ul class="menu">'; showMenuItem('home', 'HOME'); showMenuItem('about', 'ABOUT'); /* ... */ echo ' </ul> </nav>'; }
In de code hieronder zie je veel herhaling van de
<li><a>
tags https://github.com/LauraBokkers/educom-webshop-basis/blob/8a93866d8b26b52cf06527360f0ed95c67331834/index.php#L94-L107 Dit is niet D.R.Y. Don't Repeat YourselfBeter is het om een functie te maken die twee variabelen neemt, bijv.
showMenuItem($linkName, $buttonText);
zodat je kan doen: