PHPackages                             yawik/landingpages - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yawik/landingpages

AbandonedArchivedYawik-module[Utility &amp; Helpers](/categories/utility)

yawik/landingpages
==================

Create Landingpages for job searches to optimize SEO

v0.3.0(5y ago)0175[6 PRs](https://github.com/yawik/landingpages/pulls)MITPHP

Since Apr 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yawik/landingpages)[ Packagist](https://packagist.org/packages/yawik/landingpages)[ RSS](/packages/yawik-landingpages/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (11)Versions (12)Used By (0)

YAWIK Landingpages
==================

[](#yawik-landingpages)

Create landingpages for job searches

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
    - [Configuration](#configuration)
        - [Example configuration](#example-configuration)
    - [Rendering](#rendering)
        - [Landingpages helper](#landingpages-helper)
        - [Landingpage helper](#landingpage-helper)
- [License](#license)

Overview
--------

[](#overview)

- Configurable landing page url
- Group landing pages in categories at any depth
- Combine categories or landing pages dynamically; Either via configuration or the view helpers
- Convenient view helper to display links to landing pages

Installation
------------

[](#installation)

To use as yawik module, you need to require it in your YAWIK project:

```
composer require yawik/landingpages
```

To contribute, you need to clone the repository:

```
git clone git@github.com:yawik/landingpages.git
cd landingpages
composer install
```

Start a local webserver with:

```
php -S localhost:8000 -t test/sandbox/public test/sandbox/public/router.php
```

or

```
composer serve
```

you should be able to access your yawik at

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Copy `config/landingpages.config.local.php.dist` to your autoload directory and rename to `landingpages.config.local.php`.

In this file you can configure the route and the landing pages and categories

```
$route = '/landingpage/%slug%';
```

- This route is a child route of the "lang" route (prefixed always with "/", e.g.: "/en/")
- The string "%slug%" must be in the definition - this will be replaced by the landing page slug (see below)
- The route must not contain "--" (two dashes) - this is used to indicate combined categories

```
$landingpages = [];
```

Here you configure the categories, landing pages and combined items as nested arrays. The array keys are the slugs of the items - they must be unique, even in nested arrays.

There are three "types" of items

- categories:
    - have the array key 'items', which value is an array of slug =&gt; item
    - may have the array key 'text', which value is used as the display name
- landing pages:
    - have the array key 'query', which is an array where you specify the values of the search form fields:
        - 'q' : Search text
        - 'l' : Location
        - 'd' : Distance
    - may have the array key 'params', which is an array of additional route parameters injected to the RouteMatch object.
    - may have the array key 'text', which value is used as the display name
- combined items:
    - have the array key 'combine', which value is an array of slugs. These slugs need to be defined in the configuration array.
    - may have the array key 'glue', which value is used as concatenation string between the display names of the combined items.
    - may have the array key 'text', which value us used as the display name.

#### Example configuration

[](#example-configuration)

```

```

- `$slug` is either a string corresponding to a slug defined in the configuration or an array of slugs. In the latter case the resulting category entity which is passed to the `$partial` is the combination of all slugs. You may specify the glue to use with an array entry with the key 'glue'.
- `$partial` is the name of the view partial used to render the links. At the moment, only one partial is provided by this module, which is used as the default:
    [landingpages/button](./view/partial/buttons.phtml)
- `$values` is an array of variable name =&gt; value pairs to be injected in the view partial.
    The category entity is passed as the key 'category'.

#### Landingpage helper

[](#landingpage-helper)

```

```

- returns `null` if currently no landingpage route is invoked.
- Acts as proxy to the [landing page entity](./src/Entity/Landingpage.php)
- Provides the method `isCombined()` to quickly check, if the current landingpage is a combination of multiple slugs.

**Examples**

```
