Skip to content

Instantly share code, notes, and snippets.

@Stasonix
Created July 30, 2012 11:06
Show Gist options
  • Save Stasonix/3206214 to your computer and use it in GitHub Desktop.
Save Stasonix/3206214 to your computer and use it in GitHub Desktop.
ЧПУ в php Пример index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>test.loc</title>
</head>
<body>
<p>Список категорий</p>
<ul>
<!-- ВЫВОД ВСЕХ КАТЕГОРИЙ -->
<?php
// массив категорий
$cats = array("Football","Box","Hockey");
foreach ($cats as $title)
{
echo "<li><a href='http://test.loc/".strtolower($title).".html'>".$title."</a></li>";
}
?>
</ul>
<!-- ВЫВОД ВСЕХ СТАТЬЕЙ -->
<?php
if (isset($_GET['cat']))
{
echo "<p>Список статьей</p>";
echo " [ ". $_GET['cat']. " ] -> <a href='http://test.loc/".strtolower($_GET['cat'])."/goal.html'>goal</a>";
}
?>
<!-- ВЫВОД СОДЕРЖАНИЯ СТАТЬИ -->
<?php
if (isset($_GET['page']))
{
echo "<p>Содержание статьи <b>".$_GET['cat']."</b> -> ".$_GET['page']."</p>";
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment