How does ExpressionEngine
Create your first ExpressionEngine plugin
No matter how great a CMS is, there are times when you need to meet a specific need that just doesn't work right away. Here's how to create plugins for ExpressionEngine to meet these needs.
Just recently, EllisLab, the developers of ExpressionEngine, announced the official release date of ExpressionEngine 2.0 as December 1, 2009. Please note that this tutorial was written with details on versions 1.6.x. Certain details such as file paths and global objects change for version 2.0. While these details are different, the general application and approach to plugin creation for ExpressionEngine remains the same.
Types of ExpressionEngine add-ons
Like most robust management systems, ExpressionEngine, or "EE", gives the developer several ways to add functionality that may not be standard. Unlike popular systems like WordPress, EE has different names for these add-ons depending on how they interact with your site. There are three main ways you can add functionality to EE 1.6.x such as: B. Plugins, extensions and modules. Plugins mainly deal with changing the template code and are more of a front-end job. Extensions usually optimize the functionality of the back-end or the control panel by adding "hooks" to the system. Modules are usually more extensive, have their own area in the control panel and can also be used in the front end of the EE website. Modules can be fully-fledged apps residing within EE using membership, templates, databases, etc.
Things you should know for sure before proceeding:
- Setting up and installing ExpressionEngine in a development environment
- Basic understanding of the ExpressionEngine control panel and the analysis of templates
- Basic knowledge of PHP and object-oriented programming
- How do you read the documentation ?!
For this tutorial, we will create a simple plugin that will search the passed data and wrap certain strings with HTML tags. This is a very simple use of an EE plugin and should show you how easy it is to start plugin development. Our plugin is used to find and replace acronyms that we as developers use. For the example, we're going to stick to three: HTML, CSS, and RSS. Let's call the plugin "Auto Acronym".
Where should I start?
The best place to start when developing EE add-ons is from the official ExpressionEngine documentation. Before diving into the development of ExpressionEngine, be sure to read its guidelines, which, if followed, will help keep the system running well. The guidelines cover topics such as naming conventions, performance, and security. I'll give you a few minutes to read through the ExpressionEngine add-on development guidelines
Okay, now that you've read, we can take a look at how we create the plugins and what makes a simple plugin.
Pieces of the puzzle
Every plugin needs a class and at least one function. The naming convention is very specific, so we need to make sure that we do it correctly and carefully. The name of our plugin is Auto Acronym. It is used with our file name, class name and EE tags. The file name takes the name of your plugin and replaces all spaces with underscores if you put "pi" in front. Forward. All letters must be lowercase. That would make our filename "pi.auto_acronym.php". All EE plugins are stored in a single directory under system / plugins ..
The class name is similar to the file name except for the first letter, which is capitalized. This makes our class name "auto_acronym". This plugin only needs one function, so it has the same name as the class. These are also the names we use in our EE plugin tags. Plugin tags always start with "exp:", which tells the template parser, "Hey! I need some processing here!". Below is the name of your class in lower case: "exp: auto_acronym". The third segment of a plugin tag calls the function within the class of the plugin. In our example we only use one function, the constructor, so we only need the class name. This is how far we know about our plugin:
Put it in the code
Let's see what our code is so far:
- Where should I add my normalizing CSS
- Which programmer entrepreneurs do you know
- Is 1 plus a rooted device
- What are seed balls
- How many Pepsi products are failing
- How do electrons flow in these circuits
- Why do people like to use Craigslist
- Who invented the concept of smartphones
- In which countries is Kik available
- What is the difference between cable car and cable car
- May cause anxiety after nasal drops
- How do I give English lessons
- Why India and Israel are so friends
- Why does Google hate Justin Bieber
- What does a decentralized Quora look like
- Modern orchestras use the theremin
- How is higher education in Germany
- What does ROTFLBTCDICAJTTWADBSIHPWTRHITSBKABAYB
- What are some famous dramatic monologues
- Will there be a Naruto Gaiden anime
- What is the source of true happiness
- How we can earn online 2
- What is the first military aircraft
- What is the old name of Vijayawada
- The population increases in the Iron Age
- Will happen to Yik Yak Secret and Whisper
- How much does a mixing table cost
- Therapists assess clients in general
- How can someone work faster and happier
- What is a transmission line equation
- How much does amazon cost
- Who can be a good writer
- Is she flirting or is she just being friendly
- Which animal begins with the letter p