MyBB Community Forums

Full Version: Test Plugin for new developers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
but when you update a template, only the dateline is changed and version stays. so we can't start adding to the version number without potentially screwing up future updates.

perhaps a "master version" field that stores the basis of the template (e.g. 1603, 1604, etc) and then use the version field for every edit made. Maybe even have the option to update the latest or create a new version.
(2011-12-23, 01:56 AM)pavemen Wrote: [ -> ]but when you update a template, only the dateline is changed and version stays. so we can't start adding to the version number without potentially screwing up future updates.

perhaps a "master version" field that stores the basis of the template (e.g. 1603, 1604, etc) and then use the version field for every edit made. Maybe even have the option to update the latest or create a new version.

Unneeded. If we use the exact same methods as used for core templates it'll work without any extra hoopla.
so my plugin updates the header template and I release an updated plugin that needs to revise my previous header template, how do I test for the version then as suggested above?

i can see for completely new templates that can be inserted as master or global ones (-2 or -1 sid) having versions set to the plugin version. but the edits to existing templates are what some folks here are talking about
(2011-12-23, 03:28 AM)pavemen Wrote: [ -> ]so my plugin updates the header template and I release an updated plugin that needs to revise my previous header template, how do I test for the version then as suggested above?

i can see for completely new templates that can be inserted as master or global ones (-2 or -1 sid) having versions set to the plugin version. but the edits to existing templates are what some folks here are talking about

Same way we do it in core. The master version gets updated, and the "Find updated templates" function in the ACP compares them. If you guys can have a little patience I'll get to the new wiki page I'm working on and show actual examples of it in action. Wink
no waiting, we want it now!!!! :p
(2011-12-23, 04:22 AM)pavemen Wrote: [ -> ]no waiting, we want it now!!!! :p

Yes, but its the week of Christmas and I'm busy with family stuff Toungue
(2011-12-23, 03:28 AM)pavemen Wrote: [ -> ]so my plugin updates the header template and I release an updated plugin that needs to revise my previous header template, how do I test for the version then as suggested above?

Well, in my suggestion I was thinking of custom templates (your_plugin_template), not official core ones. Those probably shouldn't be modified and you can't change their version numbers anyway without breaking MyBB's own update functionality.

Personally I prefer to keep changes to existing templates to an absolute minimum, so instead of inserting a whole lot of code with find_replace_templatesets I prefer to create a custom template for the code and just find_replace_insert {$custom_template} into the existing template. Have to take care to get the template cached correctly then, though.
I missed Pavemen was talking about core templates there. What I was talking about would be fore custom templates. Like frostschultz, I prefer to keep such core template edits to a minimum. I normally just add a variable, and then have my template code in a custom template that I eval into that var.
(2011-12-23, 04:08 PM)Dylan M. Wrote: [ -> ]I missed Pavemen was talking about core templates there. What I was talking about would be fore custom templates. Like frostschultz, I prefer to keep such core template edits to a minimum. I normally just add a variable, and then have my template code in a custom template that I eval into that var.

Isn't that the suggested method? I've never been one to insert tons of new stuff into existing templates - instead preferring to create new templates. The only problem then, however, is that most plugins just use the Global Templates set (my own included) which makes the template listing become quite un-neat. If we could agree some kind of template naming convention (such as {plugin_name}_{template_name}), then maybe we could group templates in the Global Templates set by plugin name to make finding templates easier?
I am not disagreeing as I supply my plugins that way as well. In fact, MyShowcase creates a new group and installs 55 new templates under sid -2 so they are grouped and available to all template sets.

My other plugins either insert a template variable via find_replace_templates and create a new template or update on the fly when needed.

One suggestion though, perhaps the next version could use a wiki style template updater, so that we can track local revisions, revert to a previous version, update existing or create new version, etc. These would be specific to the template set. Perhaps even an setting to save only the last X versions or have a control to delete a version to maintain respectable DB size.

@euantor: this is the suggested method but a lot of folks dont always follow it. example,look at the fit on page plugin, it inserts the same JS code in 6 different templates and a slightly modified one for the portal. Just as with plugin functions, new templates and template variables should include the plugin name, which is what I try to do.
Pages: 1 2 3 4