[solved] {content|smileys} "Smarty error [plugin] modifier 'smileys' is not

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

[solved] {content|smileys} "Smarty error [plugin] modifier 'smileys' is not

Post by tobik »

Hi all

I use cmsms core 1.1 and the Smileys module 0.1.3.

When I insert {content|smileys} into a template everything works fine on the first page load. But on any further load the page shows an php error:

Code: Select all

string(121) "Smarty error: [in template:17 line 120]: 
[plugin] modifier 'smileys' is not implemented (core.load_plugins.php, line 124)"
Does anybody know howto work around that?

Thanks, Tobik
Last edited by tobik on Tue Aug 21, 2007 9:31 pm, edited 1 time in total.
cyberman

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implement

Post by cyberman »

tobik wrote: When I insert {content|smileys} into a template
Smileys is not a Smarty modifier

http://smarty.php.net/manual/en/language.modifiers.php

Smileys is a module you can use it with guestbook module for instance
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

Hi all, thanks for your responses.

@mark
I used textsmileys over the years on my static homepage and it would be a nice giveaway if they turn to grafic smileys in cmsms.

@cyberman
The smileys help does list this syntax {content|smileys}
And sure on the first page load the grafic smileys does appear in my text. But unluckily any reload of the page throws the error mentioned above.
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

@cyberman
Just found this code in Smileys.module.php

Code: Select all

	function SmartyPreCompile(&$content) {
		$this->smarty->register_modifier("smileys",array(&$this,"SmartyModifier"));
	}
I assume the use of smileys as modifier is correct and intended. Isn't it?
cyberman

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by cyberman »

Right - never used this option ...
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

The smileys modifier works when debug mode is active

Code: Select all

$config['debug'] = true;
IMO this is because caching is disabled in debug mode. The pages will be compiled on any request.

Does this make sense? Maybe this is a bug in the core rather then in Smileys module?
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

Sorry, I am not a native english speaker. I mean it would be a nice free special.

It is not really important. I played around just for interest.
Thought it could be helpful for somebody who better know this stuff...  ;)
Last edited by tobik on Tue Aug 21, 2007 6:35 pm, edited 1 time in total.
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

Re: {content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

Is this a valid solution? At least it works for me.

1. Insert a file named modifier.smileys.php into the plugins directory.

Code: Select all

<?php
/**
 * Smarty plugin
 * ----------------------------------------------------------------
 * Type:     modifier
 * Name:     smileys
 * Purpose:  replace any text smileys with <img> links to smiley icons
 * Author:   TOBIK
 * ----------------------------------------------------------------
 **/
function smarty_cms_modifier_smileys($string)
{
	// Get access to the smileys module
	$smileys = CMSModule::GetModuleInstance("Smileys");
	if ($smileys != false) 
	{
		// replace text smileys with images 
		$string = $smileys->ReplaceSmileys($string);
	} 
	
	return $string;    
}//end of function
?>

2. Change this in /modules/Smileys/Smileys.module.php

Code: Select all

	...
	function SmartyPreCompile(&$content) {
		// this is now handled by /plugins/modifier.smileys.php
		// $this->smarty->register_modifier("smileys",array(&$this,"SmartyModifier"));
	}
	...
Don't forget to empty the cache in Site Admin > Global Settings

Regards, Tobik
tobik
Translator
Translator
Posts: 149
Joined: Thu Aug 16, 2007 6:18 pm

{content|smileys} "Smarty error [plugin] modifier 'smileys' is not implemented"

Post by tobik »

This is a explanation as I understand this issue.

On first page load the Smiley module registers the modifier in Smarty.

Code: Select all

function SmartyPreCompile(&$content) {
		$this->smarty->register_modifier("smileys",array(&[u]$this[/u],"SmartyModifier"));
	}
A reference to this instance of Smileys modules class is registered. The lifetime of the instance ends when the request is finished but the compiled page is kept in cache.

On the next page load the old Smileys module class instance is gone but no new modifier registration is performed until the cache is emptied. The old reference to the gone Smileys class instance throws the error.

That make sense?
Tobik
cyberman

Re: [solved] {content|smileys} "Smarty error [plugin] modifier 'smileys' is not

Post by cyberman »

Thanks for that solution ...
Post Reply

Return to “CMSMS Core”