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 ...
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 ...
6
votes
How can include the component view in plugins
From joomla 3.0 onwards a layout sharing feature is introduced, using it you can call a layout across views or extensions. It requires creating a layout object and then render the view using that ...
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 = ...
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',...
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 ...
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 ...
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....
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 ...
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 ...
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-...
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 ...
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; ?>
&...
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 ...
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 ...
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->...
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 ...
4
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 ...
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 ...
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' =&...
3
votes
How to set name for Administrator Menu Section of a Component?
The format you are using is normally associated with sub-menu's - I think the tutorial is incorrect/out of date — in our components the main administration menu item looks like this:
<menu img=...
3
votes
Accepted
Joomla.submitbutton (...) stops working after 3.4.2 update
It turns out my problem was caused by the use of the onsubmit="" event at the form tag. NOTE: This is back-end code, I only have this problem when using the JToolBarHelper::buttons();
Here is what I ...
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('...
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 ...
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 ...
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 ...
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";...
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
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 . '/...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
custom-component × 271joomla-3.x × 110
component × 56
development × 28
joomla-4.x × 26
php × 16
mvc × 13
custom-field × 11
custom-module × 11
view × 11
plugin × 10
form-fields-types × 10
model × 10
jroute × 10
mysql × 9
database × 9
jform × 9
xml × 9
extensions × 8
menu-item × 8
form × 8
administrator × 7
joomla-api × 7
ajax × 7
jtable × 7