Non request
Non-request source files implement common code used in
request-handling .vely files. Their names always start with an underscore ('_').
So for instance, file '_display.vely' would never handle any requests directly - such file may be (for example) implementing common code that displays various HTML statements.
A non-request source file can implement any number of functions which can be named in any fashion. However, Vely will declare a prototype for a function with the same name, saving you to the effort to do that, should you decide to implement it. For example, if you have function "void _display_table()" in file "_display.table.vely":
#include "vely.h"
void _display_table() {
...
}
then the prototype for function "void _display_table()" will be automatically generated and you do not have to do it manually. You would implement any other functions related to it in the same source file.
When Vely code is compiled, both request and non-request source code is automatically picked up - all files with .vely extensions are used.
Examples
In the following example, a list on customer names is shown (note functions header() and footer()), and the code is implemented in
request source file show.vely:
#include "vely.h"
void show() {
run-query @db="select name from cust" output name
header();
query-result name
footer();
end-query
}
Functions header() and footer() are implemented in non-request source file _display.vely:
#include "vely.h"
void header() {
@Name:<br/>
}
void footer() {
@<hr/>
}
Both files (show.vely and _display.vely) will be automatically picked up, compiled and linked.
See also
Requests (
after_request_handler before_request_handler building_URL getting_URL global_request_data non_request normalized_URL request request_URL startup_handler vely_dispatch_request )
SEE ALL (
documentation)