Posted: Sun Nov 13, 2005 11:07 pm Post subject: Site Management
Plenty of us have our own web site. I was just curious how you go about managing the site (Uploading Files, Renaming, Moving, Copying, Editing, etc). Do you do it right of your computer? Through an online File Managing script? Or not at all? If you use a script, could you please post the URL of the download, I am trying to find a better site management script.
I used to just upload from my computer, as I found it to be the best way. Recently though (ie, today and yesterday ) I've started converting my pages to XML format, and then getting the content directly from there. I'm creating a mini-CMS to upload files to any folder on my server, and to edit the XML.
All my site's pages are text files, the file is only responsible for the page's own unique content (i.e. main body of the page). Query string "display=" is converted to the filename, i.e. display=about gives you "about.txt", and if the page isn't found it gives a custom 404-style error page.
So the main site's layout can be changed easily and every page will be automatically updated since they were never responsible for how the final page should look. _________________ Current Site (2008) http://www.cuvou.com/
Yes, but how do you add the text files/edit them? Do you just double click it and edit it on your comp? Or do you have a script that lets you edit it from any computer?
Yes, but how do you add the text files/edit them? Do you just double click it and edit it on your comp? Or do you have a script that lets you edit it from any computer?
When I run my own server, yeah I just edit them right from my desktop. When it was on another server, I'd edit them on my computer and upload them (so if the server crashed, I'd still have all the updates on my computer because they were changed there first).
And for when I wasn't at home, I made a page for editing files through the site, and could make updates to pages through a page on the site and then save them, and download them when I got home just to have a backup copy. _________________ Current Site (2008) http://www.cuvou.com/
$username wanted my file editor code. It's actually a page within my content-managed site, so it won't run as a standalone script.
Basically what you need to do, use the open function to get the page's content into a <textarea>, have a save function to put the data back into the file... it's not too hard to figure out.
Here's my code anyway, $cks->{content} = the page's final output, <perl> = indicator for evaluated code interpreted by the site engine, <nofilter></nofilter> marks part of the code to not be filtered through the site engine (things like <tab>, $self, etc.)
# See if the user is eligible to override.
if ($cks->{logged_in} == 1) {
if (exists $over->{$sn}) {
# Check that they're within their limits.
my $action = $query{action};
my $file = $query{file};
if (exists $over->{$sn}->{permissions}->{$action} && exists $over->{$sn}->{files}->{$file}) {
$override = 1;
}
}
}
# Leader ONLY!
if ($cks->{logged_in} == 1 && (&isTop || $override == 1)) {
# Actions?
if ($query{action} eq 'edit') {
my $file_data = '';
# If the file exists...
if (-e $query{file}) {
open (FILE, "$query{file}");
@data = <FILE>;
close (FILE);
chomp @data;
$file_data = join ("\n",@data);
}
else {
$query{file} = './New File.txt';
}
# Log this.
open (LOG, ">>$cks->{path}->{logs}/file_edit.txt");
print LOG localtime(time) . " :: $cks->{users}->{$sn}->{username} <$ENV{REMOTE_ADDR}> has edited file: $query{file}\n\n";
close (LOG);
$cks->{content} = "<b class=\"header\">:: Save Successful!</b><br><br>\n\n"
. "The file <b>$query{file}</b> has been saved.<br><br>\n\n"
. "¤ <a href=\"$self?display=leader.files&action=edit&file=$query{file}&[cks]\">"
. "Back to Editing File</a><br>\n"
. "¤ <a href=\"$self?display=leader.files&[cks]\">"
. "Back to File Manager</a>";
}
else {
# Main List Page.
$cks->{content} = "<b class=\"header\">:: File Manager</b><br><br>\n\n"
. "All your site's files can be found here for editing. Also, "
. "the text field below can be used to access any other file on "
. "your server.<br><br>\n\n"
. "<form name=\"editfile\" action=\"$self\" method=\"post\">\n"
. "<input type=\"hidden\" name=\"display\" value=\"leader.files\">\n"
. "<input type=\"hidden\" name=\"action\" value=\"edit\">\n"
. "<input type=\"hidden\" name=\"c\" value=\"1\">\n"
. "<b class=\"header\">:: Quick Jump</b><br>\n"
. "If you know the exact path to the file you want, enter it below.<br>\n"
. "<input type=\"text\" size=\"50\" name=\"file\" class=\"text\">"
. "<input type=\"submit\" value=\"OK!\" class=\"bttn\">\n"
. "</form><br><br>\n\n"
. "<b class=\"header\">:: All Files List</b><br><br>\n\n"
. "<table width=\"500\" border=\"1\" bordercolor=\"#AAAAAA\" "
. "cellspacing=\"0\" cellpadding=\"0\">\n";