Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Created October 20, 2016 12:21
Show Gist options
  • Save MikSDigital/5cfedec94dc64df41107cc71ca2c230f to your computer and use it in GitHub Desktop.
Save MikSDigital/5cfedec94dc64df41107cc71ca2c230f to your computer and use it in GitHub Desktop.
get_canonical OOP
<?php
return;
error_reporting(E_ALL);
ini_set('display_errors', 1);
class Canonical
{
public $modx = null;
public $resourseId;
public $contextKey;
public $test;
function __construct(modx &$modx)
{
$this->modx = & $modx;
$this->resourseId = $this->modx->resource->get('id');
$this->contextKey = $this->modx->context->get('key');
$this->test = 'test string';
}
}
$link = new Canonical($modx);
echo $link->contextKey;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment