Download the PHP package xc/xoverridefilter without Composer

On this page you can find all versions of the php package xc/xoverridefilter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package xoverridefilter

X Override Filter

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: 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 )}
    <div>{$result}</div>
    {/if}
    <form action="" method="post">
        <div>
            Name: <input type="text" name="name" value="" />
        </div>
        <div>
            Email: <input type="text" name="email" value="" />
        </div>
        <div>
            <input type="submit" name ="SubmitButton" value='Submit' />
            <input type="submit" name ="DiscardButton" value='Discard' />
        </div>
    </form>

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 override.ini supports

  1. Class tag to identify a php class implenetation of the logic.
  2. Match[attribute_\<attribute_identifier>]=\<value> 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

Install

  1. Copy this extension under \<ezp_root>/extension
  2. If your eZ Publish is \<5.2 (e.g. 4.7), run these commands under \<ezp_root>

     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)

  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
  1. Implement template form.tpl

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

    {if is_set( $result )}
    <div>{$result}</div>
    {/if}
    <form action="" method="post">
        <div>
            {"Name:"|i8n('example')} <input type="text" name="name" value="" />
        </div>
        <div>
            {"Email:"|i18n('example')} <input type="text" name="email" value="" />
        </div>
        <div>
            <input type="submit" name ="SubmitButton" value={'Submit'|i18n( 'example' )} />
            <input type="submit" name ="DiscardButton" value={'Discard'|i18n( 'example' )} />
        </div>
    </form>
  2. Implement class myFormView

    extension/myextension/classes/myformview.php

  3. Regenerated autoload array for extension

    bin/php/ezpgenerateautoloads.php -e
  4. Clear cache before viewing the page(content/view/full/50).

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

Should

Could

Feedback?

Welcome to give any comments/suggestions.

Review it on projects.ez.no: http://projects.ez.no/xoverridefilter/reviews .

Contact me? You can reach me by share.ez.no: http://share.ez.no/community/profile/86893

Issue tracker: https://github.com/xc/xoverridefilter/issues


All versions of xoverridefilter with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xc/xoverridefilter contains the following files

Loading the files please wait ....