Support Forum
I was tinkering around tonight with a theme idea and got to thinking (maybe too much).
I was relocating the "spPostAction" section and all it's contents when I noticed a few if(function_exists) that were testing for active plugins, and then creating buttons for them if the functions exist.
This is fine and all if the theme authors were aware of each and every plugin out there that would require a button in the action section. Wouldn't it be wise to come up with some sort of "standard" sections and provide standard hooks or filters that plugin authors could safely assume existed?
I'm not to keen on authoring a theme knowing I will have to review each and every new plugin to see if it requires a button. And then update the theme accordingly. I'd much rather make standard named sections with standard hooks, filters or both and leave it up to the plugin authors to hook into them.
Here's a code example taken from the default theme wp-content/forum-themes/default/templates/spTopicView.php
sp_SectionStart('tagClass=spPostActionSection', 'action'); sp_GoToTop('tagClass=spRight spGoToTop&iconClass=spIcon', '', __sp('Go to Top', 'spDefault')); sp_PostIndexNumber('tagClass=spLabelBordered spLeft'); sp_PostIndexEditHistory('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Edited by %USER% at %DATE%', 'spDefault'), __sp('View edit history', 'spDefault')); sp_PostIndexPermalink('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Display post permalink', 'spDefault')); sp_PostIndexPrint('tagClass=spButton spLeft', __sp('', 'spDefault'), __sp('Print this post', 'spDefault')); if (function_exists('sp_PostIndexRatePost')) sp_PostIndexRatePost('tagClass=spLabelBordered spPostRating spRight'); if (function_exists('sp_PostIndexReportPost')) sp_PostIndexReportPost('tagClass=spButton spRight', __sp('Report', 'spDefault'), __sp('Report this post to admin', 'spDefault')); sp_PostIndexQuote('tagClass=spButton spRight', __sp('Quote', 'spDefault'), __sp('Quote this post and reply', 'spDefault')); sp_PostIndexEdit('tagClass=spButton spRight', __sp('Edit', 'spDefault'), __sp('Edit this post', 'spDefault')); if (function_exists('sp_PostIndexSendPm')) sp_PostIndexSendPm('tagClass=spButton spRight', __sp('PM', 'spDefault'), __sp('Send PM to this user', 'spDefault')); sp_SectionEnd('', 'action');
there is no perfect solution here.. much like wp themes and plugins...
and we opted to go with the same path as wp... with many plugins for wp, you have to add the template tag call yourself in the theme if you want to use it... it sort of becomes the users responsibility not the theme author...
we can create some standard named sections and have done so in our default theme, but again, not required to be used... leaving plugins to expect a named section will be just as troublesome... I can easily envision a theme design where I will want different 'buttons' in different locations... a single name section for plugins to hook into, wont be sufficient...
the current method actually has the most flexibility and customizability, but you are right, will be difficult for themes to support all the plugins out of the box... we toyed with our default theme and whether we should do the function exists checks and include buttons for the plugins we have created... or just leave them out and have users add them... you can see which way we went...
but all that said, we are certainly willing to discuss this further as its one of the reasons we wanted to have the alpha... any different solution will need to allow plugins or themes to place components wherever they want...
so, please keep discussing...
Visit Cruise Talk Central and Mr Papa's World
I can't argue with your logic. I have pulled a couple buttons out of the group as you mentioned and can see the problems. It is unfortunate however the user will have to place the button code themselves and then deal with the styling as well. But I suppose admins, like it or not need to learn a little code from time to time.
1 Guest(s)