7 votes
Accepted

Joomla Terminology: view, layout, task and component development

Running ahead a little bit let me provide you with link to JooYii Library. This library makes a leap ahead brings some practices that would be at Joomla! 4 to current Joomla! 3.x branch along with ...
Alexandr's user avatar
  • 1,130
6 votes
Accepted

Extension manifest to set version as 3.4 or greater

You don't have to use only 2.5 or 3.0, you can also use 3.4 or any other Joomla version: <extension type="component" version="3.4" method="upgrade"> The version attribute specifies the minimum ...
fruppel's user avatar
  • 3,723
6 votes
Accepted

with insert on duplicate key update - updating multiple rows at once

Building a REPLACE INTO query is just as simple as building an INSERT ... ON DUPLICATE KEY UPDATE. Note that there is a difference between REPLACE INTO AND ON DUPLICATE KEY UPDATE. Code: $columns = ...
mickmackusa's user avatar
  • 4,781
5 votes

Standalone PHP calling Joomla APIs

Firstly, you're importing the wrong files which are required when using the Joomla API. You then also need to initialise the application. try the following: define('_JEXEC', 1); define('JPATH_BASE',...
Lodder's user avatar
  • 26.9k
5 votes

Remove /component/ from URL generated from module for a custom component

The /component/name/ part of the url is automatically written by Joomla router when there is no matching menu item found. This is required for the application to route the command to the proper ...
Nagarjun's user avatar
  • 2,991
5 votes
Accepted

Using external library with a component

If you're only ever using a library within a single component then there's no reason not to include it in a folder in the component - this is the way that distributed components will generally handle ...
jamesgarrett's user avatar
  • 3,299
5 votes
Accepted

How to generate a dynamic note field for a custom component?

Use Form::setFieldAttribute(). Typically, this is done in the model's getForm() method. However, if it's cosmetic only, it can be done in the view too. In /administrator/com_image/models/forms/image....
Sharky's user avatar
  • 10.9k
5 votes
Accepted

How to use HTMLHelper to add to the document head

1) JHtml is an alias for Joomla\CMS\HTML\HTMLHelper class. You'll have to start using the real class sooner or later because the alias will not exist in Joomla! 5.0. To use the real class you have to ...
Sharky's user avatar
  • 10.9k
5 votes

Content plugin doesn't add text to articles

Your plugin appears to be written for a very old version of Joomla! The event in current versions is onContentBeforeSave. You are also missing $context argument. It's a good idea to check for context ...
Sharky's user avatar
  • 10.9k
5 votes

'getErrorMsg' is deprecated in Joomla 4 and what would be the equivalent

I try to give just a short answer on this. We cannot say that there is an “equivalent” of your code snippet in Joomla 4 since Joomla has been handling errors with using core PHP Exceptions. And your ...
Zollie's user avatar
  • 2,896
5 votes

New files in Joomla 4 components

An excellent resource for Joomla 4 extension development is "Joomla 4.x Tutorial - Extension Development - The Way to Joomla 4 Extensions" written by Astrid Günther: https://blog.astrid-...
pe7er's user avatar
  • 1,948
5 votes
Accepted

New files in Joomla 4 components

services/provider.php should return a service provider which is used to register services with the service container and set up initial dependencies. This is the only file with a hardcoded filename ...
Sharky's user avatar
  • 10.9k
4 votes
Accepted

How to change styling of Joomla Collapsible Sidebar in Backend?

Well, as per my answer from the link you provided, you'll need to add the following to your default.php: <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> &...
Lodder's user avatar
  • 26.9k
4 votes
Accepted

Can I add class attribute in JHTMLGrid?

First of all, this documentation is very old. Latest is here. You can't just add class to that. You would have to create your own JHtml* class and override it there. Following is just example, you ...
Rene Korss's user avatar
  • 3,208
4 votes

Calling Joomla!'s Default 404 Page

In your Joomla installation directory reach templates/themeXXX/error.php file. Edit the error.php file as shown below, locate this line of code: If you don't want to change address bar url then you ...
Sudhir Sapkal's user avatar
4 votes
Accepted

