Home
FAQ
Tutorial
Examples
Group page
Download and be happy
Forum
Mailing Lists
Bug Tracker
Support Manager
Task Manager
CVS
|
Basic Dina
Nesting Dina
Using Templates to Simplify Tasks
Making Templates
Using Dina modules to handle certain tasks internally
Making Dina Modules
Basic Dina
Really the only thing that Dina understands is:
<?dina=COMMAND
DATA?>
Where COMMAND is a command to run and DATA is the optional data to send to the command.
Example: <?dina=dir?> displays:
Mathology example.dina foo.c navbyr.dina tutorial.dina
dina examples.dina index.dina refer yahoo
dina.old faq.dina index___orig.php simple.dina
dina.tar.gz file mod standard.dit
dina1.1.tar.gz foo navbar.dina temp
See in the FAQ about installation. If you have it running just as a CGI, then you will have to put at the very beginning of the file:
#!PATH_TO_DINA
Or
#!/usr/bin/perl PATH_TO_DINA
Some servers do not allow the former
And the rest is normal CGI
Nesting Dina
Dina also supports nesting so that you can put shell, inside Perl, inside C, inside echo, etc and still be ready for brunch
There is nothing complex about doing this, just do it.
<?dina echo
<?dina perl
print "The<?dina echo time?> is <?dina=date?> currently"?>
?>
Using Templates to Simplify Tasks
Putting all of the commands and such can get tedious, so that is why Dina has templates for these common tasks. All a template really does is replace something simple with the full Dina tag.
The Standard templates (which are automatically done) includes definitions for:
<?dina echo DATA?>
<?dina include FILENAMES?>
<?dina perl CODE?>
<?dina shell CODE>
<?var ENVIRONMENT_VARIABLE>
Making Templates
You will probably come up to a situation in which you want to create your own defines, you do this through the dit files
The format of entries in a dit file goes something like:
This
<MEANS>
That
<NEXT>
Where normal Perl regular expressions turn This into That. Be careful to backslash things properly because it is evaluated directly into a s///si. The i and s options are used, therefore the search is case-insensitive and . matches newlines as well. Refer to any Perl Regular Expressions tutorial for more information
The dit file is then included by putting
<?dit=file.dit?>
into a dina file. standard.dit is automatically included.
Using Dina Modules to handle tasks internally
Dina uses modules to handle tasks internally. Any command which instead starts with INTERNAL: is interpreted as this and executed. The usage of these is completely invisible to the end user
Making Dina Modules
Making modules for dina is one of the simplest things to do. All you do is write a Perl script and put it into the mod/ directory. This script is given the data in the $data variable and should use print for output. When you have the command as INTERNAL:file then mod/file is executed internally as a perl script. It is suggested to use templates for this as well. Be careful that your variable names do not overlap with anything in the dina source, though.
Congratulations: you are now Dina experts. You should now refer to dina files, included dit files and modules as examples
If you use it on your page, could you email me the URL and I will put a link on the page of people who use Dina
|