trOnGAtE

Template Partials
What Are Partials?
Some developers like to break their page templates up into partials (sometimes referred to as 'components'). A partial is a section of code that is usually associated with a particular section or function, within a greater page template. Examples of partials could be:
- a header
- a footer
- a login area
- a top navigation bar
So, you wanna use partials huh?
Using partials is as simple as saving a view file inside your partials folder and using Trongate's in-built 'Partial' method to load your partial. For example,
​<?= Template::partial('partials/footer') ?>​
As you would expect, partials can receive, display and manipulate data that has been passed in from your calling module. This can be easily achieved by passing in a $data array as an argument. For example,
​​<?= Template::partial('partials/footer', $data) ?>​
Below is an example of a template that does not use any partials:

Here's the same template but with the footer now being called as a partial:

HELP & SUPPORT
If you have a question or a comment relating to anything you've see here, please goto the Help Bar.