Welcome Guest, Not a member yet? Register   Sign In
xsl templates
#2

[eluser]St0neyx[/eluser]
Got it working now, but not sure if it´s the CI way.

added in config.php:
Code:
$templatePath = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']);
$config['template_path'] = $templatePath.'templates/';

added in url_helper:
Code:
if ( ! function_exists('template_path'))
{
    function template_path()
    {
        $CI =& get_instance();
        return $CI->config->slash_item('template_path');
    }
}

and the controller:
Code:
// returns xml for content
$contentXml = $this->get->content();

// get path to template
$template = template_path().'index.xsl';

// parse template from xsl with the xml
$data->content = $this->xslparser->init($contentXml, $template);

// output the template
$this->load->view('templates/index.tpl.php', $data);

I'm open to suggestions if this isn't the way to go.


Messages In This Thread
xsl templates - by El Forum - 04-29-2010, 08:55 AM
xsl templates - by El Forum - 05-03-2010, 01:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB