Dr.CustUmz
05-02-2016, 07:47 PM
I created a plugin to fetch a template and append it to a custom template hook, the problem is the page renders it with escapes which cause it to not function.
this is my plugin:
<plugin active="1" executionorder="5">
<title>parse templates</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[
$template_hook['drc_foot'] .= fetch_template('drc_tst');
]]></phpcode>
</plugin>
and the template:
<template name="drc_tst" templatetype="template" date="0" username="DrCustUmz" version="1.0"><![CDATA[
<script type="text/javascript" src="test.js"></script>
]]></template>
the page renders this as:
<!-- BEGIN TEMPLATE: drc_tst -->
<script type=\"text/javascript\" src=\"test.js\"></script>
<!-- END TEMPLATE: drc_tst -->
how can I make it render the way it is in the template? without all the extra \\\\\ (escapes)
--------------- Added 1462226052 at 1462226052 ---------------
I seemed to have made it work by evaling the template as a variable before appending it, Im not sure this is the best way to go about this all I know is it worked. Any comments?
eval('$drctst = "' . fetch_template('drc_tst') . '";');
$template_hook['drc_foot'] .= $drctst;
this is my plugin:
<plugin active="1" executionorder="5">
<title>parse templates</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[
$template_hook['drc_foot'] .= fetch_template('drc_tst');
]]></phpcode>
</plugin>
and the template:
<template name="drc_tst" templatetype="template" date="0" username="DrCustUmz" version="1.0"><![CDATA[
<script type="text/javascript" src="test.js"></script>
]]></template>
the page renders this as:
<!-- BEGIN TEMPLATE: drc_tst -->
<script type=\"text/javascript\" src=\"test.js\"></script>
<!-- END TEMPLATE: drc_tst -->
how can I make it render the way it is in the template? without all the extra \\\\\ (escapes)
--------------- Added 1462226052 at 1462226052 ---------------
I seemed to have made it work by evaling the template as a variable before appending it, Im not sure this is the best way to go about this all I know is it worked. Any comments?
eval('$drctst = "' . fetch_template('drc_tst') . '";');
$template_hook['drc_foot'] .= $drctst;