SQLPage v0.20.3 documentation

If you are completely new to SQLPage, you should start by reading the get started tutorial, which will guide you through the process of creating your first SQLPage application.

Building an application with SQLPage is quite simple. To create a new web page, just create a new SQL file. For each SELECT statement that you write, the data it returns will be analyzed and rendered to the user. The two most important concepts in SQLPage are components and parameters.

To select a component and set its top-level properties, you write the following SQL statement:

SELECT 'component_name' AS component, 'my value' AS top_level_parameter_1;

Then, you can set its row-level parameters by writing a second SELECT statement:

SELECT my_column_1 AS row_level_parameter_1, my_column_2 AS row_level_parameter_2 FROM my_table;

This page documents all the components provided by default in SQLPage and their parameters. Use this as a reference when building your SQL application. If at any point you need help, you can ask for it on the SQLPage forum.

If you know some HTML, you can also easily create your own components for your application.

components

The "code" component

Displays one or many blocks of code from a programming language or formated text as XML or JSON.

Introduced in SQLPage v0.19.0.

Top-level parameters

class

class attribute added to the container in HTML. It can be used to apply custom styling to this item through css. Added in v0.18.0.

id

id attribute added to the container in HTML. It can be used to target this item through css or for scrolling to this item through links (use "#id" in link url).

Row-level parameters

contents

REQUIRED. A block of code.

description

Description of the snipet of code.

description_md

Rich text in the markdown format. Among others, this allows you to write bold text using **bold**, italics using *italics*, and links using [text](https://example.com).

language

Set the programming language name.

title

Set the heading level (default level is 1)

Example 1

Displays a block of HTML code.

select 
    'code' as component;
select 
    'A HTML5 example' as title,
    'html'            as language,
    'Here’s the very minimum that an HTML document should contain, assuming it has CSS and JavaScript linked to it.' as description,
    '<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>title</title>
		<link rel="stylesheet" href="style.css">
		<script src="script.js"></script>
	</head>
	<body>
		<!-- page content -->
	</body>
</html>' as contents;

Result

A HTML5 example

Here’s the very minimum that an HTML document should contain, assuming it has CSS and JavaScript linked to it.

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>title</title>
		<link rel="stylesheet" href="style.css">
		<script src="script.js"></script>
	</head>
	<body>
		<!-- page content -->
	</body>
</html>

Official SQLPage documentation