Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

SiteCatalyst Advanced

Philip Lawrence edited this page Oct 8, 2012 · 1 revision

Adobe SiteCatalyst Yii Extension

This covers advanced usage for the Adobe SiteCatalyst Yii Extension

Getting / Setting configuration within controllers / views

In the event that you need to change or grab the value of a setting, you can do so by calling the setting method.

<?php
// Grab the s_account variable
$s_account = Yii::app()->siteCatalyst->setting('s_account');

// Change the s_account variable
$s_account = array('foo', 'bar');
Yii::app()->siteCatalyst->setting('s_account', $s_account);

Multiple SiteCatalyst instances

There are times when you need to have multiple Adobe SiteCatalyst instances on a site. Usually the variables do not line up, different report suite names, etc. Because of this, we should create a separate instance of the SiteCatalyst component in the config files.

In a normal setup, you'd see something like the following in /protected/configs/main.php:

'siteCatalyst' => array(
    'class' => 'ext.TPSiteCatalyst.components.TPSiteCatalyst',
    'rsids' => array(
                    'devsuite1',
                    'devsuite2',
               ),
),

However in this case, we'd need 2 of these. This creates a problem though - the names of the components are the same and thus the later one would overwrite the first one. Instead, different component names should be created. It is suggested to use something like the vendor's name (if you're using a 3rd party agency) or an internal identifier for that Adobe SiteCatalyst instance. Let's say we're using TagPla.net as an analytics vendor and an in-house solution as the other. We'll call one instance tpSiteCatalyst for the TagPla.net isntance and the other intSiteCatalyst for the internal (or in-house) instance. The configuration will now look like the following:

'tpSiteCatalyst' => array(
    'class' => 'ext.TPSiteCatalyst.components.TPSiteCatalyst',
    'rsids' => array(
                    'tpsuite1',
                    'tpsuite2',
                    'tpsuite3',
               ),
    's_codeLocation' => '//foo.bar.com/js/tagplanet/s_code.js',
),
'intSiteCatalyst' => array(
    'class' => 'ext.TPSiteCatalyst.components.TPSiteCatalyst',
    'rsids' => array(
                    'intdevglobal',
                    'intdevus',
               ),
    's_codeLocation' => '//foo.bar.com/js/s_code.js',
),

If you should enable autoRender, remember to change the component names:

<?php

protected function beforeRender($view)
{
    $return = parent::beforeRender($view);
    Yii::app()->tpSiteCatalyst->render();
    Yii::app()->intSiteCatalyst->render();
    return $return;
}

Then later on in your controller/view, you could then call the following to set a variable like normal:

Yii::app()->tpSiteCatalyst->prop1 = $someVar;
Yii::app()->intSiteCatalyst->prop45 = $someVar;