Finally someone came to me to publish the menu of a nearby restaurant that colleges visit for lunch. A weekly update. And the menu was available as printed text to type in. NO!
Instead I created diWEBlo, a CGI script that you can let the users to update the content of the Web pages you have designed.
<html> <head> <title><!--#diweblo title--></title> </head> <body> <h1><!--#diweblo title--></h1> <hr> <!--#diweblo body--> </body> </html> |
# html template file File: d:/inetpub/wwwroot/progs/perl/diweblo/example1.htm # result file TemplateFile: d:/inetpub/wwwroot/progs/perl/diweblo/example1.html |
<html> <head> </head> <body> Define title and body of the page: <form action="http://localhost/iscripts/perl/diweblo/diweblo.pl"> title: <input type=text name="title"><BR> body: <input type=text name="body"><BR> <input type=hidden name="template" value="example1"> <input type=submit> </form> </bod> |
![]() |
<html> <head> <title>here is the title</title> </head> <body> <h1>here is the title</h1> <hr> this is the body </body> </html> |
![]() The name of the template file was specified by the CGI variable template. |
Password: my_passwordand the html file containing the form should also include:
<input type="password" value="" name="Password">diWEBlo will only accept input with the proper password.
Example 1 is simple enough. Whenever the user wants to change the title and the body he/she can type the new value. But what to do when a web page has several parameters, or some parameters are rather long. (Imagine our weekly menu, three dishes for five days summs up as fifteen parameters.) Should the user type in all the sentences to correct a typo?
The answer is no, the user need not type in all the parameters again. (I guess you have guessed it.) diWEBlo provides a way to have all previous values being displayed in the forms as default values.
To get this we have to extend our example telling diWEBlo to save the parameters to data file. And we can change the html form file to display the saved parameters as default values.
This way diWEBlo runs twice to change a Web page. First it is started to show the editing page for the user and after it is filled in, or corrected diWEBlo runs to modify the Web page.
To perform this you need to create another html template file for the form possibly including a password field, and to specify the file name of this file in the template file as
EditFile: d:/inetpub/wwwroot/progs/perl/diweblo/example2_form.html
Well, here it is example2_form.html:
<html> <head> </head> <body> Define title and body of the page: <form action="http://localhost/iscripts/perl/diweblo/diweblo.pl"> password: <input type=password name="Password" value=""><BR> title: <input type=text name="title" value="<!--#diweblo title-->"><BR> body: <input type=text name="body" value="<!--#diweblo body-->"><BR> <input type=hidden name="template" value="example2"> <input type=submit> </form> </bod> |
The content of the new template file example2.templatefinally is:
# html template file is still example1.htm File: d:/inetpub/wwwroot/progs/perl/diweblo/example2.htm # result file TemplateFile: d:/inetpub/wwwroot/progs/perl/diweblo/example1.html EditFile: d:/inetpub/wwwroot/progs/perl/diweblo/example2_form.html # save data in this directory Data: d:/inetpub/wwwroot/progs/perl/diweblo # this is a password, not a real one, only for example Password: example |
When this is ready you can start diWEBlo to display the edit page with the URL:
http://localhost/iscripts/perl/diweblo/diweblo.pl?display=example2Your host name, or the name of the virtual directory can be different, but the way to invoke diWEBlo is similar. We define the name of the template using the CGI variable display, and this is the fact that tells diWEBlo to display the edit page instead of trying to create a new html file using the CGI parameters.
This is diWEBlo in short. You can use it free under GNU GPL and read a bit more detailed, advanced User's Gude. Well, not for the USERS, for you. The user's guide is less explanatory, more documentary and covers features like using more than one edit page for the same html, let different users to change different parts of the same HTML page, and so on.