::

ElkiwyArt


[The development is: On going]

This project is the piece of code responsible for the generation of this very website.

The first implementation of ElkiwyArt was made mainly with PHP, a simple database, and some HTML templates. This was fine at the beginning, but it quickly became pretty ugly to improve and not really that flexible. PHP started to give errors when I was uploading new articles through forms and it was a pain to handle the creation of new posts.

So, after I was almost abandoning the website I went through the "Oscean" project from Devine Lu Linvega.

He did his website with a C99 building every page statically. That approach is ideal if you don't have dynamic pages in your website since it let you forget about PHP servers, MySQL servers, Templates, post forms, and all that crap.

This let me focus on the only thing I want to do: create simple static pages for my website and adding anything I want.

The implementation

Ok, but how the crap you write a website with C? the answer is pretty simple: you don't.

In fact, with C99 you make a program that parse some structs you define and outputs on files simple and plain HTML tags. This is beautiful because you have the change to make your own functions to parse data and output contents in a similar way you do with Templates, but on a much more precise way.

After you made the builder you can fill it with data in any way you want, I used another C file where I call my functions directly, but you can use JSON, YAML, or any other thing to insert data in your program.

With builder and content in place, another beauty of this method is visible: you can check the result and your entire website locally with just a normal browser! Since everything is plain HTML there is no need for webservers and database to work. Once the result is just like you desire, you can then upload the entire generated files into your web space and it's done.

This is a friction less system compared to my previous one and it's way easier to correct, tweak and improve the website.

The source

As I state before, this project is heavily inspired by Devine's work, but I rewrote almost everything to be able to understand it and customize more easily. My version is a bit simpler and essential because I still have to add some of the feature I want, but you should be able to understand the core and learn from it enough to be able to recreate a custom version for your needs.

The full source is available on my GitHub here: Source.