Global Variables
Global variables help you manage your website themes as you want. These variables are available across all your website pages. We also have variables specific to the current page, which you can see once you open the file.
We recommend using the print_r
function to see all the data you can use about single variables. Some of them are
arrays, and some of them are strings. You can use print_r
for almost everything, not just global variables.
What Is Twig Template
To understand more about Twig, please refer to HTML Editor.
Global Variables List
-
page:
- Description: Contains information about the current page.
- Contents: Array
-
user:
- Description: Contains the user data.
- Contents: Array
-
setting:
- Description: Contains the website settings.
- Contents: Array
-
navbar:
- Description: Holds the navbar elements.
- Contents: Array
-
modules:
- Description: Lists the available modules (global).
- Contents: Array
-
cart:
- Description: Represents the store cart.
- Contents: Array
-
notification:
- Description: Holds notifications for the user, if there are any.
- Contents: String
-
request_query:
- Description: Contains the query parameters from the current URL.
- Contents: Array
CDN URLs
What Are CDN URLs?
CDN (Content Delivery Network) URLs are pre-configured paths that allow you to efficiently access static resources such as images, stylesheets, scripts, and other assets. These URLs point to files hosted on a distributed network of servers, ensuring faster load times and improved scalability. By using CDN URLs, you can ensure consistent access to important resources while minimizing the load on your main server.
Why Use These URLs?
These URLs are specifically designed to provide quick and reliable access to our platform’s assets. Using the provided variables ensures that your templates always load resources from the correct paths, even if the underlying URL structure changes in the future. This approach simplifies maintenance and ensures compatibility across all your website pages.
How They Work in the Platform
The platform provides predefined CDN URLs as variables to streamline the process of accessing static resources. These variables can be used directly in your templates, making it easier to manage and maintain your assets:
-
setting.cdn.template_assets_url
This URL points to the/assets
folder specific to your website's template. It allows you to load static files such as.css
for styling,.js
for scripts, and other template-specific resources. -
setting.cdn.default_images_url
This URL provides access to the default images offered by the platform, such as maps, weapon icons, and other predefined visuals. -
setting.cdn.default_assets_url
This URL is used to load default assets provided by the platform, such as frameworks (e.g., Bootstrap), icon sets, and other globally required resources.