Making Pages Dynamic
As you probably have already noticed, there are many pages in the theme displaying data from your account. For example, the name of your space is displayed in the banner below.

To get data from your account and print it in the space website we use a special syntax. For example, to print the name of your space in the navigation bar we can do the following

The syntax "{{ ... }}" prints a piece of data coming from your account. In this case, it prints the name of the business, which is how we call spaces internally.
Each page has access to a set of data, for example, the page rendering the booking calendar has access to all the bookings made in the space and also all the events happening in the next 6 months.
It's important to remember that you can only print the data which is available to the page you are editing. For example, if you are in the contact page, the bookings data is not available and therefore you cannot render a list of bookings in the contact page (even in you wanted to!).
What data is available
As we mentioned earlier, not all data in your account is available to all pages in the space website, but there is a sub-set of this data which is available in every page. We call this "Common Data".
For every page, there is a set of data available only to that page. This is, for example, the data about the profile of a member in the member details page. We call this data "Page Specific Data"
Filters
Filters are useful when modifying data before is rendered in the screen. For example, to format dates or numbers.
You use filters after the pipe (|) symbol. For example:
These are the filters available:
Size
Return the size of an array or of a string
Slice
Return a Part of a String
Downcase
Convert a input string to DOWNCASE
Upcase
Convert a input string to UPCASE
Capitalize
Capitalize words in the input sentence
Escape
Encodes a string to be displayed in a browser
Truncate
Truncates a string down to N characters
Split
Split input string into an array of substrings separated by given pattern. Returns a list
StripHtml
Removes any HTML mark-up from a string
StripNewlines
Removes any HTML mark-up from a string
StripNewlines
Join elements of the array with a certain character between them
Sort
Sort elements of the array by a property
Map
Map/collect on a given property
Replace
Replace occurrences of a string with another
ReplaceFirst
Replace the first occurence of a string with another
Remove
Remove a substring
RemoveFirst
Remove the first occurrence of a substring
Append
Add one string to another
Prepend
Prepend a string to another
NewlineToBr
Add tags in front of all newlines in input string
Date
Formats a date using a standard date format string: https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
Get the first element of a list
First
Get the first element of a last
Plus
Adds two numbers
Minus
Substracts two numbers
Times
Multiplies two numbers
DividedBy
Divides two numbers
AddDays
Adds a number of days to a date
AddMinutes
Adds a number of minutes to a date
Clean
Returns a SLUG url from a string
Formats a string
FormatDecimal
Formats a decimal number
FormatInteger
Formats a integer number
FormatDate
Formats a date using a standard format string: https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
FormatDateString
Parses and date string and formats it using a standard format string: https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
Comments
Please sign in to leave a comment.