An very easy site is p2p-block.cgi.
Here you can see how it is combined in a simple way.
Just imagine a perl script (cgi) as a top-down document. The file is read from top to bottom and all commands are executed after each other. This aproach is very simple but not really useful for bigger sites.
You can use functions to summarise usefull parts of the code.
it is difficult to describe as every developer has his own "way of code". Just have a look at the smaller cgi's and try to understand the way it works.
My own opinion for a cgi structure is as follows:
- load modules - define variables - define arrays/hashes - include needed other files - "ACTION"- handler (if you use forms) - rest are functions for the different action handlers or a "default" function which is called if no action was taken
Am 27.06.2015 um 09:37 schrieb Larsen:
On Thu, 25 Jun 2015 12:28:51 +0200, Alexander Marx alexander.marx@oab.de wrote:
On Thu, 2015-06-04 at 23:46 +0200, Larsen wrote: > PS: Need help with the TODOs in that patch as I am now web > developer > and where I don´t know how to use an if-clause. As these are in the ovpnmain.cgi (as far as I have seen) you should get in touch with Alex when he is back from holiday. That will be towards the end of next week.
Should not be related to ovpnmain.cgi. I just don´t have the experience how to combine html-code and if-clauses here. Any dev might be able to give a hint here.
Hi All "HTML" Files are the cgi files within /srv/web/ipfire/cgi-bin. These Files are CGI's which means it can be any programming language. The IPFire CGI's are usually written in perl. So one can easily use perl if-clauses. When it comes to the output part you also use Perl code to "print" the htmlcode.
Yes, I know where to change it, but I don´t know how exactly to combine perl code and HTML. Please have a look at the parts marked with TODO here: http://patchwork.ipfire.org/patch/15/
In other places, there is a huge "print" part where perl gives out HTML in one block. Here however, I need to use perl inside one of those blocks.
Lars