We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Creating an add-on: plug-in or accessory?

Development and Programming

northk's avatar
northk
51 posts
14 years ago
northk's avatar northk

Greetings all,

I’m creating my first add-on, and it needs to have a database table associated with it. I was going to make it a simple Plug-In, but it appears that I may need to make it an Accessory rather than a plug-in if I need a database table. The table will need to be created when the add-on is installed and deleted when the add-on is uninstalled.

Can someone please confirm that I need an Accessory rather than a Plug-in in order to accomplish this? Also, I’m wondering what other differences there are between these two add-on types. I’ve read over the docs here and here but it’s not clear to me if the option of a setup/install/uninstall is the main difference or if there are other important differences.

If I should be posting questions like these somewhere else, please let me know.

Thanks for your help,

Moved to Development and Programming by Moderator -NorthK

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
14 years ago
Sue Crocker's avatar Sue Crocker

Hi, northk.

Excellent questions, but better suited for the Development forum. Moving there for additional community support.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Hi NorthK

The table will need to be created when the add-on is installed and deleted when the add-on is uninstalled. Can someone please confirm that I need an Accessory rather than a Plug-in in order to accomplish this?

That alone says a lot. Plugins never need to be “installed”. They only need to be put in the right folder on your server. So, with what you’ve said so far I’d recommend an Accessory over a Plugin if those are the two options.

Also, I’m wondering what other differences there are between these two add-on types. I’ve read over the docs here and here but it’s not clear to me if the option of a setup/install/uninstall is the main difference or if there are other important differences.

Accessories are little tabs in the footer area of your Control Panel. You might not even need one of those in this case. If you literally just need a database table with some data in it I’d suggest you make your add-on a Module. That will give you 99% of what a Plugin gives you AND the ability to setup a database table on install.

Take a look at the module tutorial and see if that sounds like a doable thing to you.

If I should be posting questions like these somewhere else, please let me know.

Sue has brought you to the right place. Add-on questions are mostly best served here in the Development and Programming forum.

Let me know what you think about the information above and if you have any questions about how to get started.

Erik

       
northk's avatar
northk
51 posts
14 years ago
northk's avatar northk

Erik, thanks a lot. It looks like a Module is what I need to write– I’ll read up on that.

-NorthK

       
northk's avatar
northk
51 posts
14 years ago
northk's avatar northk

Hi again Erik,

For my add-on, the database is only used for one table that caches XML data received from REST calls (Twitter in this case). I’d like to use the database since it will nicely handle concurrency rather than going with a file-based cache, which can have a lot of issues.

It looks like there may be quite a bit of stuff involved in creating a module, which I won’t need. The only CP option will be Install or Uninstall so it can create the DB table. Otherwise, no control panel additions, nothing needed on the Publish page, no view files needed. Just tags, tag parameters and one DB table.

I’m wondering if this information would change your answer or not?

Thanks, -NorthK

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
I’m wondering if this information would change your answer or not?

Nope 😊

I’d stick with the module approach which would mean you’d need something like the following in terms of files:

  • third_party/your_addon
  • third_party/your_addon/mcp.your_addon.php (required to be installed)
  • third_party/your_addon/upd.your_addon.php (will do the heavy lifting of the table creation and dropping)
  • third_party/your_addon/mod.your_addon.php (will be where all of your tags are processed)
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.