fork download
  1. <?php
  2. $filename='menu.txt';
  3. if(file_exists($filename)){
  4. $file=file($filename);
  5. $menu_list='<ul id="menu">';
  6. foreach ($file as $value) {
  7. $row=explode('#', $value);
  8. $menu_list.='<li><a href="'.$row[1].'">'.$row[0].'</a></li>';
  9. }
  10. $menu_list.='</ul>';
  11. }
  12. ?>
  13. <!doctype html>
  14. <html lang="ru">
  15. <head>
  16. <meta charset="UTF-8">
  17. <title>Главная</title>
  18. <style>
  19. #menu{
  20. list-style: none;
  21. width: 150px;
  22. }
  23. #menu a:link,#menu a:visited{
  24. text-decoration: none;
  25. font-family: sans-serif;
  26. color: #555;
  27. }
  28. #menu li {
  29. border:1px solid #ccc;
  30. margin:3px 3px;
  31. padding: 4px;
  32. }
  33. #menu li:hover{
  34. background: #ccc;
  35. }
  36. #menu li:hover a{
  37. color: #fff;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <?=$menu_list?>
  43. </body>
  44. </html>
Success #stdin #stdout #stderr 0.01s 20520KB
stdin
Standard input is empty
stdout
<!doctype html>
<html lang="ru">
<head>
	<meta charset="UTF-8">
	<title>Главная</title>
	<style>
	#menu{
		list-style: none;
		width: 150px;
	}
	#menu a:link,#menu a:visited{
		text-decoration: none;
		font-family: sans-serif;
		color: #555;
	}
	#menu li {
		border:1px solid #ccc;
		margin:3px 3px;
		padding: 4px;
	}
	#menu li:hover{
		background: #ccc;
	}
	#menu li:hover a{
		color: #fff;
	}
	</style>
</head>
<body>
	</body>
</html>
stderr
PHP Notice:  Undefined variable: menu_list in /home/LF7v64/prog.php on line 42