ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using EE Templates in Custom Controllers Etc

November 12, 2013 4:00pm

Subscribe [1]
  • #1 / Nov 12, 2013 4:00pm

    jedvisor

    3 posts

    I’ve gotten a custom controller set up in my EE install and I’m trying to use an EE template with the custom functions etc I need to use.

    <?php if (!defined('BASEPATH')) exit('This cannot be hit directly.');
    
        class Example extends EE_Controller {
    
            function __construct() {
    
                parent::__construct();
    
                // get EE
                $this->EE = $this->core->EE;
                // get EE's template library
                $this->EE->TMPL = $this->EE->load->library('template');
            }
    
            function index() {
    
                $this->EE->TMPL = new EE_Template();
    
                //pick our template
                $this->EE->TMPL->run_template_engine('site', 'form');
            }

    This controller code successfully loads up my EE template, but I haven’t had any luck parsing the tags, or sending in values for the tags. What should I do?

    I realize I could build modules for custom code etc, but I need to allow for custom controllers for outside Kohana and Symfony code the EE install needs to make friends with.

    I tried using the $this->EE->TMPL->parse_variables() function that that didn’t seem to let me swap out the variables either.

    For example, my template has code in it like this:

    <title>{meta_title}</title>

    Any suggestions?

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases