Page 1 of 1

Core: An Error has occured. Unable to load template ...

Posted: Thu Dec 21, 2017 5:47 pm
by pWorker
Hi all,

every then and now i get a cascade of a weird core error event.
Everything begins with these lines in the admin-log:

Code: Select all

Core	Missing Template: NEWS-Meldungen-Loader'	21.12.2017 14:38:30

An error has occurred	Unable to load template cms_template 'NEWS-Meldungen-Loader'' in 'module_db_tpl:CGUserDirectory;detail_SampleTwo'

...in the middle of this "process" it`s said:

Code: Select all

An error has occurred	Unable to load template cms_template 'NEWS-Meldungen-Loader1111111111111" UNION SELECT CHAR(45,120,49,45,81,45),CHAR(45,120,50,45,81,45),CHAR(45,120,51,45,81,45),CHAR(45,120,52,45,81,45),CHAR(45,	20.12.2017 16:43:05
An error has occurred	Unable to load template cms_template 'NEWS-Meldungen-Loader1111111111111" UNION SELECT CHAR(45,120,49,45,81,45),CHAR(45,120,50,45,81,45),CHAR(45,120,51,45,81,45),CHAR(45,120,52,45,81,45),CHAR(45,	20.12.2017 16:43:05
An error has occurred	Unable to load template cms_template 'NEWS-Meldungen-Loader1111111111111" UNION SELECT CHAR(45,120,49,45,81,45),CHAR(45,120,50,45,81,45),CHAR(45,120,51,45,81,45),CHAR(45,120,52,45,81,45),CHAR(45,	20.12.2017 16:43:04


...and it ends (this time) with:

Code: Select all

An error has occurred	Unable to load template cms_template 'NEWS-Meldungen-Loader99999" union select unhex(hex(version())) -- "x"="x' in 'module_db_tpl:CGUserDirectory;detail_SampleTwo'	21.12.2017 15:08:29

Core	Missing Template: NEWS-Meldungen-Loader99999" union select unhex(hex(version())) -- "x"="x	21.12.2017 15:08:29
The lines where i call this news-module-template are :

CGUserDirectory;detail_SampleTwo:

Code: Select all

<div id="wrapper_one">
{news summarytemplate="NEWS-Meldungen-Loader" category="Rubrik*" user_company_name=$OperatorActive|default:'' pagelimit=3}
</div>
The "user_company_name"-tag is a plugin that allows loading news filtered by company_names.

...before those lines there a these as javascript (to ajax load news for a specific company in triplets):

Code: Select all

{jsmin}
<__script__ type="text/javascript">
 
$(document).ready(function() {

bindButtonClick();

$.ajax({
    url: "/index.php?mact=News,me0608,default,1&me0608category=Rubrik*&me0608returnid=75&page=75&showtemplate=false", 
    type: "GET", 
async:true,
    success: function(data) {
var sourcecodeOne = $(data).find("#wrapper_one").html(); 
$("#persnewsloader").empty(); 
$("#persnewsloader").append(sourcecodeOne); 
$(".meldungen-box-content").trunk8({  lines: 8 });
bindButtonClick();
}
});

function bindButtonClick(){

$('.article-nav').on('click', 'a', function(e) {
    e.preventDefault();

var link = $(this).attr("href");
var rellink = link.replace("http://www.nameofmywebsite.de", "");
var ajaxlink = rellink.replace("returnid=3&page=3", "returnid=75&page=75");

$.ajax({
    url: ajaxlink, 
    type: "GET", 
async:true,
    success: function(data) {

var sourcecodeOne = $(data).find("#wrapper_one").html(); 
$("#persnewsloader").empty(); 
$("#persnewsloader").append(sourcecodeOne); 
$(".meldungen-box-content").trunk8({  lines: 8 });
bindButtonClick();
}
});
});
}
});
</__script>
{/jsmin}

{foreach from=$oneuser.properties item='onepropvalue' key='propname'}
  
 {if $properties.$propname.type == 6}

    {capture assign=$propname} <img src="{$file_location}/{$onepropvalue}"/>{/capture}       
    {elseif isset($properties.$propname.opts)}
    {capture assign=$propname} {$properties.$propname.opts.$onepropvalue}{/capture}
    {else}
    {capture assign=$propname}  {$onepropvalue}{/capture}

 {/if}

{/foreach}

{session_put var=OperatorActive value=$firmenname}
{$OperatorActive=$smarty.session.OperatorActive|default:''}

So, has anyone an idea why i get such error messages? Is it caused by set the Session war after ajax loading it in the document ready function? Or is it the variable self which contains special chars which are transcoded in a wrong way?


THX in advance

Re: Core: An Error has occured. Unable to load template ...

Posted: Fri Dec 22, 2017 5:59 am
by rotezecke
Could it be that your template name includes an unwanted apostrophe? I looks like you are calling a template named NEWS-Meldungen-Loader' .
Unable to load template cms_template 'NEWS-Meldungen-Loader''
[edit]
or, the dashes in the template name? try renaming with underscores.

Re: Core: An Error has occured. Unable to load template ...

Posted: Fri Dec 22, 2017 10:35 am
by pWorker
Hey,

thx for your response. Well i`m actually using about 30 News-templates, all are named likely the same way, so it can`t be the - in the template name. I think the OperatorActive variable is set wrong and leads to an extra ' by the module call. But how can i prevent that?

Re: Core: An Error has occured. Unable to load template ...

Posted: Fri Dec 22, 2017 9:49 pm
by rotezecke
does it work when you hard-code the user_company_name setting in the {news} call? if so, how about extra curly brackets/quotes:

Code: Select all

{news summarytemplate="NEWS-Meldungen-Loader" category="Rubrik*" user_company_name="{$OperatorActive|default:''}" pagelimit=3}

Re: Core: An Error has occured. Unable to load template ...

Posted: Sat Dec 23, 2017 9:50 am
by pWorker
Hey,

before i could try your solution, i checked the admin log.

Code: Select all

An error has occurred	Unable to load template cms_template 'NEWS-Meldungen'' in 'content:content_en'	23.12.2017 07:13:15
Core	Missing Template: NEWS-Meldungen'	23.12.2017 07:13:15
Now it`s another template file in another section... In the db the templates have correct names.