Created
July 30, 2012 11:06
-
-
Save Stasonix/3206214 to your computer and use it in GitHub Desktop.
ЧПУ в php Пример index.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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