Templates

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
JMF
Regular
Posts: 12
Joined: Wed Apr 21, 2004 2:08 pm
Contact:

Templates

Post 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 ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Templates

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JMF
Regular
Posts: 12
Joined: Wed Apr 21, 2004 2:08 pm
Contact:

Post 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. :)
JMF
Regular
Posts: 12
Joined: Wed Apr 21, 2004 2:08 pm
Contact:

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JMF
Regular
Posts: 12
Joined: Wed Apr 21, 2004 2:08 pm
Contact:

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
JMF
Regular
Posts: 12
Joined: Wed Apr 21, 2004 2:08 pm
Contact:

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post 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 :)
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Post Reply