ONO::Render

ONO::Render helps with the generation of both simple and complex web pages.

Example 1:

ONO::Render->render_simple("Hello World!");

Example 2:

print ONO::Render->open();
print ONO::Render->head();
print ONO::Render->body();
print "Hello World!"
print ONO::Render->close();

Example 3:

print ONO::Render->open($cookie,$lang);
print ONO::Render->head('MyName');
print ONO::Render->cssjs('','/site-data/demo/my-own-css.css');
print ONO::Render->title_key_desc_robots($title,$keywords,$description,$robots);
print ONO::Render->body("background:#333333");
print "Hello World!"
print ONO::Render->close();

Example 4:

print ONO::Render->render_pre($keywords,$description,$vars_ref);
print ONO::Render->render("Hello World!",$title,$vars_ref);

Functions

body();

Generate web page code (step 3 of 4). Note that you may pass body style information to this function.

ONO::Render->body( );

close();

Generate web page code (step 4 of 4).

ONO::Render->close( );
returns: qq~<script>onojs_init_post();</script> </body> </html> ~

cssjs();

Load ONO CSS and ONO JS files, and also display a timestamp and client IP information.

Note that you may pass software base and additional CSS file information to this function.

CSS and JS files will be reloaded once a day on production systems, while they will ALWAYS be reloaded on development stations (which makes debugging CSS and JS a lot easier).

ONO::Render->cssjs( $BASE, $EXT, $REL );
returns: $CSSJS

description();

Generate a useful description by analyzing the page code. Only useful for some generated content, is is strongly recommended to use the ONO SEO tools in most cases.

ONO::Render->description( $desc, $WEB, $default );

head();

Generate web page code (step 2 of 4). Note that you may pass author information to this function, and that this step may optionally be followed by calling cssjs().

ONO::Render->head( );
returns: qq~<head> <meta charset="utf-8"> <meta name="Author" content="$_[1]"> <meta name="Generator" content="ONO$MOD"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="referrer" content="no-referrer"> ~

init();

Get the name, the main directory name, as well as configuration data of the current ONO project.

ONO::Render->init( );
returns: ($app,$App,\%conf)

open();

Generate web page code (step 1 of 4). Note that you may pass cookie and language info to this function.

ONO::Render->open( );
returns: qq~Content-type:text/html; charset=UTF-8\n$cookie\n<!doctype html>\n<html lang="$_[2]">\n~

open_simple();

Generate web page code (step 1 of 4), but don't include content-type, cookie or lang data (good for saving HTML files, not good for live rendering).

ONO::Render->open_simple( );
returns: qq~<!doctype html>\n<html>\n~

render();

After using render_pre(), this will print the rest of a HTML page. Note that this will to some automated processing that's not yet documented here, so be careful (or check the code).

Simply call the function, do NOT use any print instruction here. ONO CSS and JS will always be loaded.

ONO::Render->render( $WEB, $title, $vars_ref );

render_myself();

This will print the code of the current front end script. Note that this function is just for demo and testing purposes.

ONO::Render->render_myself( );
returns: qq~<div class="box_code mb10">$WEB</div>~

render_pre();

Print the head of a HTML page, supporting cookie creation via input vars. Note that this will NOT close the page head or open the page body! This function should be used on top of a script, followed by calling the render() function at the bottom of the script.

Simply call the function, do NOT use any print instruction here. ONO CSS and JS will always be loaded.

ONO::Render->render_pre( $keywords, $description, $vars_ref );
returns: ""

render_simple();

Print a very simple HTML page, only the page code itself is required as input.

Simply call the function, do NOT use any print instruction here. ONO CSS and JS will always be loaded.

ONO::Render->render_simple( $WEB, $no_content_type );
returns: ""

title();

Generate a useful title by analyzing the page code. Only useful for some generated content, is is strongly recommended to use the ONO SEO tools in most cases.

ONO::Render->title( $title,$WEB );
returns: $TITLE

title_key_desc_robots();

Generate HTML code: page title, keywords, description, and robot information. Default robot data is 'index, follow'.

ONO::Render->title_key_desc_robots( );
returns: qq~<title>$_[1]</title> <meta name="keywords" content="$_[2]"> <meta name="description" content="$_[3]"> <meta name="robots" content="$ROBOTS"> ~

Internal Functions

_get1();

Internal function, used by render();

&_get1( );

Sub-Modules

Dependencies