11
votes
Accepted
How to conditionally show fields in module xml?
You can use Joomla's showon attribute in your field.
Here's an exmaple:
<field name="first" type="list" label="Select Something">
<option value="1">Option 1</option>
<...
10
votes
How to display module in component area
To enhance the given answers here:
To include a modul position in your component view and to load modules there, you just have to add
echo JHtml::_('content.prepare', '{loadposition ...
7
votes
Accepted
How to get module parameters inside helper function and how to get params inside a custom form field type?
1. How to get Modules parameters inside Helper Function
You are going all wrong with this.
First, you can't use $this inside a static method, because they are independent of any instantiated object. ...
7
votes
How to get module parameters inside helper function and how to get params inside a custom form field type?
I much prefer going for the OOP approach. This is what I use in one of my extensions. It's Ajax based so I have a separate function to get the parameters.
helper.php:
class ModSomethingHelper
{
...
7
votes
Accepted
How can I make a site like StackExchange with Joomla?
Theres a whole Questions and Answers category in the JED including:
JE Stack Exchange (free)
JE Stack Exchange Pro (paid)
Minitek Discussions Pro (paid)
which seem to have the basic functionality of ...
7
votes
What does "Prepare Content" do and when should it be used?
Prepare Content will enable the onContentPrepare plugins event for the content of the module. So the custom html module's html content will go through the process of content plugins, similar to what ...
6
votes
Accepted
Is there any equivalent event to onContentAfterSave for Modules?
Yes, Administrator Modules component fires onExtensionAfterSave, context com_modules.module.
6
votes
Accepted
Chrome problem: How to remove the div class=”custom” from a Joomla module
The solution was to create a module override of \modules\mod_custom\tmpl\default.php
The offending code in that file was
<div class="custom<?php echo $moduleclass_sfx ?>" <?php if ($...
6
votes
Output of modules
The function is extremely handy when your template has some complex grid flexibility. Lets take the following into consideration:
You have a template with a 12 column grid.
_________________________
...
6
votes
Accepted
How to add CSS/JS/an Image to a module backend
I personally do this in my extensions by creating a custom field:
XML:
<fieldset name="something" label="Something" addfieldpath="/modules/mod_xxx/fields">
<field type="testfield" />
...
6
votes
Accepted
Create a table observer
This was working ok on my instance Joomla 3.9.22 with PHP 7.3.5 (and mysql). Then to test this I selected PHP 7.0.33 instead and it gave me an error:
Fatal error: Declaration of MyObserver::...
5
votes
Accepted
Template module names based on position
If you mean programatically, JModuleHelper should return the info you need.
$modules = JModuleHelper::getModules('position-1');
print_r($modules);
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
Generate and render a module on an article with PHP
A bit confusing your questions as is, especially when you say you can add it to the article using php, but then that you can't figure out how to add it...
If I am getting you right, you want to ...
4
votes
Available fields in Joomla XML manifest
There is also one other neat trick - when using Radio buttons, you can add Bootstrap class and they will look nicer. Look for class attribute in this code:
<field name="some-choices" type="radio" ...
4
votes
Accepted
Get all installed Joomla extensions and their version
Any extension that is installed, is stored in the database, in the #__extensions table. So you can run a simply database query to get the name and the manifest cache (which contains the version):
$db ...
4
votes
Accepted
Module title not getting from language file
The problem is I need to keep the language files inside en-GB folder
<languages>
<language tag="en-GB">language/en-GB/en-GB.mod_quickwrk.ini</language>
<language tag="en-GB"...
4
votes
Accepted
How to remove the default editor inserted in a custom module
Please check if your custom module XML file contains the following line:
<customContent />
This line is present in the default Joomla Custom HTML module, and inserts an editor field in the ...
4
votes
How to get module parameters inside helper function and how to get params inside a custom form field type?
Your main module file and template file will have $params variable created by Joomla! core.
If you have static methods, then pass that variable to function call:
class ModTestHelper
{
public ...
4
votes
Accepted
Publish/Unpublish module on a schedule
You definitely have to look at Regular Labs: Advanced Module Manager Pro
The pro version features Seasons, Months, Days, Time assignments, so you can schedule the appearance of your modules.
4
votes
Accepted
How do I get a watermark on a sigplus gallery?
I thought I had already done this before I posted but I tried again and got positive results
So after looking at a post about a supposed bug with an earlier version of the plugin there was a couple ...
4
votes
Accepted
Can Smart Search index menu items or custom modules?
To answer the question: The items indexed in the smart search are driven by the 'finder' plugins. Menu items and custom modules have no finder plugins, but you could write them. I don't know of any ...
4
votes
Accepted
Class not found in Joomla 4 when using JDate inside a function
I’m answering the question because it is obviously not a Joomla 4 core bug but a mistake in the developer’s coding and the problem would be the same in Joomla 3 too.
If you try to use a Joomla core ...
4
votes
Getting CSS style to vary with different module instances
I figured out my problems, so I thought I would answer my own question.
1) Different styling for different instances of the same module
Don't forget Joomla has unique module ids! And there's an ...
4
votes
Accepted
How to overwrite a module's .php to control what scripts it adds to the head of the doc?
module_name.php file can't be overridden.
Check to see if the module has options to disable the loading of its scripts - Many modules come with such settings.
If it hasn't, then you could propose ...
4
votes
Accepted
Unable to deploy updateserver for site module
You have to add a client element in your updater xml:
<client>site</client>
Joomla seems to take the admin as the default.
I tried out your xml and found that joomla was indeed finding ...
4
votes
Randomly render one of the modules in a given position
Have a look at the Module Helper documentation.
getModules(): Get modules by position
getModules(string $position) : array static
since 1.5
Arguments
$position string The position of the module
...
4
votes
Module title is not showing despite setting module title to yes
You are using a Gantry template, which likely has pre-defined module positions.
In the Hydrogen template that you're using, the module position will be getting called like this:
<jdoc:include type=&...
4
votes
Recommend a contact us module for Joomla 3
Most form extensions would be sufficient for this job.
For example with RSForm (paid extension), you can build almost any kind of forms and render them as a module, using the RSForm module in any ...
4
votes
Adding ajax call in a module for Joomla 4
To use J4 style or custom naming conventions with AJAX you have to convert the module to new service-based format. At a minimum, service provider (services/provider.php) needs to provide a module ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
module × 434joomla-3.x × 142
php × 44
component × 36
module-display × 35
joomla-2.5 × 31
plugin × 31
module-params × 28
articles × 27
development × 25
extensions × 25
custom-module × 23
templates × 20
ajax × 20
menu × 19
joomla-3.4 × 18
overrides × 18
jquery × 13
template-override × 13
javascript × 12
administrator × 12
joomla-3.3.x × 12
custom-field × 12
joomla-api × 11
database × 11