Joomla 3.9.1 publish/unpublish no longer working (custom components)

Inside your table's constructor use setColumnAlias() to define the actual column name: public function __construct($db) { parent::__construct('#__example', 'id', $db); $this->...
Sharky's user avatar
  • 10.9k
4 votes
Accepted

Select articles to display in custom component

JControllerLegacy::getInstance() caches the first controller instance so you're actually getting an instance of your component's controller rather than Content controller. You can skip the controller ...
Sharky's user avatar
  • 10.9k
4 votes

'JEventDispatcher' is deprecated in Joomla 4 and what is the replacement

The ideal way is to have dependencies injected into your objects. Event dispatcher is registered with the global service container so you can fetch it when registering your component services in ...
Sharky's user avatar
  • 10.9k
4 votes

How to create a (better) development environment for Joomla 4

I've not used Docker so I can't help with that, but I have xdebug set up on my local environment in combination with PHPStorm and that is a big help in enabling me to figure out why something's not ...
Grant Hood's user avatar
3 votes
Accepted

Importing Joomla CMS to custom PHP script (outside root folder)

This is because the JPATH_BASE value needs updating as you've moved the file into a new directory. So replace this: define('JPATH_BASE', realpath(dirname(__FILE__).'/')); with this: define('...
Lodder's user avatar
  • 26.9k
3 votes
Accepted

Check a form field for duplicates before saving

The best place is your table class before storing data. For example below code in store function of table class. public function store ($updateNulls = false) { if ($table->load(array('alias' =&...
Nagarjun's user avatar
  • 2,991
3 votes
Accepted

Purpose of metadata.xml

So the purpose of metadata.xml is storing the data that need to be shared across layouts: each layout.xml inside of your view tmpl directory extends metadata.xml. So if you need to put some request ...
Alexandr's user avatar
  • 1,130
3 votes

Loading custom classes in a component automatically

If the utility classes are only used in your component then include them in a folder within your administrator component. Whether you register the classes with JLoader or just require_once them just ...
jamesgarrett's user avatar
  • 3,299
3 votes
Accepted

Bulk insert records in database from excel

I solved the issue. Problem was that when insert query was called in a loop 2000 times, deadlock occurred and returned a blank page. The solution to this is to construct one single insert query and ...
Liz.'s user avatar
  • 1,375
3 votes
Accepted

Subform multiple data not saving

In your table's bind function, add this: if ( ( !empty( $array[ 'list_links_url' ] ) && ( is_array( $array[ 'list_links_url' ] ) ) ) ) { $this->_jsonEncode[] = "list_links_url";...
Stuart Steedman's user avatar
3 votes
Accepted

Redirect after login by component

You can create a plugin that triggers on onUserAfterLogin and redirects the user to where you want. or you can add a &return= query variable to your links to the login page as described here
Drew G's user avatar
  • 890
3 votes

Set Prefered Template with parent:display()?

You can force the template style like this: $templateStyleId = 3; // set here the template style id $app = JFactory::getApplication(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/...
Dennis Heiden's user avatar
3 votes

Create SEF URLs from a Custom Component that does not search on database

One thing is, that you're trying to create a router in the old way, it changed over time. Now router is a class. Second thing is, one of your component views have to be set as a front-page for a ...
Artur Stępień's user avatar
3 votes

Proper Way to Migrate Custom Website to Joomla

You can certainly add CSS or JavaScript by creating a plugin or module but the quickest and easiest way to do this is probably using a third party extension such as the EasyScript plugin or the Flexi ...
Neil Robertson's user avatar
3 votes
Accepted

onUserAfterLogin popup - Joomla 3.6.4 Plugin

The return value of onUserAfterLogin() should be a boolean -- ie true or false. The idea is that you can use this event handler to do additional validation on the login, so if you return false, it ...
Simba's user avatar
  • 610

Only top scored, non community-wiki answers of a minimum length are eligible