SimpleComponents image

The SimpleComponents module offers a range of customization features to enhance your templates. With this module, you can effortlessly create repetitive, dynamic template components and directly incorporate them into your page using PHP snippets, for example within a loop. Additionally, you have the flexibility to pass parameters to these components.

Module Description

This is a straightforward and user-friendly module for creating dynamic and reusable template elements such as cards or other containers. The template components can include code, variables, or text that can be inserted into a template to dynamically display specific template areas.

With this module, you can easily create and customize template elements to suit your needs, allowing for greater flexibility and efficiency in your template design. By leveraging the capabilities of this module, you can enhance the dynamic nature of your templates and provide a seamless user experience.

Instructions for Installing SimpleComponents Module

Download the zip file, unzip it and upload the complete folder SimpleComponents to your server in the directory site/modules/.

  1. Log in to the Scriptor editor area.
  2. Click on "Modules" in the menu.
  3. Locate the SimpleComponents module and click on the "Install" button.
  4. If the installation is successful, you should now see an additional item called Components in the navigation menu.

Usage

Follow these steps to utilize the SimpleComponents module:

  1. Open the Components menu in the Scriptor editor and create a component similar to the example below: Create Component Example

  2. To use the component in your template, access an instance of the SimpleComponents module by using the loadModule method:

    $components = $site->loadModule('SimpleComponents');
  3. Locate your component by its name. In this example, the component name is author-info:

    $component = $components->getComponent('author-info');
  4. Define the values to replace the placeholders within the component:

    $vars = [
    'TITLE' => 'George Lucas',
    'DATE' => '2023-06-22',
    'TEXT' => 'George Lucas is an acclaimed American filmmaker, known for creating Star Wars. His groundbreaking work revolutionized cinema.'
    ];
  5. Finally, output the component:

    echo $component->render($vars);

    The output should resemble the following: Component output

Minimum requirements

Compatible with Scriptor: 1.11.3 +
Author: Bigin
Last Updated: 2023-06-21
SimpleComponents: 1.5.1