Remove remaining mentions of $a->argc/argv
- This was breaking the layout of specific pages in Frio
This commit is contained in:
parent
64d6df659d
commit
37a30434bb
4 changed files with 37 additions and 36 deletions
|
@ -158,13 +158,13 @@ Addons may also act as "modules" and intercept all page requests for a given URL
|
|||
In order for a addon to act as a module it needs to declare an empty function `<addon>_module()`.
|
||||
|
||||
If this function exists, you will now receive all page requests for `https://my.web.site/<addon>` - with any number of URL components as additional arguments.
|
||||
These are parsed into an array $a->argv, with a corresponding $a->argc indicating the number of URL components.
|
||||
So `https://my.web.site/addon/arg1/arg2` would look for a module named "addon" and pass its module functions the $a App structure (which is available to many components).
|
||||
This will include:
|
||||
|
||||
These are parsed into the `App\Arguments` object.
|
||||
So `https://my.web.site/addon/arg1/arg2` would give this:
|
||||
```php
|
||||
$a->argc = 3
|
||||
$a->argv = array(0 => 'addon', 1 => 'arg1', 2 => 'arg2');
|
||||
DI::args()->getArgc(); // = 3
|
||||
DI::args()->get(0); // = 'addon'
|
||||
DI::args()->get(1); // = 'arg1'
|
||||
DI::args()->get(2); // = 'arg2'
|
||||
```
|
||||
|
||||
To display a module page, you need to declare the function `<addon>_content(App $a)`, which defines and returns the page body content.
|
||||
|
|
|
@ -61,11 +61,14 @@ Addons können auch als "Module" agieren und alle Seitenanfragen für eine besti
|
|||
Um ein Addon als Modul zu nutzen, ist es nötig, die Funktion "addon_name_module()" zu definieren, die keine Argumente benötigt und nichts weiter machen muss.
|
||||
|
||||
Wenn diese Funktion existiert, wirst du nun alle Seitenanfragen für "http://example.com/addon_name" erhalten - mit allen URL-Komponenten als zusätzliche Argumente.
|
||||
Diese werden in ein Array $a->argv geparst und stimmen mit $a->argc überein, wobei sie die Anzahl der URL-Komponenten abbilden.
|
||||
So würde http://example.com/addon/arg1/arg2 nach einem Modul "addon" suchen und seiner Modulfunktion die $a-App-Strukur übergeben (dies ist für viele Komponenten verfügbar). Das umfasst:
|
||||
|
||||
$a->argc = 3
|
||||
$a->argv = array(0 => 'addon', 1 => 'arg1', 2 => 'arg2');
|
||||
Diese werden in das App\Arguments Objekt geparst.
|
||||
So würde `http://example.com/addon/arg1/arg2` dies ergeben:
|
||||
```php
|
||||
DI::args()->getArgc(); // = 3
|
||||
DI::args()->get(0); // = 'addon'
|
||||
DI::args()->get(1); // = 'arg1'
|
||||
DI::args()->get(2); // = 'arg2'
|
||||
```
|
||||
|
||||
Deine Modulfunktionen umfassen oft die Funktion addon_name_content(App $a), welche den Seiteninhalt definiert und zurückgibt.
|
||||
Sie können auch addon_name_post(App $a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue