PHPackages                             dd/evolutioncms-snippets-ddgetparentid - 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. dd/evolutioncms-snippets-ddgetparentid

ActiveModxevo-snippet

dd/evolutioncms-snippets-ddgetparentid
======================================

Gets document parent ID(s) of the required level.

1.4.0(2y ago)02PHPPHP &gt;=5.6.0

Since Feb 12Pushed 1y ago2 watchersCompare

[ Source](https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetParentId)[ Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetparentid)[ Docs](https://code.divandesign.ru/modx/ddgetparentid)[ RSS](/packages/dd-evolutioncms-snippets-ddgetparentid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

(MODX)EvolutionCMS.snippets.ddGetParentId
=========================================

[](#modxevolutioncmssnippetsddgetparentid)

Gets document parent ID(s) of the required level.

Requires
--------

[](#requires)

- PHP &gt;= 5.6
- [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) &gt;= 1.1
- [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.ru/modx/ddtools) &gt;= 0.60

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

[](#installation)

### Using [(MODX)EvolutionCMS.libraries.ddInstaller](https://github.com/DivanDesign/EvolutionCMS.libraries.ddInstaller)

[](#using-modxevolutioncmslibrariesddinstaller)

Just run the following PHP code in your sources or [Console](https://github.com/vanchelo/MODX-Evolution-Ajax-Console):

```
//Include (MODX)EvolutionCMS.libraries.ddInstaller
require_once(
	$modx->getConfig('base_path') .
	'assets/libs/ddInstaller/require.php'
);

//Install (MODX)EvolutionCMS.snippets.ddGetParentId
\DDInstaller::install([
	'url' => 'https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetParentId',
	'type' => 'snippet'
]);
```

- If `ddGetParentId` is not exist on your site, `ddInstaller` will just install it.
- If `ddGetParentId` is already exist on your site, `ddInstaller` will check it version and update it if needed.

### Manually

[](#manually)

#### 1. Elements → Snippets: Create a new snippet with the following data

[](#1-elements--snippets-create-a-new-snippet-with-the-following-data)

1. Snippet name: `ddGetParentId`.
2. Description: `1.4 Gets document parent ID(s) of the required level.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetParentId_snippet.php` file from the archive.

#### 2. Elements → Manage Files

[](#2-elements--manage-files)

1. Create a new folder `assets/snippets/ddGetParentId/`.
2. Extract the archive to the folder (except `ddGetParentId_snippet.php`).

Parameters description
----------------------

[](#parameters-description)

- `id`

    - Desctription: Document Id.
    - Valid values: `integer`
    - Default value: `[*id*]` (current document)
- `level`

    - Desctription: Parent level.
    - Valid values:
        - `1` — the immediate parent
        - `2` — the parent of the immediate parent
        - `-1` — the last parent
        - `-2` — the parent before the last
        - `integer` — etc
    - Default value: `1`
- `result_itemsNumber`

    - Desctription: The number of parents that will be returned.
    - Valid values:
        - `integer`
        - `'all'`
    - Default value: `1`
- `result_itemTpl`

    - Desctription: Template for output.
        Empty items after parsing the template will be ignored (you can calling third-party snippets in the template and set your own display conditions).
        Available placeholders:
        - `[+id+]` — Parent ID.
    - Valid values:
        - `stringChunkName`
        - `string` — use inline templates starting with `@CODE:`
    - Default value: `'@CODE:[+id+]'`
- `result_itemsGlue`

    - Desctription: The string that combines items while rendering.
    - Valid values: `string`
    - Default value: `''`
- `result_toPlaceholder`

    - Desctription: Returns value to the placeholder.
    - Valid values:
        - `0`
        - `1`
    - Default value: `0`
- `result_toPlaceholder_name`

    - Desctription: Placeholder name.
    - Valid values: `string`
    - Default value: `'ddParent'`

Examples
--------

[](#examples)

### Run the snippet through `\DDTools\Snippet::runSnippet` without DB and eval

[](#run-the-snippet-through-ddtoolssnippetrunsnippet-without-db-and-eval)

```
//Include (MODX)EvolutionCMS.libraries.ddTools
require_once(
	$modx->getConfig('base_path') .
	'assets/libs/ddTools/modx.ddtools.class.php'
);

//Run (MODX)EvolutionCMS.snippets.ddGetParentId
\DDTools\Snippet::runSnippet([
	'name' => 'ddGetParentId',
	'params' => [
		'level' => -1
	]
]);
```

Links
-----

[](#links)

- [Home page](https://code.divandesign.ru/modx/ddgetparentid)
- [Telegram chat](https://t.me/dd_code)
- [Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddgetparentid)
- [GitHub](https://github.com/DivanDesign/EvolutionCMS.snippets.ddGetParentId)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~433 days

Total

4

Last Release

979d ago

PHP version history (2 changes)1.3PHP &gt;=5.4.0

1.4.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/09b81986267e62b5fde1473b40aa6f11f7bc26c1c29d5f80f2768c8788e08110?d=identicon)[dd](/maintainers/dd)

---

Top Contributors

[![Ronef](https://avatars.githubusercontent.com/u/1333424?v=4)](https://github.com/Ronef "Ronef (33 commits)")

---

Tags

modxMODX Evoevoevolution-cmsmodx evolutionevo cmsddgetparentid

### Embed Badge

![Health badge](/badges/dd-evolutioncms-snippets-ddgetparentid/health.svg)

```
[![Health](https://phpackages.com/badges/dd-evolutioncms-snippets-ddgetparentid/health.svg)](https://phpackages.com/packages/dd-evolutioncms-snippets-ddgetparentid)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
