# Addition of a info box

The info box is a text zone composed from a title and of a text. To create a infobox, we use `addInfoBox()`:

$variable\_name->addInfoBox($title);

$title: info box title.

To add a line in the Info box, we use addInfoBoxLine() :

```php
$variable_name->addInfoBoxLine($title, $text, $value, $color, $type);
```

* `$title` : Info box title (similar to the one used with "addInfoBox").&#x20;
* `$text` : Text to be shown in the info box.&#x20;
* `$value` : Value to appear in the text.&#x20;
* `$color` : Value color.&#x20;
* `$type` :. Values: 'default' or 'information'.&#x20;

The type 'default' uses all the parameters. It displays a text that includes the variable $value of the color 'color'.

**Example:**&#x20;

```php
$variable_name->addInfoBox("Title"); 
$variable_name->addInfoBoxLine("Title", 'Text %s and...', 'value', 'red', 'default');
```

The result:

![](/files/-LD6N2D1YifKaX5sbiT8)

The type 'information' uses only the parameters '$text'. It displays only a text.

**Example:**

```php
$variable_name->addInfoBox("Title"); 
$variable_name->addInfoBoxLine("Title", 'Text', '', '', 'information');
```

**The result:**&#x20;

![](/files/-LD6N2D3xnYE3Vacw8Dm)

To display the infos box, we use `renderInfoBox()`:

```php
$variable_name -> renderInfoBox();
```

Info boxes are automatically displayed in the pages "`index.php`" and "`about.php`" if you are using functions that handle these parts.

You can add as many lines as you want in a info box and you can put as many infos box as you wish. Those are the infos box title that can link the right lines with the correct infos box.

**Example:**&#x20;

```php
$variable_name = new ModuleAdmin(); 
$variable_name->addInfoBox("bike"); $variable_name->addInfoBox("car");
$variable_name->addInfoBoxLine("bike", 'Text1', '', '', 'information');
$variable_name->addInfoBoxLine("bike", 'Text2', '', '', 'information');
$variable_name->addInfoBoxLine("car", 'Text3', '', '', 'information'); 
echo $variable_name -> renderInfoBox();
```

**The result:**&#x20;

![](/files/-LD6N2D7UhyzEfcET-Ss)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xoops.gitbook.io/moduleadmin-tutorial/addition-of-a-info-box.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
