CECO - a CGI for Editing Content Only
CECO is a simple CGI program (written in Perl) for self-hosting which allows you to have the same formatting for all pages in a website.
All you have to do is: 1) follow the README instructions; 2) create your CECO template; 3) make some CECO files.
All you have to do is: 1) follow the README instructions; 2) create your CECO template; 3) make some CECO files.
ceco-0.1.zip |
How it works
Here's a CECO file:
Hello, World!
(the two newlines are REQUIRED)
Here's a basic CECO template file:
Here's a basic CECO template file:
<html><body>###[content]###</body></html>
When /cgi-bin/ceco.cgi?c=helloworld is linked to, CECO takes the template, and replaces "###[content]###" with the content in the helloworld.ceco file.
There can be more variables besides content. Try a title:
There can be more variables besides content. Try a title:
title Hi
Hello, World!
...
<html><head>
<script type="text-javascript">
function init(){
var title = "###[title]###";
document.title = title == "null" ? "Untitled" : title;
}
<script></head>
<body onload="init()">###[content]###</body></html>
Here you might notice two strange things: there isn't the two newlines I said were required, and there is a bunch of script which could easily be replaced as <title>###[title]###</title>.
As for the first, ###[content]### is the special attribute. Everything else is between the heading delimiter, which CECO reads from the first line. It assumes everything is the heading (i.e. not content) until it finds a line which matches the first line; here, nothing. That is the easiest, but when you have more advanced attributes that might take up more lines, you can use something else like HD.
In the second case, when the CECO file doesn't define a title, ###[title]### would be replaced with null. Using a script, we can make sure there is a friendlier title.
As for the first, ###[content]### is the special attribute. Everything else is between the heading delimiter, which CECO reads from the first line. It assumes everything is the heading (i.e. not content) until it finds a line which matches the first line; here, nothing. That is the easiest, but when you have more advanced attributes that might take up more lines, you can use something else like HD.
In the second case, when the CECO file doesn't define a title, ###[title]### would be replaced with null. Using a script, we can make sure there is a friendlier title.