Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First create your Chain (include.chain.frontend.cat_businessaccess.php) and save it to /contenido/includes/chains/:

Code Block
languagephp
<?php
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
function cecFrontendCategoryBusinessAccess($name)
{
    global $cfg;
    //your code Stuff goes here
	$data =  "Your Name is:".$name;
    return $data;
}
?>

...

Code Block
languagephp
titleFile: config.chains.load.php
<?php
defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
cInclude('includes', 'chains/include.chain.frontend.cat_backendaccess.php');
cInclude('includes', 'chains/include.chain.frontend.cat_access.php');
cInclude('includes', 'chains/include.chain.content.createmetatags.php');
cInclude('includes', 'chains/include.chain.frontend.createbasehref.php');
cInclude('includes', 'chains/include.chain.content.indexarticle.php');
cInclude('includes', 'chains/include.chain.template.parsetemplate.php');
cInclude('includes', 'chains/include.chain.frontend.cat_businessaccess.php');   //here we include our new Chainfile


// get cec registry instance
$_cecRegistry = cApiCecRegistry::getInstance();
$_cecRegistry->addChainFunction('Contenido.Frontend.CategoryAccess', 'cecFrontendCategoryAccess');
$_cecRegistry->addChainFunction('Contenido.Frontend.CategoryAccess', 'cecFrontendCategoryAccess_Backend');
$_cecRegistry->addChainFunction('Contenido.Content.CreateMetatags', 'cecCreateMetatags');
$_cecRegistry->addChainFunction('Contenido.Frontend.BaseHrefGeneration', 'cecCreateBaseHref');
$_cecRegistry->addChainFunction('Contenido.Content.AfterStore', 'cecIndexArticle');
$_cecRegistry->addChainFunction('Contenido.Template.BeforeParse', 'cecParseTemplate');
$_cecRegistry->addChainFunction('Contenido.Frontend.CategoryAccess', 'cecFrontendCategoryBusinessAccess');    //here we add our Chain to the cecRegistry

...

Now our Chain is ready to use.
Here an example to use it in a Module-Code:

Code Block
languagephp
$_cecIterator = cRegistry::getCecRegistry()->getIterator('Contenido.Frontend.BusinessAccess');
if ($_cecIterator->count() > 0) {
    while (false !== $chainEntry = $_cecIterator->next()) {
        $businessName = $chainEntry->execute("Fritz Box");
    }
}

...