Support Forum

new Plugin: Announcements ready for review in pending codex

KW Ken Wilson
Ken Wilson
Member

Please review the new codex page for Plugin: Announcements.  Please let me know it is ready to publish or what changes need to be made so it can be published.

It conforms to the plugin format established in Plugin: Topic Status and Plugin: Maintenance Mode.

On the codex page I am calling out the template tag as sp_AnnounceMessage($args) the one in the plugin file sp-announce-plugin.php.  I am not mentioning sp_do_AnnounceMessage($args) at all as I understand I should not.

In the template tag Source Code section the information on location is not quite correct, but it is trying to convey where the details of the template tag are located (in file sp-announce-display-tag.php) even though sp_AnnounceMessage() is really in file sp-announce-plugin.php.

I think I keep asking the same question, but wouldn’t it be helpful to the users if the page discusses that function sp_AnnounceMessage($args) is in file sp-announce-plugin.php and is derived from function sp_do_AnnounceMessage that is in file sp-announce-display-tag.php where the details are?

My dilemma can be eliminated once and for all if I am told one more time to “remove the Template Tag Source Code section.”

I have rambled enough.  Let me know what to do to get it published.

Thanks.

7 Answers

New Answer

MP Mr Papa
Mr Papa
Member

I think I keep asking the same question, but wouldn’t it be helpful to the users if the page discusses that function sp_AnnounceMessage($args) is in file sp-announce-plugin.php and is derived from function sp_do_AnnounceMessage that is in file sp-announce-display-tag.php where the details are?

sorry, not following the question…  but can try to explain again why things are the way they are…

The file sp-announce-display-tag.php which has the code for the tag sp_do_AnnounceMessage() is not loaded by default on page loads… so the function is not available to be called…  Only the main plugin file (generally speaking) is loaded  on page loads… so any function/tag that needs to be available for users to call must be declared in that main plugin file… 

Yes, we could include all the files the template tags are in by default and they would be callable functions… But this would drastically increase the memory footprint of simple press as no huge amounts of code would be included on every page load…  and for most folks or for many page loads, thats way overkill and will require more php memory and likely slow down processing too…  instead, we provide wrapper functions that all they do is include the file and call the ‘true’ template function…  this keeps things quicker and less memory intensive…

hope that helps…

I do recommend removing the source code section…

side note, I would like to write a ticket against core to include less of our display template functions by default too…  for example, we include common, group, forum, topic, members, etc on every page load…  we could be smarter and only include items based on the pageview type and provide wrappers…  but at this point, a lot of work and no guarantee folks are not using the group view functions on forum view pages….  depending on your theme, you could certainly combine elements from both…  so not likely to occur…  unless we wrote wrappers for all of them in a wrapper file(s) and included that on all pages and had the wrapper function do an include once of the needed api file…

KW Ken Wilson
Ken Wilson
Member

Thanks for taking the time to explain…again.

Template Tag Source Code section deleted.  It will not be in Template Tag areas in any new or revised plugin codex pages.

Awaiting your comments or okay to publish.

KW Ken Wilson
Ken Wilson
Member

Page published, re-edited to change progress to “complete”, then re-published.  Codex ticket 4396 closed.

MP Mr Papa
Mr Papa
Member

Think Ken likes the team forums better than the Dev site.. :) evil  no worries!

KW Ken Wilson
Ken Wilson
Member

No preference actually. 

I just thought information and questions about the codex documentation were supposed to be here under “Documentation Discussion.”  Would it be better if these entries and questions were moved to the Dev site?

Just tell me your preference.

MP Mr Papa
Mr Papa
Member

Either one is fine… Was just giving you a hard time… :) evil