I'm making a website for my clan. I'd like to have a dynamic table of contents on the left.
E.G. If you click on the link "games" it should stop and print the other list. A list in a list.
I know, that sounds pretty strange, I think it'd be the best if I'll show you my code.
Here it is:
<div class="links">
<?php
$zeilen = file ('../inhaltsverzeichnis.txt');
foreach ($zeilen as $zeile)
{
if($zeile == 3)
{
$games = file ('games_inhaltsverzeichnis.txt');
foreach ($games as $game)
{
echo $game;
}
}
else
{
echo $zeile;
}
}
?>
I hope you know what I mean.
The break statement allows you to escape from the "nearest enclosing loop". If you add an argument (e.g. break 2;
), you escape "the nearest two loops". Not absolutely sure how your code relates to the description of the problem (the title of the question), or where you would want the break
statement - but that's what you need.