- 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.
- 白話區塊鏈
- Linux網絡內核分析與開發
- Windows Server 2019 Administration Fundamentals
- Linux內核觀測技術BPF
- jQuery UI Cookbook
- Advanced TypeScript Programming Projects
- Kali Linux高級滲透測試(原書第3版)
- Learn CUDA Programming
- 完美應用Ubuntu(第2版)
- 樹莓派+傳感器:創建智能交互項目的實用方法、工具及最佳實踐
- 物聯網操作系統AliOS Things探索與實踐
- 用“芯”探核:基于龍芯的Linux內核探索解析
- Linux指令從入門到精通(“十二五”國家重點圖書出版規劃項目)
- 鴻蒙操作系統開發入門經典
- ZooKeeper:分布式過程協同技術詳解