Six Handy Joomla! Programming Tips
Has this ever happened to you? Just as you're finishing a project, you learn something that could have saved you a lot of time—if only you had known about it earlier! You might feel happy that you figured it out but also frustrated that you didn't know sooner. To help prevent that situation from happening again, this article presents some practical tips that I was glad to learn (and wish I had known earlier). They just might help you to save a little time and frustration on your next Joomla project.
Where Did That Message Come From?
I often need to find out where in the program a specific error or warning message is created. If you're really familiar with how Joomla works internally, you might already know the answers. For those of us who either don't know the system that well or can't remember where we found something previously, here's a quick trick:
- Copy the exact error message to your computer's clipboard.
- Using your favorite search tool (Eclipse, NetBeans, grep, File Manager, etc.), search for the error text in a language .ini file. For example, in Eclipse, you could use the search shown in Figure 1.
- In this example, Eclipse will show the language file from Figure 2 in the search results.
- This result tells us that the language key for this message is as follows:
- Next, we search for that particular language key in a .php file. In this example, we learn that the specified language key is used in the following file (see Figure 3):
Figure 1 Search form for the .ini text.
Figure 2 Search results showing the .ini file.
COM_INSTALLER_MSG_DATABASE_OK
administrator/components/com_installer/views/database/tmpl/default.php
Figure 3 Search results for the language key.
Now we know exactly where to look when we need to make changes or fixes, or use similar logic somewhere else.