Skip to content

Instantly share code, notes, and snippets.

@smaida
Created September 18, 2011 13:11
Show Gist options
  • Save smaida/1225057 to your computer and use it in GitHub Desktop.
Save smaida/1225057 to your computer and use it in GitHub Desktop.
Extending the Solspace Tag Module (ExpressionEngine)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* @package VC_energy_tomorrow
* @subpackage ThirdParty
* @category Modules
* @author Shawn Maida | Alex Glover
* @link http://www.eecoder.com
*/
// Tag module is required
if (is_file(PATH_THIRD."tag/mod.tag".EXT))
{
require_once PATH_THIRD."tag/mod.tag".EXT;
class Vc_energy_tomorrow extends Tag{
var $return_data;
function Vc_energy_tomorrow()
{
$this->EE =& get_instance(); // Make a local reference to the ExpressionEngine super object
}
/**
* returns the related entries using solspace tag module
*/
function related_entries()
{
$TAG = new Tag();
if ($this->EE->input->get('entry_id', TRUE))
{
$this->EE->TMPL->tagparams['entry_id'] = $this->EE->input->get('entry_id', TRUE);
}
if ($this->EE->uri->segment('2') == "blocks" && $this->EE->uri->segment('3') != "all")
{
$this->EE->TMPL->tagparams['channel'] = $this->EE->uri->segment(3);
}
$this->return_data = $TAG->related_entries();
return $this->return_data;
}
/**
* Helper funciton for template logging
*/
function _error_log($msg)
{
$this->EE->TMPL->log_item("vc_energy_tomorrow ERROR: ".$msg);
}
}
}
/* End of file mod.vc_energy_tomorrow.php */
/* Location: ./system/expressionengine/third_party/vc_energy_tomorrow/mod.vc_energy_tomorrow.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment