On this page you'll find some very easy examples of how ONO modules and libraries can be used.
Please note that ONO can do much more, from manipulating simple data and files (via ONO::Lib) to building highly complex community platforms (via ONO::ToolBox and ONO::FW for example). Make sure to check out the documentation to see what's possible.
This example will generate a simple web page that just says "Hello World!".
In order to do so, we'll need to use the ONO::Render module. Please note that you'll need to specify the path to ONO (/ono/sys) using "use lib" - unlike most CPAN modules, the ONO package is stored locally under your document root. You may, of course, also circumvent this, using a symlink for example.
In the following example, we'll use separate modules provided by ONO::Render, this will allow for greater flexibility later on.
Note that open(), head(), body() and close() are all required, the HTML code will be broken if one of those is missing.
In this example, we'll retrieve all GET or POST input variables (via ONO:ToolBox::Input, all input data will be accessible via the %vars hash), we'll detect the website language (by analyzing the domain name via ONO:ToolBox::DomainLang), and we'll generate a cookie that will be valid for 3 months (via ONO:Lib::Web::Cookie).
We'll send the cookie and the website language info to be web browser via open(), and we'll indicate a page generator ('MyName') via head(). Furthermore, we'll load ONO/CSS and ONO/JSS via cssjs() to get the "ONO look and feel", and we'll set a background color via body();
ONO::IO offers quick and easy access to files and directories within your document path. Most operations, such as reading, writing, moving or deleting files and directories, only require a single line of code. Most ONO::IO calls also respect special use cases, such as (re)moving thumbnails, previews, and meta information for example.
Traditional Perl I/O is no longer requied.
ONO::DB offers quick and easy access to SQL databases, making it very easy to read, add, or update database records.
ONO::DB can be used with both MySQL and Microsoft SQL Server. The standard SQL syntax is MySQL, the Microsoft SQL syntax is automatically adjusted by ONO::DB in most cases.
ONO::ToolBox::Init can return input variables (simple and quoted), site language and the basic language kit (BLK) using one single call, performing cookie-based user authentication at the same time, which is usually enough to get a simple website or platform running.
ONO:::FW::Community::Init returns some more stuff, like the $vpath (absolute document path), $domain, date and time, as well as precoded HTML sniplets ($script_url is the path to the current script including basic variables, $action_url is the path to the current script for use in forms (action), while $form contains basic HTML form data.
Note that ONO:::FW::Community::Init does NOT perform user authentication, while ONO::ToolBox::Init. In many cases, it may be useful to use both at a time.
ONO CSS offers many predefined UI classes, so that it's very easy to create websites and platforms offering a consistent user experience.
Here is the same code, this time interpreted by your web browser:
ONO/JS offers a number of JS calls that make traditional DOM syntax (e.g. "document.getElementById...) mostly obsolete. ONO/JS has been optimized for dense, compact and easy to read JS code.
The ONO BLK generates a hash containing a number of words (as well as some small expressions) and buttons in one of four languages (en - English, de - German, fr - French, lu - Luxembourgish).
Luxembourgish is part of the BLK for historic reasons, as ONO also powers oli.lu, which is the primary education portal in Luxembourg. Note that ONO is using "lu" as language code for luxembourgish, not "lb".