• Hey

    I love this plugin. The ability to easily add custom code and snippets in an easy to use interface is superb.

    I need to write quite a bit of code, adding lots of filters and actions to extend the functionality of another plugin: Restrict Content Pro. The specifics of that plugin aren’t really important, except to say that there is a generous mix of HTML and PHP required to add additional form fields and import/export functionality to it.

    I could put this in a site specific custom plugin, but I like this plugin so much that I don’t want some code here and others in a plugin. The site specific plugin isn’t exactly reusable.

    Is there any general recommendations in terms of size of code/how best to split up the code in to different snippets? It was always once said that eval is slow, but I don’t know how true that is.

    Thanks!
    Jamie

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jamie Burchell

    (@jamieburchell)

    @bungeshea
    I just wanted to add after reading through nearly every page of this forum – you are an absolute star. Most of the issues I’ve read relate to broken code or botched PHP upgrades that have nothing to do with your plugin, but of course it and you are directly in the firing line. That you still help and even go so far as to fix code outside the scope of your plugin is testement to you.

    I’ve spotted a couple of threads from what can only be best described as rude and entitled people and both cannot fathom how you have kept your cool and how they have the attitude and expectation for free support for a free product, which is maintained for free. As a developer of sorts myself, I feel frustrated for you.

    Jamie

    Plugin Author Shea Bunge

    (@bungeshea)

    Hi Jamie!

    Apologies for the delay in getting you a response. I definitely don’t envy you going through all of these forum posts – there are a lot of them there!

    I’ve been thinking about your question, and I think this mostly comes down to personal preference. There aren’t a lot of technical factors to take into account. Each snippet is evaluated separately, so I suppose technically there’s a performance difference there, but they are all fetched from the database in the same query.

    I would probably separate the code out in such a way so that the code within one snippet is not wholly reliant on the code in another. This would allow toggling of activation status for any of the snippets for debug purposes without affecting the site too much.

    Apart from that, it’s difficult to speak generally. Apologies that this probably hasn’t provided a lot of clarity, but please to post any follow-up questions you might have.

    Thread Starter Jamie Burchell

    (@jamieburchell)

    Thanks Shea

    I also came to the conclusion that it’s better to have small non-dependent snippets that can be easily toggled to affect discreet functionality. It’s great that all of the snippets are fetched with one query too.

    For my use case above where I needed to write quite a bit of code to extend a plugin I decided to write that as a custom plugin, but for everything else I have used Code Snippets and think it’s a great idea.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Structuring and performance considerations’ is closed to new replies.