Page 1 of 1
feature request: recent entries and recent comment
Posted: Sat Jan 07, 2006 5:50 pm
by carl_galloway
Hi all,
I'm working on a drop down menu to be placed into a theme which uses the serendipity_showPlugin hook to display the recent comments and recent entries. My drop down is now working flawlessly and just needs some final styling.
Howerver the recent comments, and recent entries plugins have their html output hard coded into the php file. Is their any way these could be converted to use a smarty tpl file, and then also check to make sure one exists within the users template folder otherwise use the tpl file in the plugin folder?
This would allow theme designers to customise the placing of plugins, we wouldn't be restricted to the sidebar and the styles used. We could add our own styles, and format the output ourselves so they more closely fit into our design.
Hope this isn't too much of an issue, look forward to your responses.
Carl
Re: feature request: recent entries and recent comment
Posted: Sat Jan 07, 2006 6:56 pm
by garvinhicking
The problem is that these plugins are "core" plugins and thus are optimized for performance. Tweaking them into Smarty .tpl files would cost performance pennies, which I'd like to avoid...
Soooo, bottom line: Can't it maybe be solved via CSS?

)
Many of the external plugins, BTW, use such a .tpl smarty customization (like staticpages, contactform or similars). But for most of the core bundled plugins I like to keep Smarty utilizing to a minimum, because seldomly the HTML output of those plugins needs to be altered...
Best regards,
Garvin
Posted: Sat Jan 07, 2006 7:10 pm
by carl_galloway
Garvn,
I understand what you're saying, makes sense, it just means my stylesheet has to much bigger because I need to duplicate almost every sidebar style, but prefix it with #nav so I can change the style when it appears in the menu.
Performance wise, which is better, a longer stylesheet, or changing hte core plugin? You're probably right, I guess I'm just getting carried away with the potential for theming. Just ignore me.
Cheers
Carl
Posted: Sat Jan 07, 2006 7:16 pm
by garvinhicking
Hi Carl!
Since the CSS is cached on the client side, that is much(!) faster than making Smartyficiation of the plugin.
And maybe you only need to override some little styles, and not all sidebar styles?
I won't ever ignore you!:) This case just is a performance weakness, were we just have to resort to things that are technically sane(tm). As much as I like the smarty abstraction,in some places it's just too expensive.
Best regards,
Garvin
Posted: Sat Jan 07, 2006 10:42 pm
by judebert
Agree with both of you.
Perhaps we can add a configuration option to the core plugins that causes them to output as unordered lists for CSS? Solves the problem for both sides.
Posted: Sat Jan 07, 2006 10:49 pm
by garvinhicking
Judebert,
but that wouldn't make it very intuitive for users of a template? They would need to first configure some plugins to enable that option for the theme, which would be annoying I guess?
Bestregards,
Garvin
Posted: Mon Jan 09, 2006 6:13 pm
by carl_galloway
Garvin, perhaps what we need to do is continue to hard code the output within the core plugin file, but tidy up the code in this area so it is more flexible for theme designers. I haven't properly thought this through, so I don't have an alternative code for you, but as an example, the recent comments has three <br /> hard coded into it. Nightmare if you're aiming for tight integration since <br />'s can't be styled. Yes you can adjust line-heights, margins etc. but it isn't the same as separate div's.
Removing those <br />'s and allowing us to style the blocks would be more appropriate. Does anyone else share my concern?
To the developers, these aren't criticisms of s9y, its brilliant, the criticism stems from us trying to push the limits on what what has been done in the past and then realising that different developers seem to output different html.
Carl
Posted: Mon Jan 09, 2006 8:49 pm
by garvinhicking
Hi Carl!
I agree, that having sensible hard-coded markup is a workable approach.
But you should be able to style "br" tags within plugins!
Code: Select all
.serendipity_plugin_comments br {
display: none;
}
should work, doesn't it?
The problem with removing is, is that all existing templates would need CSS modification.
And, of course criticism is great and useful! We can only improve with criticism.
If you find other issues in plugins that can be solved withoutbreaking too much backwards compatibility, please let me/us kjnow!
Regards,
Garvin
Posted: Mon Jan 09, 2006 9:56 pm
by Guest
Arghhh!
You're right, but the style needs to be written as;
Code: Select all
.container_serendipity_plugin_comments br {
display: none;
}
Thanks, just goes to show when you get too close to the problem...
Carl
Posted: Tue Jan 10, 2006 11:52 pm
by carl_galloway
Can I request a modification to the recent comments html, this shouldn't affect other themes, and will still be backwards compatible, and will allow theme developers to further refine things.
Specifically what I want is for the output to include a couple of <span>'s so that I can style the three lines differently. At present everything is dumped into serendipitySideBarContent, but what I really want to be able to do is style the following differently;
1. the author name and link to entry
2. the date and time the comment was posted
3. the body of the comment
Perhaps we could use the span names comment_author, comment_date, and comment_body.
Is that a workable solution to retain compatibility with existing themes?
Carl
Posted: Wed Jan 11, 2006 1:47 pm
by garvinhicking
Hi Carl!
Sure, request like this are perfectly the ones I requested.
I added those selectors to the SVN trunk, which'll be part of the nightly snapshots. I needed to prefix the spans with "plugin_", because else it might break some templates that use a ".comment_author" selector for comments...
Best regards,
Garvin
Posted: Wed Jan 11, 2006 5:35 pm
by carl_galloway
Thanks Garvin, I'll go ahead and download it. Appreciate the quick response.
Carl
Posted: Thu Jan 12, 2006 1:03 am
by carl_galloway
oops, tried it and it has a wee small problem. Somehow the final </span> which appears after the comment body isn't appearing in the html output. Unfortunately this prevents my styling from working at all. I tried moving it around in the plugin, but I only succeeded in getting a rather nasty smarty error. No php programming for me!
Anyway, I can see that the final </span> is actually included within the logic, but when I view the source from my browser after the page has generated the final </span> is missing.
Sorry to be the bearer of bad news, but if you could make it work I would be ecstatic.
Cheers
Carl
Posted: Thu Jan 12, 2006 12:02 pm
by garvinhicking
Carl: You were right, the </span> was placed wrongly. The line needs to be:
Code: Select all
. '<span class="plugin_comment_body">' . strip_tags($entry['comment'], '<br /><img>') . '</span>'
I just committed it
Regards,
Garvin
Posted: Thu Jan 12, 2006 5:22 pm
by carl_galloway
oh, be still my beating heart, it works. wait till you see we can do with this!