- Learning Joomla! 3 Extension Development(Third Edition)
- Tim Plummer
- 467字
- 2021-08-13 16:29:29
Where do I start?
To get started with plugin development, first we need to decide what problem we are trying to solve or what functionality we are trying to implement.
Let's assume that you have a website with various phone numbers listed on the site, and that this site is popular with people who access the site through a smartphone. Currently, to call one of the numbers, the user has to remember the number to dial it, or perhaps they jot it down on a piece of paper or attempt to select and copy the number through their browser. This is not very user-friendly, a much better way to do this would be to change the phone number to a click-to-call link, so the user can just click the phone number and their phone will call it. Now, you could go through the website and manually change all the phone numbers to these links, but that would be inconvenient. Assuming our phone number is in the format 1234-5678, we could change it to this HTML code to create a click-to-call link.
<a href="tel: 1234-5678">1234-5678</a>
Wouldn't it be better if we wrote a plugin that identified phone numbers in all our Joomla! articles and automatically changed them to these click-to-call links? Well that's exactly what we are going to do.
The following screenshot is an example of what the plugin will do when we have finished creating it. When a mobile user clicks on the phone number, it will allow them to easily call the number.

So now that we know what we are trying to achieve, the first thing to do would be to check the Joomla! Extension Directory (JED) to make sure that a solution to this problem does not already exist. Why reinvent the wheel if you can find something that already does the job or does something similar you could adapt? So let's assume that we've had a look at the JED (http://extensions.joomla.org) and we can't find a suitable plugin and we want to create our own.
The next step is to come up with a unique name for this extension; in this case we will call it as plg_content_clicktocall
. The first part of the name ( plg
) indicates that this is a plugin extension. Then we identify what type of plugin this is; in this case, it's a content plugin. Then we add our unique name, preferably something short that describes this plugin; in our case, this is clicktocall
. Once you have a name, it's a good idea to search the JED and Google to make sure that it is truly unique as you will have problems listing the extension on the JED later if it is not unique. Many developers add their initials or business name to the extension to avoid name conflicts.
- pcDuino開發實戰
- Social Media Mining with R
- 網絡操作系統:Windows Server 2003管理與應用
- Hands-On DevOps with Vagrant
- 玩到極致 iPhone 4S完全攻略
- 高性能Linux服務器構建實戰:運維監控、性能調優與集群應用
- Installing and Configuring Windows 10:70-698 Exam Guide
- 網絡操作系統管理與應用(第三版)
- 巧學活用Windows 7
- Kali Linux高級滲透測試
- Linux應用大全 基礎與管理
- OpenHarmony開發與實踐:基于紅莓RK2206開發板
- Linux內核分析及應用
- Website Development with PyroCMS
- Linux服務器配置與管理完全學習手冊