<?
if(!empty($_GET['edit_page']))
{
$content = file_get_contents('pages/'.$_GET['edit_page'].'.html');
}
echo "<hr><h2>Создание страниц</h2>";
echo "<form method='post' action=''><label>Название страницы</label><input type='text' id='pagename' name='pagename'><br><label>Контент страницы</label><br><textarea class='add' name='content'>$content</textarea><br><input type='submit' value='Создать страницу' />
</form>";
echo "<hr><h2>Редактор страниц</h2>";
$all_files = scandir('pages');
foreach($all_files as $one_file)
{
if(!is_dir($one_file))
{
if(pathinfo($one_file, PATHINFO_EXTENSION) == 'html')
{
$file_name = explode('.', $one_file);
echo '<a href="?edit_page='.$file_name[0].'">'.$file_name[0].'</a><br/>';
}
}
}
if(!empty($_GET['edit_page']))
{
$content = file_get_contents('pages/'.$_GET['edit_page'].'.html');
echo "<form method='post' action=''><textarea class='edit' name='content'>$content</textarea><br><input type='submit' value='Сохранить страницу' />
</form>";
}
?>
Сам скрипт в сборе прилагаю.
Заранее всем благодарен за помощь!