Skip to content

Plugin_Design

Cameron edited this page Jan 28, 2017 · 1 revision

title: Plugin Design permalink: /Plugin_Design/

Introduction to Plugin Design

This article aims to lead the plugin writing beginner through the basics of writing a simple plugin for e107. It will not go in to detail on every aspect of plugin writing.

Certain assumptions are made, specifically that you are familiar with the basics of:

  • e107
  • what a plugin is
  • PHP programming language
  • MySQL Database usage
  • HTML/XHTML
  • XML
  • Cascading Stylesheets (CSS)

Beginners start here w3schools.com

The example plugin in this article is called myplugin. It will have an admin page where some preferences can be set by the site administrator, a main page and a menu.

Directory Structure

All plugins reside in their own folder within the e107_plugins folder.

Actually, within your plugins folder there are only a few rules as to what goes where. After that, you are free to create whatever directory structure suits your plugin best.

For this example, we will use a fairly common structure within your plugins folder. Here's the basic layout we will be using:

e107_plugins (dir) | +--myplugin (dir)    |    +--handlers (dir)     |  +-- myplugin_class.php      |    +--images (dir)    |  +-- icon_16.png    |  +-- icon_32.png    |    +--languages (dir)    |  +--English (dir)    |     +-- myplugin.php    |     +-- admin_myplugin.php    |    +--templates (dir)     |  +--myplugin_template.php (dir)    |    +--e_url (dir) (opt)    |  +--apache_mod_rewrite (dir)    |  +-- main.php    |     |  -- Required Files ------------------------        +--admin_myplugin.php    +--myplugin.php    +--myplugin_setup.php    +--myplugin_shortcodes.php    +--myplugin_sql.php    +--plugin.xml ! replaces plugin.php - Deprecated - Do not use!    +--index.html - (simply an empty file for security)     |    |  -- Optional Files ------------------------    +--myplugin_css.php    +--myplugin.js    +--myplugin.sc    |    |  -- Optional References -------------------    +--e_event.php    +--e_header.php    +--e_bb.php    +--e_cron.php    +--e_frontpage.php    +--e_help.php    +--e_list.php    +--e_mailout.php    +--e_meta.php    +--e_module.php    +--e_notify.php    +--e_rss.php    +--e_search.php    +--e_sitelink.php    +--e_tagwords.php    |    | ---------------------------------------- (Checking needed here)     ? +--admin_menu.php ???     ? +--admin_readme.php ???     ? +--myplugin_menu.php ???     ? +--myplugin_setup.php ???

plugin.php

blank_setup.php

Category:Development Category:Plugin Writing

Clone this wiki locally