PHPackages                             xc/xoverridefilter - 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. [Templating &amp; Views](/categories/templating)
4. /
5. xc/xoverridefilter

ActiveEzpublish-legacy-extension[Templating &amp; Views](/categories/templating)

xc/xoverridefilter
==================

X Override Filter is a simple but useful extension for eZ Publish legacy, allowing configuring eZ Publish business logic together with template in override.ini

1.0.0-beta1(12y ago)271GPL-2.0PHP

Since Jul 26Pushed 12y ago2 watchersCompare

[ Source](https://github.com/xc/xoverridefilter)[ Packagist](https://packagist.org/packages/xc/xoverridefilter)[ Docs](https://github.com/xc/xoverridefilter)[ RSS](/packages/xc-xoverridefilter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

X Override Filter
=================

[](#x-override-filter)

Introduction
------------

[](#introduction)

With this simple extension, you can define your business logic(a php class) with template override in override.ini, so business logic can be **easily and clearly** done in a pure php class instead of custom operator, complicated templating, or datatype.

The initial idea came from pull request: [ezsystems/ezpublish-legacy#694](https://github.com/ezsystems/ezpublish-legacy/pull/694) which is in eZ Publish 5.2 automatically.

Small example:

Definition in override.ini

```
[myform_view]
Source=node/view/full.tpl
MatchFile=myform.tpl
Subdir=templates
Match[class_identifier]=myform
#Class is new :)
Class=myFormView

```

Implement template form.tpl

```
    {if is_set( $result )}
    {$result}
    {/if}

            Name:

            Email:

```

Implement class myFormView

```
class myFormView implements xNodeviewRender
{
  function initNodeview( $module, $node, $tpl, $viewMode )
  {
      $tpl->setVariable( 'cache_ttl', 0 );

      $http = eZHTTPTool::instance();
      if( $http->hasVariable( 'SubmitButton' ) )
      {
         // Show result if the form submit
         $name = $http->variable( 'name' );
         $email = $http->variable( 'email' );
         $tpl->setVariable( 'result', ezpI18n::tr( 'example', "You inputed Name: %1, Email %2", '', array( $name, $email )  ) );
      }
      else if( $http->hasVariable( 'DiscardButton' ) )
      {
         // Redirect to homepage if the form is discarded.
         $module->redirectTo( '/' );
      }
  }
}

```

Enhanced override.ini
---------------------

[](#enhanced-overrideini)

Enhanced override.ini supports

1. Class tag to identify a php class implenetation of the logic.
2. Match\[attribute\_&lt;attribute\_identifier&gt;\]=&lt;value&gt; to better filter template.
3. Match\[node\], Match\[class\_identifer\], Match\[viewmode\] for view logic conditions

The 3 above can be combined with existing template override.

Requirements
------------

[](#requirements)

- For eZ Publish 5.2: it works well
- For eZ Publish 4.2 - 5.1: it needs a kernel patch(not an unauthorized hack, but a feature backport). see doc/patches/event-pre\_rending-\*.diff

Install
-------

[](#install)

1. Copy this extension under &lt;ezp\_root&gt;/extension
2. If your eZ Publish is &lt;5.2 (e.g. 4.7), run these commands under &lt;ezp\_root&gt;

    ```
      cp extension/xoverridefilter/doc/patches/event-pre_rending-4.5-4.7.diff ./
      patch -p0 < event-pre_rending-4.5-4.7.diff --dry-run
      patch -p0 < event-pre_rending-4.5-4.7.diff

    ```

    P.S. For community versioning, 4.5-4.7 = community 2011.5-2012.5
3. Activate extension xoverridefilter
4. Clear ini cache
5. Regenerate autoload array

Example(See doc/example for code)
---------------------------------

[](#examplesee-docexample-for-code)

1. Configure condition and class under myextension

    **Scenario 1 - Custom view logic**

    extension/myextension/settings/override.ini.append.php.

    ```
     [myform_view]
     Match[class_identifier]=myform
     Class=myFormView

    ```

    The configuration above means that ‘myform’ objects will use myFormView for view logic. Form templates can be defined in additional template override rules.

    **Scenario 2 - Custom view logic with custom template**. You can also combine view logic with template override in one override rule.

    ```
     [myform_view_2]
     Source=node/view/full.tpl
     MatchFile=form.tpl
     Subdir=templates
     Match[class_identifier]=myform
     #Condition section_identifier will be ignored by custom view logic.
     Match[section_identifier]=standard
     Class=myFormView

    ```

    The configuration above means that, 'myform' objects under Standard section will use class myFormView as view logic and form.tpl as template; while 'myform' objects under other sections will use myFormView as view logic and full.tpl(if no other override rule applies) as template.

**Scenario 3 - Use attribute for override match. It's better to use this instead of node\_id**. For example:

```
  [article_breaking-news_full]
  Source=node/view/full.tpl
  MatchFile=break-news.tpl
  Subdir=templates
  Match[attribute_article_identifier]=breaking-news
  Match[class_identifier]=article

  [article_campaign_full]
  Source=node/view/full.tpl
  MatchFile=campaign.tpl
  Subdir=templates
  Match[attribute_article_identifier]=campaign
  Match[class_identifier]=article

```

2. Implement template form.tpl

    extension/myextension/design/standard/override/templates/form.tpl

    ```
     {if is_set( $result )}
     {$result}
     {/if}

             {"Name:"|i8n('example')}

             {"Email:"|i18n('example')}

    ```
3. Implement class myFormView

    extension/myextension/classes/myformview.php

    ```

    ```
4. Regenerated autoload array for extension bin/php/ezpgenerateautoloads.php -e
5. Clear cache before viewing the page(content/view/full/50).

FAQ
---

[](#faq)

1. Is the business logic inside view cache?

    Yes, for first visit eZ will invoke the business logic and generate view cache, for second visit it may skip business logic and load view cache only if the view cache keys are not changed.

    Because of that, for high dynamic page(like form), it's recommanded to disable view cache from php:

    ```
      public function initNodeview( $module, $node, $tpl, $viewMode )
      {
          $tpl->setVariable( 'cache_ttl', 0 );

    ```

Roadmap
-------

[](#roadmap)

Should

- Support override rules hierarchy

Could

- Control cache via persistant variable/cache block keys

Feedback?
---------

[](#feedback)

Welcome to give any comments/suggestions.

Review it on projects.ez.no:  .

Contact me? You can reach me by share.ez.no:

Issue tracker:

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

4722d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/289657?v=4)[Chen Xiongjie](/maintainers/xc)[@xc](https://github.com/xc)

---

Top Contributors

[![xc](https://avatars.githubusercontent.com/u/289657?v=4)](https://github.com/xc "xc (62 commits)")

### Embed Badge

![Health badge](/badges/xc-xoverridefilter/health.svg)

```
[![Health](https://phpackages.com/badges/xc-xoverridefilter/health.svg)](https://phpackages.com/packages/xc-xoverridefilter)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[netgen/ngsymfonytools

Netgen Symfony Tools is an eZ Publish 4 extension that provides a way to include Twig templates, as well as running Symfony sub-requests, directly from the eZ Publish legacy templates.

19250.4k10](/packages/netgen-ngsymfonytools)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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