48
votes
Accepted
What is the proper way to make an AJAX call in component?
PLEASE NOTE THAT THIS ANSWER is already a few years old and was not
updated. Feel free to edit / comment if you think something is no longer exact.
Abstract
There is almost no really official way ...
26
votes
Accepted
Joomla 3.x extension development tutorial for a beginner developer
I will provide the list of my bookmarked links and a list with links for Joomla Development Books, with various resources all around Joomla Development. I hope they will be useful for anyone ...
20
votes
What is the proper way to make an AJAX call in component?
This is a late answer for this very well answered question, but I wanted to add this cut-to-the-chase solution for those that just need a simple way to get to their components's data with an AJAX call....
20
votes
Accepted
How to save Custom Fields in Core components
The AHA! moment - #__content no longer has the params column, so the following adjustments have to be made for the plugin to work with components/tables with attribs instead of params (which appears ...
18
votes
Accepted
How can I use a model of other component in my component?
You can import com_content models into the controller using addIncludePath() method:
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
addIncludePath() ...
17
votes
Accepted
Adding drag-n-drop ordering in component
There are some prerequisites and you have to do some modifications to your view template. But you don't have to develop this feature all on your own.
Prerequisites
You need a column ordering of type ...
16
votes
Accepted
How to create page only with modules and no component?
There isn't really a 'better way' than that.
The only other option is to check whether you're on the homepage in your template file. To check if you're on the homepage you can use the method ...
15
votes
Accepted
Joomla Component Tool or Scaffold?
One tool that I've used in the past is Component Creator: http://www.component-creator.com/en/.
This tool allows you to outline one table for free (more if you sign up for a paid package) as well as ...
14
votes
Accepted
Custom Component - Need to verify if user is logged in
You can use Joomla's user object for this.
$user = JFactory::getUser(); // Get the user object
$app = JFactory::getApplication(); // Get the application
if ($user->id != 0)
{
// you ...
13
votes
Best method to check if a component is installed/enabled?
I use this way:
// Check for component
if (!JComponentHelper::getComponent('<component name>', true)->enabled)
{
.....
}
<component name> - without "com_" prefix
13
votes
How to get the intro image of a joomla article
That code is looking in the article text you need to is in the images call. It is json encoded so you have to decoded it first.
$images = json_decode($this->item->images);
echo $images->...
12
votes
Adding joomla's default toolbar in a component view page
The best practice is to create the addToolBar() method inside your View class and then using JToolBarHelper class to create command buttons:
protected function addToolBar()
{
JToolBarHelper::addNew(...
12
votes
Accepted
Available fields in Joomla XML manifest
Numerous types of form field are built into Joomla, with many usefull fields like calendar, color picker, image picker, file upload, file selection etc.:
Available Fields
+---------------------+-------...
11
votes
What is the proper way to make an AJAX call in component?
Valentin answer is good but is a bit overly complex if all you need to do is add 1 or 2 ajax calls to a component that is already built. It's perfectly possible to get away with not making separate ...
11
votes
Accepted
Add a custom button to a core backend component
Here is a draft idea using a plugin:
You need to create a system plugin (I am not getting into that) and to use the event onBeforeRender. Inside you get an instance of your Toolbar and append the ...
10
votes
Accepted
When will the JxxxLegacy classes be deprecated?
So technically you start transitioning to the new MVC classes now - there's nothing stopping you. For example com_config in Joomla core is already using the new MVC classes.
However as you probably ...
10
votes
How to modify article structure?
I believe I have your solution, but do NOT hack the core. We felt forced to do that over the years, and we're still paying the price even today, missing updates, revisiting hacks everytime we do ...
10
votes
Accepted
Best way to include helper class in sub-controller : require_once or JLoader
Actually JLoader::register('TestHelper','/path/to/test.php'); dosen't load file, it just registers it to be able to autoload file if class is instantiated.
Do require it instantly, you want to use:
...
9
votes
Accepted
Structure folder of sql files in my component
As Milton already wrote you specify where those SQL files are in the install manifest file. There are three different locations for install, uninstall and update.
<install>
<sql>
...
9
votes
Accepted
How can I set the page title from a component
Ok, I've solved it. I removed the " " marks around $this->item->heading as follows:
$browserbar= $this->item->heading;
$document = JFactory::getDocument();
$document->setTitle($browserbar);
...
9
votes
Accepted
Multiple controllers in Joomla
I think you're confusing the purpose of your main / master controller (controller.php) and subcontrollers (everything in the /controllers folder). For more on this, see the docs.
The main controller ...
8
votes
Joomla Component Tool or Scaffold?
After writing numerous extensions for clients, I found myself following a lot of the same patterns over and over. To keep things DRY, I created a "component framework" that abstracts away most of the ...
8
votes
Understanding mvc way of component coding for both joomla 2.5 and 3 version
There is a good doc page explaining the differences between Joomla 2.5 and 3.x.
http://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_3_and_Joomla_Platform_12.2
The only thing to ...
8
votes
Joomla 3.x extension development tutorial for a beginner developer
I can recommend the official doc page. There is a section for developers which includes also tutorials. http://docs.joomla.org/Portal:Developers
David Hurley is currently doing a series of short ...
8
votes
How to find a missing component - Error: 404 Component not found
You can find what is the missing component by either checking what is the component assigned to that specific menu item that creates this page, or if there is no menu item for this page you can ...
8
votes
How to create a view with filters and pagination
Follow the below steps:
Filters:
1) Make sure to add all your filterable fields in your model constructor
public function __construct ($config = array())
{
if (empty($config['filter_fields']))
...
8
votes
Accepted
Click on custom button opens modal window
It's actually pretty simple.
In view.html.php, load modal library, if it's not already done:
JHtml::_('bootstrap.modal');
For adding button to toolbar, use:
// Toolbar object
$toolbar = JToolBar::...
7
votes
What is the proper way to make an AJAX call in component?
Valentin's answer is good.
I prefer a json controller that handles the encoding and error handling for this I created a json base class:
class itrControllerJson extends JControllerLegacy {
/** @...
7
votes
Accepted
Error when calling getItem method of external model
You may need to import the table classes also. Try calling JTable::addIncludePath(/path/to/other/component/tables); to bring them in.
7
votes
Joomla 3.x extension development tutorial for a beginner developer
Previous answers are comprehensive about Joomla Core MVC. As an alternative MVC for Joomla, FOF
https://www.akeebabackup.com/documentation/fof/introducing-fof.html#what-is-fof
https://github.com/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
component × 514joomla-3.x × 226
development × 102
custom-component × 52
php × 37
module × 36
mvc × 35
plugin × 30
extensions × 27
view × 26
joomla-2.5 × 22
joomla-api × 20
form × 18
ajax × 17
model × 17
administrator × 16
database × 15
mysql × 14
jform × 13
overrides × 12
menu-item × 11
articles × 10
templates × 10
joomla-3.4 × 9
menu × 9