Witam, jestem w trakcie tworzenia strony i zamierzam wprowadzić do niej ulepszenia. Jednym z nich ma być opcja umożliwiająca dodawanie komentarzy. Problem w tym, że nie wiem jak się za to zabrać. Może istnieje jakiś skrypt? Aha czytałem gdzieś że da się to zrobić w php ale narazie w miarę dobrze znam Html’a i Css. Czy da się to zrobić bez znajomości php?
Jest tam jeden plik w archwium o nazwie 3_1.php z jego zawartości to tak:
Chyba na początku dokumentu w którym mają być te komentarze wstawiasz:
<?
/*
annotate.php3
This is a module that can be placed on any php3 page to allow users to add
their comments. The comments are stored in a file in the current directory,
whose name is constructed by adding ".comment" to the calling page's name,
and merged into the calling page dynamically. (The calling page is not
modified.)
I wrote this because I wanted a simple way to add this functionality to my
pages without requiring that mySQL be available.
In the message input, blank lines are converted to paragraph tags. No other
conversions are applied. If you don't want your users to be able to input
html, uncomment the "strip_tags" line.
Note that the directory must be writable by the web server.
Put this module in some convenient location and then embed it in your pages
like so:
require("/some/full/path/annotate.php3");
or, relative to the docroot:
require($DOCUMENT_ROOT . "/relativepath/php3");
Steve Yelvington
*/
if ($message)
{
/* uncomment the next two lines to strip out html from input */
/* $name = strip_tags($name); */
/* $message = strip_tags($message); */
$message = ereg_replace("\r\n\r\n", "\n
", $message);
$date = date("l, F j Y, h:i a");
$message = "$name -- $date
$message
";
$fp = fopen (basename($PHP_SELF) . ".comment", "a");
fwrite ($fp, $message);
fclose ($fp);
}
@readfile(basename(($PHP_SELF . ".comment")));
?>
[/code]
Potem tam gdzie chyba ma być link "dodaj komentarz" czy jakaś taka to wstawiasz ten kod:
[code] Your name:** Your comment:**
wrzucasz to na serwer z obsługą PHP i powinno być ok Jak coś to pisz ;]
adam9870 napisz proszę, co trzeba zmienić w konfiguracji serwera by .html obslugiwalo .php, wiem że jest to możliwe, ale niebbardzo wiem co zmienić
Krzysztof 7 nie, to za mało, jeżeli masz serwer nie na swoim komputerze, to najłatwiej będzie Ci zrobić stronę w php, nie okłamujmy się ,sprowadza się to tylko do zmienienia rozszerzenia na .php lubo pochodne