Page 1 of 2
Comment search
Posted: Tue Jan 31, 2012 9:46 am
by yellowled
A user asked me to implement support for comment search in 2k11. "Great, it's got a tpl file.", I thought. However, it seems I can not use my @serendipity_smarty_html5time modifier which I create in config.inc.php:
Code: Select all
function serendipity_smarty_html5time($timestamp) { return date("c", $timestamp); }
$serendipity['smarty']->register_modifier('serendipity_smarty_html5time', 'serendipity_smarty_html5time');
Using this in the plugin's tpl file breaks, well, everything. entries.tpl reports "No entries to print", comment search doesn't find anything. I positively tracked this back to my custom modifier.
Any ideas?
YL
Re: Comment search
Posted: Tue Jan 31, 2012 10:09 am
by garvinhicking
Hi!
What does the .tpl look like? Are you sure the only thing you change is removing a "|@serendipity_smarty_html5time" and nothing else?
I don't see how this should affect things. You're testing on s9y 1.7 I guess? Do you have a chance to test it in a 1.6 (Smarty2) environment? This would allow to check whether Smarty3 is the cause of this (in which case I would need Ians Help

)
Regards,
Garvin
Re: Comment search
Posted: Tue Jan 31, 2012 10:57 am
by Timbalu
<ironic.mode.on>
Stop blaming Smarty3, Garvin! I must really wonder... you don't seem to like it very much....
</i.m.end>
I also can't really see how this should effect things..., but YL, do you remember the thread where I only was able to use 2k11 as default, when that modifier fnc moved to core? I am not sure if that might be the case with your issue and can't really remember why this was the only way to get this to work....
So Garvins suggestion testing with 1.6 is good. Afterwards you might try and use
A. remove the array modifier @
B. change name - functionname or v.v.
Code: Select all
$serendipity['smarty']->register_modifier('s9y_smarty_html5time', 'serendipity_smarty_html5time');
C. use smarty3 syntax testwise
Code: Select all
$serendipity['smarty']->registerPlugin('modifier', 's9y_smarty_html5time', 'serendipity_smarty_html5time');
Re: Comment search
Posted: Tue Jan 31, 2012 10:59 am
by yellowled
garvinhicking wrote:Are you sure the only thing you change is removing a "|@serendipity_smarty_html5time" and nothing else?
Pretty much, yes. I don't have the .tpl file on this machine right now, but I did test about everything, and this is the only thing producing this behaviour.
garvinhicking wrote:You're testing on s9y 1.7 I guess?
1.6, actually.
I'm in the process of setting up the dev blog on my second machine. Will report back with further test results.
YL
Re: Comment search
Posted: Tue Jan 31, 2012 1:13 pm
by garvinhicking
Hi!
Timbalu wrote:<ironic.mode.on>
Stop blaming Smarty3, Garvin! I must really wonder... you don't seem to like it very much....
</i.m.end>
I'm only sick and tired of how much work it requires us to adapt to Smarty3 when we don't get anything feasible in return. I for one don't feel any speed increase. But that's a different matter, using recent versions of software is always better. I only wish it weren't causing so much pain.
No offense intended though, neither on you nor the smarty devs. Since YL writes that 1.6 is causing the same behavoir, this strikes me as odd.
The config.inc.php of a template is loaded in serendipity_smarty_init(), and the plugin executes its code later on. So all modifiers should exist there.
YL: *OTHER* involved plugins could be the cause. You might want to test this on an installation without other possibly influencing plugins that use Smarty; some plugins call serendipity_smarty_init() on their own (freetag, AFAIR, and maybe also staticpage). Those could interfer for disregarding the config.inc.php modifiers.
Regards,
Garvin
Re: Comment search
Posted: Tue Jan 31, 2012 1:23 pm
by yellowled
garvinhicking wrote:Since YL writes that 1.6 is causing the same behavoir, this strikes me as odd.
The config.inc.php of a template is loaded in serendipity_smarty_init(), and the plugin executes its code later on. So all modifiers should exist there.
Turns out the commentsearch plugin does some odd things in general like concatenate included avatars etc. (Grischa's working on that already.)
I will test this more thoroughly later, but at the moment, I'm working on other stuff concerning the server itself. Once this is resolved, I will test this issue and report back.
YL
Re: Comment search
Posted: Tue Jan 31, 2012 1:38 pm
by Timbalu
Take a Peter Stuyvesant, Garvin!

...did not read my i-tags?
S3-Speed increase? Its OOP, a huge blowup in workspace! But they did a incredible good work making this fast! YL already stated the Backend being faster than ever...

And we get a lot for it. Change always is painful on the one side...
About serendipity_smarty_init() - oh yes - I remember - as I once knocked-out comment or contactform with this...
Re: Comment search
Posted: Tue Jan 31, 2012 1:40 pm
by blog.brockha.us
I updated commentsearch in Spartacus now.
The problem was: It is calling frontend_display, what let all other plugins create some extra HTML into the comment. The template did fetch this comment and truncated it. This will of course produce invalid output, because it doesn't strip tags before and will truncate in the middle of tags, if tags are delivered by other plugins.
I changed it in that way, that result.comment will be handed without tags to the template, so the template can truncate freely. I added result.commenthtml in order to have the chance to handle full blown up html comments in your own template, if you like.
Re: Comment search
Posted: Tue Jan 31, 2012 1:47 pm
by yellowled
Timbalu wrote:YL already stated the Backend being faster than ever...

Could've been just my subjective impression, you know? AFAIR no one actually confirmed that.
YL
Re: Comment search
Posted: Tue Jan 31, 2012 1:48 pm
by Timbalu
Nevertheless it would be good to find the issue itself...,
we could try and include a:
Code: Select all
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
just right before registering that modifier in 2k11's config, couldn't we?
@YL, but that counts....

Re: Comment search
Posted: Tue Jan 31, 2012 1:57 pm
by yellowled
Timbalu wrote:Code: Select all
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
Doesn't change anything.
Still using the same version of commentsearch since my dev blog pulls updates via Spartacus, so Grischa's commit isn't there yet.
YL
Re: Comment search
Posted: Tue Jan 31, 2012 2:02 pm
by yellowled
Timbalu wrote:A. remove the array modifier @
B. change name - functionname or v.v.
Code: Select all
$serendipity['smarty']->register_modifier('s9y_smarty_html5time', 'serendipity_smarty_html5time');
C. use smarty3 syntax testwise
Code: Select all
$serendipity['smarty']->registerPlugin('modifier', 's9y_smarty_html5time', 'serendipity_smarty_html5time');
A. doesn't put the actual time in the datetime attribute:
Code: Select all
<time datetime="Serendipity_smarty_html5time">25.11.2011</time>
B. gives me an error 500 (I did
not change the actual function's name, I just modified the line you quoted.)
C. Why should I use Smarty3 in a 1.6 blog?
YL
Re: Comment search
Posted: Tue Jan 31, 2012 2:07 pm
by yellowled
garvinhicking wrote:*OTHER* involved plugins could be the cause. You might want to test this on an installation without other possibly influencing plugins that use Smarty; some plugins call serendipity_smarty_init() on their own (freetag, AFAIR, and maybe also staticpage). Those could interfer for disregarding the config.inc.php modifiers.
I will check this in a pristine installation later, but I need a break right now.
BTW, I just realized – if I disable the freetag event plugin, but leave the freetag sidebar plugin active, no plugins in that sidebar are emitted. Shouldn't we have some kind of warning mechanism for this?
YL
Re: Comment search
Posted: Tue Jan 31, 2012 2:24 pm
by yellowled
yellowled wrote:garvinhicking wrote:*OTHER* involved plugins could be the cause. You might want to test this on an installation without other possibly influencing plugins that use Smarty; some plugins call serendipity_smarty_init() on their own (freetag, AFAIR, and maybe also staticpage). Those could interfer for disregarding the config.inc.php modifiers.
I will check this in a pristine installation later
Pristine installation (1.6), only thing I did was activate 2k11. Same result: No entries to print.
YL
Re: Comment search
Posted: Tue Jan 31, 2012 2:50 pm
by Timbalu
yellowled wrote:B. gives me an error 500 (I did not change the actual function's name, I just modified the line you quoted.)
C. Why should I use Smarty3 in a 1.6 blog?
- B.
- Well, if you do this, then you do not have to complain about getting a 500

'smarty_modifiername', 'smarty_modifier_functionname'
will need the function or your mod to be renamed too.
C. - Did not know, when I quoted...