Objects are variables and processes created by the admin or author that makes up a piece of reusable content. They are content tools built for use as part of the CMS. Although the same functionality is part of the core engine, these objects (in conjunction with the CMS interface) makes doing some common web development tasks incredibly easier. Each object needs a name assigned to it (like naming a file), in which it can then be embedded into content such as that of pages, templates, or within other Wrival Inserts. Although some of the features of many object types can simply be written directly into a Wrival Insert, it may be advantageous to create it as an object instead, such as:
- Easier Some of these objects just make doing some things easier to build.
- Reusable Instead of having to put more complex formulas in a shopping cart summary, preview order, checkout, confirmation email and so on, one simple alias to the formula can make things like this easier.
- Registered Objects are registered so they are easy to find and will have an interface dedicated to them.
Important Note: Object names become reserved. Avoid creating conflicting names that might conflict with headers, form fields, and cookies.
A Variable is a value assignment. The value can be made up of text, html, numbers, and other variables as desired. The variable name essentially then becomes an alias to piece of content (example 1). Likewise, a formula could also be written and then referenced using the name (example 2).
This simple example returns an italicized version of "MyBrand" with the html registered trademark symbol.
This simple example returns how many days there are until the last day of the month.
One big text area! Use it for reusable or conditional content. While any Wrival Insert can have the Text to HTML function applied to it, this one has it build-in if it's checked. Use this type when multiple lines are needed.
Text to HTML
Today is Wednesday! Also, here's some other details about today:
- The date is 18
- The month is October
- The year is 2017
Hopefully it's a good one!
Include an image and, optionally, make it a link.
Width X Height: X
Other IMG Attributes:
A Tag - (optional)Link To:
Other Link Attributes:
<a href="http://www.wrival.com/" target="_blank" onMouseOver="alert('Rolling Over My Image!');"><img src="/_/files/MyImage.jpg" alt="My picture of NorCal!" style="padding: 1px; margin: 5px; border: 2px solid; border-radius: 10px; box-shadow: 10px 10px 5px #999999;"></a>
Use the File object for offering a download and link or embedding a multimedia file. The object itself is just an alias to the file's location. If the file is text based you can embed its contents by double embedding the object. To make a link to the file use the object as the hyper reference (href) part of a link in another object or in other content. Also, if the extra text field is not empty that value is returned instead.
Text (returns this if it's not empty, otherwise it returns the path and file name):
<a href="<#MyFile>">Download</a>→ Download
File Link with Size:
<a href="<#MyFile>">Download (<#<#MyFile:bytes>(byte,KB):ceil> KB)</a>→ Download (0 KB)
<#<#MyFile>>→ #!/usr/bin/perl $var = "My Perl Script!"; print $var;
File Embed and Execute:
<#<#MyFile>:exec>→ My Perl Script!
This example shows how the object returns text instead of the file path itself. Note, this also means that any inline functions for files will not work on this type of configuration.
Text (returns this if it's not empty, otherwise it returns the path and file name):
First of all, don't be afraid! The term "database" may sound scary, technical, and the length and content of this page may look overwhelming, but it's just because there's so much you can do with this type of object. To orient yourself think of it as a simple spreadsheet or data table, because that's all it really is. There are just so many ways to use the data within them, but with Wrival No programming is needed! Wrival really does make this so easy!
Use the Database object to save form information and group related information together, which can then be used in queries and value processing loops. This means you can apply the same formatting on different entries without having to code for all of them, just once. If you want more than just a simple data table, Wrival's databases will link with other files and images, evaluate variables before saving entries, and format data automatically as instructed in order to create data integrity. This powerful object makes cataloging, searching, and database maintenance incredibly easy.
By puting related content in a database table and then having a page that includes just a query object that uses references a keyword means that you simple can manage the database instead of having to create individual web pages. In addition, a second search page and query can easily search through all the content and return results based on the strength of the inquiry.
A database object has some properties associated with it that include the following:
- Path This is where the images and files will be saved to.
- Public If this option is enabled it tells Wrival to treat all data as from the public and removes disables Wrival Inserts in the input.
- Auto Publish This makes it so that every time the database is saved, such as a record being written, it is automatically published, making new records immediately available in the live realm.
In Wrival, a tabbed database file must start with a header line. The header line defines the names for each column of fields, which is how each field in its columns are referenced. Also defined with each header name may be a declaration of what type of field to treat it as. The type works as a filter when saving information or an assembler for returning information. Each have different characteristics and purposes, which are as follows:
||Saves as either "1" or "0" and returns as "True" or "False".|
||Increments every time the record is saved.|
||A data table that belongs to and is referenced by the individual entry.|
||An amount of seconds.||Deletes entry when the entry's date is more than X seconds ago. Value is stored as timesort.|
||Stores a file for the field and returns the path and file name as saved or tries to run it as a CGI if "exec" is its value.|
||A numerical value (whole or with a decimal).||Saves values as a number before saving.|
||Stores an image file (png, jpg, gif) and returns an IMG tag.|
||Converts to a whole number before saving.|
||Identifies the column as the key (always the first column). The option declares how to generate one during an entry save if one isn't present. "Increment" is a number that increments during every save (that doesn't have a key specified), which also adds one to the largest existing entry to ensure that every new entry saved gets a unique key. "Largest" only finds the current largest numerical key value and adds one to create a new key. "Locked" will only save over existing records and the sequence of how the records were stored is preserved.|
||A Database object's header, which is converted to options for saving the value in the CMS.|
||A multi-lined text area (text file) that's embedded as is or is first converted to html.|
||This is the default header type. It simply returns the value as is. Treated as a Key if its the first column.|
||Can be anything including Wrival Inserts, but no tabs or new lines.||Parses the header's option and saves the result (
File, Image, Data, and Text Saving Locations
- File, Image Files are put within preview and live realms making them available for downloading unless their folder have been made password-protected.
- Date, Text Data and Text files are saved to the vault making it impossible to browse to from the public side.
The tab-delimited table part of Database objects are stored and read from outside any accessible area from where the data is being used. This means that a visitor that isn't intended to have access to its data can't directly access the Database object itself. However, be mindful that files (including multi-lined text) and images are stored in the same realm as the request, but their folders can be password-protected.
Also, databases have the option of being published automatically as changes are made for processes that you want to reflect on the live server.
Wrival offers default maximum sizes for the different field types. There
are 2 main factors, which are tested against size. A field value's length in
is set to 10,000 characters and the maximum size of files is set to 10MB. If
your hosting environment allows for this value to be overriden you can set it
to allow for more (reference
To reference the headers themselves there are Inline Functions that
cover that need. They include
headeroptions. They each need to be followed by the database object
name to be referenced.
The following example shows a real basic database table (no header types defined). Each of the headers and corresponding fields are simple values. With a simple database table like this it is easy to run queries or loop processes to use the data in web pages or within other Wrival Inserts. Also, this makes for external spreadsheets simple to convert for web use. Simply copy and paste from your spreadsheet software into a database object. Just be sure your fields are tab delimited and the first line of the object has unique and valid header names. You can then use the shortcut syntax for referencing the values or use it in a Query object. You may use either the header name or its index.
<#MyProducts|9655|Description>→ Something else cool.
Remember the power of Wrival comes by utilizing other system variables together. With this approach you could easily now make a menu that links to a page that includes the values based on the Key. For example:
Then on the
view.wrival page you could embed the data
in any format and populate it dynamically with the values using the
database field shortcut with the
(created from the GET link) like so:
<#MyProducts|<#clicked>|Item>→ (would return whichever item was clicked)
<#MyProducts|<#clicked>|Color>(processes deepest tags first)
<#MyProducts|1141|Color>(inserts result, 1141 for example)
- Black (then returns the inquiry)
This example shows the header types that return a different value than what is saved in its column. In the Wrival CMS there are different ways to view a database object. For the sake of showing the headers this only shows the tab-delimited textarea view. It would be much easier to manage the data in the alternative forms in this case as the tabbed columns do not line up.
<#MyDB:textarea,headeroptions>→ Col1=,Col2=floor,Col3=8,Col4=,Col5=,Col6=html,Col7=exec,Col8=,Col9=<#date> and <#seconds>,Col10=ForSale|,Col11=
<#MyDB|123|Col5:table='id="chart" style="width: 200px;"'>→
<#MyDB|123|Col5|A|Child>→ A Value.
<#MyDB|123|Col5|B|Child>→ B Value.
This was from my Text field in MyDB!
- Text to HTML should on.
<#MyDB|123|Col7>→ My Perl Script!
This is a very powerful object. It replaces the need for writing complicated queries or other loop processes and any other additional tricky programming of merging databases. The Loop object takes a value or list of values and runs an evaluation against each item, sorts the results accordingly, and assembles the output as desired by the administrator.
The Loop source can be 3 different type of data: List, Database, Integer
- List A list is a series of values spearated by commas, which each is defined as
eachduring each loop. Also, that value may be separated by an equal sign, which end up making up
valuerespectively during each loop.
- Database(s) Each loop is ran for each entry and the key is defined in the
eachvariable. Each of the database fields are defined as their header variables. A list of databases will be virtually merged as one.
- Integer A total amount of times to run the loop. The
eachvariable is the increment of each loop ran until the total, the integer, has been reached.
Fruit Sorted by Amount (most to least)
- There are 25 Berries
- There are 5 Oranges
- There are 3 Kiwis
- There are 2 Apples
- There are 1 Bananas
Total Types of Fruit: 5
The Increment object is a number that increases by 1 everytime it is used. Unlike using a variable and ++ or a cookie that expires or can be deleted, this number won't reset per request. Use it for things like order numbers or as a counter in other objects.
Last Reset: 1, 11/26/2012 12:12 pm
The Random object will create a random sequence of characters and can be generated to different degrees of complexity by changing the pool of characters and the length. The Unique checkbox will force the result to only include each value from the pool only once. If the pool length is smaller than the length specified, the resulting length would end up being the length of the total pool. One of the pool options is custom, which can either be a sequence of any characters except for a comma ("ABC" would return A, B, or C). Or a set of values separated by commas ("ABC,DEF,EFG" would return ABC, DEF, or EFG). Use it to generate passwords or unique keys such as for serial numbers or session references.
Compose and deliver a dynamic message! Where ever this object is used the message will be sent. To use the email object simply embed the object name where you'd want to send it such as a page that a form requests when being submitted. Only a valid email will be sent and also keep in mind limitations of the email services. (Sending mass emails from this service isn't going to work.)
|Text to HTML||Send as: HTML, Plain Text|
<#MyEmail>→ (Nothing is returned, but the email message should be populated and sent if everythings checks out.)