To install eZeeBase add this script to your website's code inside <head> tag.
Make sure to put your actual project id inside the code.
To use Firebase Authentication through eZeeBase you will need to activate auth module in your project settings.
You can setup forms to sing up or sing in your users through website. To do so, you will need to add a cstom attribute to the <form> element.
Name:
Value is different for every form type. Refer to the paragraphs below for details of each type's value.
The main fields for authentification are going to be Email and Password. Make sure to set proper names for these fields in your form:
For Email field:
For Password field:
To Sign up a user through a form, add the following value to <form> element's custom attribute:
Value:
HTML example:
To Sign in a user through a form, add the following value to <form> element's custom attribute:
Value:
HTML example:
To update member through website add the following value to <form> element's custom attribute:
Value:
HTML example:
For update form you can setup additional fields to add user information. You can add Photo URL and Name. Set text input name attributes' value as the following:
For Name field:
For Photo URL field:
You can display user data from auth module fields by adding custom attributes to elements on your website. Data can be displayed as an inner text or as a html attribute value.
Do display data add an attribute with the following name:
Name:
Then add a value based on what data you want to display. Look at the following section to find a right attribute.
To display user's data as an element's inner text, add the following value to the element's custom attribute:
It will display user's unique ID as the element's inner text.
It will display user's email as the element's inner text.
It will display user's Display Name as the element's inner text.
It will display user's Photo URL as the element's inner text.
HTML example:
To display user's data as an element's html attribute, add the following value to the element's custom attribute:
It will display user's unique ID as the element's value to HTML "value" attribute.
It will display user's email as the element's value to HTML "value" attribute.
It will display user's Display Name as the element's value to HTML "value" attribute.
It will display user's Photo URL as the element's value to HTML "src" attribute.
HTML example:
You can hide and show elements on page based on wether user is authenticated or not. To do so, you need to add custom attributes with the following name to such elements.
Name:
Add the following value to Hide if the user is logged in, and show if not:
Value:
HTM: example:
Add the following value to Show if the user is logged in, and hide if not:
Value:
HTM: example:
You can set a preloader screen, which will hide all of your page's content while Firebase is being initialized on your page.
To add the preloader screen, create an element of the screen and add the following custom attribute to that element:
Name:
Value:
eZeeBase script will be showing and hiding the preloader screen.
HTML example:
To use Firebase Firestore database on your website, you will need to activate Firestore module in your eZeeBase project settings.
To display Firestore collection, first you need to add a Colleection Wrapper <div> and claim a collection in custom attribute of that <div>:
Name:
There are several ways to display collection on a page.
Set attribute's value to a name of your Firestore collection (e.g. "projects") to display all documents from that collection.
HTML example:
Set attribute's value to a name of your Firestore collection specified with document ID (e.g. "projects/{docId}").
HTML example:
Set attribute's value to a name of your Firestore collection specified with user's uid (e.g. "users/{uid}").
HTML example:
Set attribute's value to a name of your Firestore collection specified with document ID (e.g. "projects/{project_id}").
HTML example:
To set real time listening to changes in collection, add the following custom attribute to Collection Wrapper <div>:
Name:
Value:
HTML example:
Inside of your Collection Wrapper you can create elements, which will be shown when collection has documents to show or when it is empty.
Snapshot element is shown when collection has elements to show at current filters and conditions. Snapshot nests documents inside.
To set Snapshot, add the following custom attribute to an element inside Collection Wrapper:
Name:
Value:
HTML example:
No-snapshot element is shown when collection has no elements to show at current filters and conditions. It is an empty state for your collection list.
To set No-snapshot, add the following custom attribute to an element inside Collection Wrapper:
Name:
Value:
HTML example:
Documents are shown inside of the Snapshot. To show documents, you need to create an element inside snapshot, which will serve as a template for all documents in this collection.
To setup that, add the following custom attribute to an element inside of the Snapshot.
Name:
Value:
HTML example:
You can set a filter to your Collection list.
To do that, add the following custom attribute to Collection Wrapper:
Name:
Value for the attribute should include your filter condition written in Firestore syntaxis (e.g. [['price','>',500]]).
HTML example:
You can set an order for your collection list. To do that, add the following custom attribute to your Collection Wrapper:
Name:
To set order by one field from document collection, set the attribute value to the field name in specific fromat (e.g. [['price']]).
HTML example:
To set a descending order, add that parameter in attribute's value (e.g. [['price', 'desc']]).
HTML example:
To set an order by two fields, write a condition with multiple parameters (e.g. [['price', 'asc'],['discount','desc']]).
HTML example:
Inside of a document you can display document's fields data as an inner text or HTML attributes ("src", "value", "href" etc).
To do that, set custom attributes to elements inside of the document template.
Add an attribute with the following Name:
Name:
To display data as an inner text of the element, set value to field name (e.g. "projects").
HTML example:
To display data as a HTML attribute ("src", "value", "href" etc), set value to field name and attribute name divided by "|" symbol (e.g. "picture_url|src").
HTML example:
You can add variables such as document ID ({docId}) inside of a value (e.g. "https://www.shop.com/products/{docId}|href").
HTML example:
To display data from map field, add the map field name before actual field name and divide them with "." (e.g. "name.first").
HTML example:
To display data from array field, specify array item number in attribute value (e.g. "photos[0]|src").
HTML example:
To display arrays inside of a document, first you will need to create an Array Wrapper - an element with the following custom attribute:
Name:
Set attribute's value to the name of array field in your document (e.g. "items").
Inside of the Array Wrapper, create a template item for array items by adding the following custom attribute:
Name:
Set attribute's value to the name of array item in your document and the item index (e.g. "item, idx"). This element will be copied as a template for all items in the array.
HTML example:
You can display data from array item by setting the following attribute to elements inside of the array item template:
Name:
Set attribute's value to the name of a field inside of the array item (e.g. "item").
HTML example:
In case your array object has a map structure, you can display it's data setting attribute value to the name of the map + "." + field name (e.g. "object.name").
HTML example:
Here are several important things about working with arrays within document or create from:
You can only create array items within a document create or update form.
Add the following custom attribute to the button inside of the array warapper:
Name:
Value:
HTML example:
To delete array item, you can add a delete button or link inside of the array item. It can only be done withing a document update or create form. Add the following custom attribute to this button/link:
Name:
Value:
HTML example:
You can setup forms inside of Collection Wrapper to create or update collection documents. To do that, add a from with the following custom attribute name:
Name:
Then set attribute's value as it is explained in the following paragraphs
For Create form, add the following custom attribute value to the form
Value:
Create form should be outside of the Snapshop.
HTML example:
For Update form, add the following custom attribute value to the form:
Value:
Create form should be inside of the document element.
HTML example:
To delete document, add a delete button or link inside of the document and set the following attribute to that button or link.
Name:
Value:
HTML example:
You can create "before" and "after" handlers for your form, which can be used to call functions.
To create "before" handler, add the following attribute to the form:
Name:
Set attribute's value to the name of your handler (e.g. "addCreatedDate").
To create "after" handler, add the following attribute to the form:
Name:
Set attribute's value to the name of your handler (e.g. "success").
HTML example: