Hi All,
How to create DHTML pages using C language? Please give me some web site where I can find the step by step procedure to create DHTML pages using C.
Regards, NM
Hi All,
How to create DHTML pages using C language? Please give me some web site where I can find the step by step procedure to create DHTML pages using C.
Regards, NM
C? Not so suitable language for that.
But, someone did CMS with that, called Tokyopromenade, Opensource
http://1978th.net/tokyopromenade/
Just for your information
For using C to generate (D|X)HTML, you will have to write CGI programs. CGI programs should output the Content-type: text/html
or equivalent before HTML is output.
After that, you can upload the program to the cgi-bin/
or equivalent directory. Remember to set the execution bit on the file.
Have your C program write Content-type: text/html\n\n
to stdout before anything else, and you can then generate whatever HTML you wish. The empty line is critical!
Assuming your application will be executed as a CGI of apache or another HTTP server, you only need to print the HTTP headers and the content of the page to stdout.
The minimal headers expected are:
Content-type: text/html\r\n\r\n
(do not forget the double \r\n)
then write your page.
"DHTML" is mostly used to describe client-side functionality, and you use Javascript for that.
But if you mean dynamic web pages (server-side functionality), and you must use C, you can use CGI (Common Gateway Interface, RFC3875):
http://hoohoo.ncsa.illinois.edu/cgi/primer.html
However, using C for web pages is not a good choice. It would be better to use a scripting language like Python or Ruby, and either study the CGI support in that language or go for a framework like Ruby on Rails.
To create dynamic webpages using C, there are a couple of ways you can go about this (this is not an exhaustive list):
You use CGI, an old standard for creating dynamic webpages. The way this works is that for each request to your site, your webserver creates a new process, invokes your program (passing information about the request to your program using environmental variables and stdin
), and feeds the output from your program to the web browser. As other replies have noted, CGI requires your program to specify the HTTP response headers to the browser.
If you're interesting in using C for performance reasons when developing webpages (this is sort of diving into insanity), CGI clearly isn't an option. If you're this much of a masochist, you should probably look into linking with FastCGI or creating an Apache module. In fact, since you like pain this much, you might as well just start with thttpd and insert your code where needed.
Good luck. You might also consider seeing a shrink.
Search "C library for web applications" here on stackoverflow, it has some good answers.
I haven't tried it, maybe someone would find it usefull: klone. It is a framework for building standalone web serververs and html templating with embedded C.