Page 1 of 1

Templates

Posted: Tue Feb 08, 2005 5:39 pm
by JMF
Hello,

I am not currently using Serendipity because of some things that were annoying me in the way it works. One of the major ones was the way templates were handled.

When I heard that the 0.8 release will feature Smarty support I thought I was about to switch but after a little bit of testing I am still very disappointed.

Much of the generated HTML code is hard coded thus many things can not be customized. Is there a plan to solve this problem ?

Re: Templates

Posted: Wed Feb 09, 2005 12:30 pm
by garvinhicking
Please point out examples where HTML is hardcoded.

About 99% of all output should be customizable. The left 1% is left that way because of performance reasons and backwards-compatibility, and there usually really is no need why one would need to edit those places.

If you tell a place where customization is needed, we can try our best to solve the issue so that Serendipity works out for you!

Regards,
Garvin

Posted: Wed Feb 09, 2005 2:00 pm
by JMF
Thanks for the answer Garvin. :)

I was mainly talking about the plugins output. For example, the Amazon Affiliate Plugin has hard coded HTML. You may say that it is not an official plugin and that's true. But an official plugin like the one that manage the categories has also hard coded HTML. BTW, the generated HTML is not semantic, a unordered list (<ul>) would be more accurate for this purpose IMHO.

I think that a way to customize plugins output would be handy. For example, a plugin could have a template that would be used to generate the output. This template could be overriden by a custom template in the theme directory. That way, we could very easily customize the plugin output. :)

Posted: Wed Feb 09, 2005 2:05 pm
by JMF
I just read again my first post and I am sorry if my words were a little bit rude. :)

I think my disappointement was the reason.

Posted: Wed Feb 09, 2005 2:39 pm
by garvinhicking
Okay, so you'Re talking about plugins.

I see your pain, but in your case I suggest you to duplicate the plugin and adjust the HTML code there.

The reason is performance: If every plugin would use a Smarty template, the generation of plugins will take about 4-5times longer than at the moment - because its several small files with much Smarty overhead.

Regards,
Garvin

Posted: Wed Feb 09, 2005 2:53 pm
by JMF
garvinhicking wrote:I see your pain, but in your case I suggest you to duplicate the plugin and adjust the HTML code there.
That's not very handy when you need to upgrade.
garvinhicking wrote:The reason is performance: If every plugin would use a Smarty template, the generation of plugins will take about 4-5times longer than at the moment - because its several small files with much Smarty overhead.
I do not see much overhead here. The plugins that generate output are not so numerous and the templates are processed only one time.

Posted: Wed Feb 09, 2005 4:14 pm
by garvinhicking
Maybe you can help to port some important plugins to use Smarty templates? Then we could do some benchmark tests.

Smarty Templates are only compiled once, but to execute a parsed template still costs much more in terms of perfomance than echoing the plugins HTML output.

Regards,
Garvin

Posted: Wed Feb 09, 2005 4:29 pm
by JMF
garvinhicking wrote:Maybe you can help to port some important plugins to use Smarty templates? Then we could do some benchmark tests.
Sure. I am willing to help, not only to complain. :wink:
I will do that and come back to you then.
garvinhicking wrote:Smarty Templates are only compiled once, but to execute a parsed template still costs much more in terms of perfomance than echoing the plugins HTML output.

That's true.

Posted: Wed Feb 09, 2005 5:02 pm
by garvinhicking
JMF,

thanks a lot! I'm looking forward to your results - if it happens to get along well, we will surely try to make use of them!

Thanks a lot,
garvin

Posted: Wed Feb 09, 2005 8:22 pm
by tomsommer
While the templates are only compiled once, you still have to require() another file for each plugin, and parse extra smarty logic (like smarty-plugins etc)

The overhead would be noticeable; however it would of course be nice if it was doable :)