ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: Jorin on September 13, 2014, 10:57:03 am

Title: Fatal error: Call to undefined function call_template_callbacks()
Post by: Jorin on September 13, 2014, 10:57:03 am
I uploaded all files from the 1.0 download folder (except Settings.php and the installation files) and now I get an fatal error where the info center should be shown:

Code: [Select]
Fatal error: Call to undefined function call_template_callbacks() in /www/htdocs/xyz/elkhilfe_support/sources/Load.php(2611) : eval()'d code on line 131

It seems like an error with my theme, cause with the default theme there's no such error. I'm investigating...

Edit: I made a new copy from default theme with the function in the admin center and then replaced the logo, the board icons and the css file. And the error is gone. Hmm, maybe look to prevent this nevertheless in case anyone has the same problem?
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: Adrek on September 13, 2014, 11:01:34 am
It is something added before 1.0.0 release.

In index.template.php find:
Code: [Select]
		'mentions' => array('mentioner_template' => '<a href="{mem_url}" class="mentionavatar">{avatar_img}{mem_name}</a>')
);
}
and replace it with:
Code: [Select]
		'mentions' => array('mentioner_template' => '<a href="{mem_url}" class="mentionavatar">{avatar_img}{mem_name}</a>')
);
}

/**
 * Simplify the use of callbacks in the templates.
 * @param string $id - A prefix for the template functions the final name
 *                     should look like:
 *                     template_{$id}_{$array[n]}
 * @param string[] $array - The array of function suffixes
 */
function call_template_callbacks($id, $array)
{
if (empty($array))
return;

foreach ($array as $callback)
{
$func = 'template_' . $id . '_' . $callback;
if (function_exists($func))
$func();
}
}

@mods: maybe move this to Support board?
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: Jorin on September 13, 2014, 11:06:11 am
Thanks, see my edit please.  :-[
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: emanuele on September 13, 2014, 01:28:26 pm
Also see:
http://www.elkarte.net/community/index.php?topic=1962.0
and in particular:
http://www.elkarte.net/community/index.php?topic=1962.msg12233#msg12233
f you changed the index.template.php and you have problems updating it feel free to attach it here, I'll check it out. ;)
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: Jorin on September 13, 2014, 01:52:18 pm
I only changed the css files and some images, that's all. But thanks for the offer. :)
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: CrimeS on September 13, 2014, 02:24:58 pm
I think that in overall there are 3 pieces of code that you would need to add, so as emanuele said things to work and for some future modifications.
Title: Re: Fatal error: Call to undefined function call_template_callbacks()
Post by: emanuele on September 13, 2014, 02:25:40 pm
Then if you changed just css and icons, replace index.template.php is perfectly safe. ;D