Skip to main content
8 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. ...
FFrewin's user avatar
  • 19.7k
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 { ...
Lodder's user avatar
  • 26.9k
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 ...
Neil Robertson's user avatar
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 ...
FFrewin's user avatar
  • 19.7k
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 ($...
TryHarder's user avatar
  • 2,340
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. _________________________ ...
Lodder's user avatar
  • 26.9k
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" /> ...
Lodder's user avatar
  • 26.9k
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::...
Robbie Jackson's user avatar
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);
RichardB's user avatar
  • 3,082
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
  • 3,001
5 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 ...
jamesgarrett's user avatar
  • 3,299
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 ...
FFrewin's user avatar
  • 19.7k
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" ...
Vladimir Jovanović's user avatar
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 ...
johanpw's user avatar
  • 13.3k
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 ...
Rene Korss's user avatar
  • 3,208
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.
FFrewin's user avatar
  • 19.7k
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 ...
Matt's user avatar
  • 481
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 ...
Zollie's user avatar
  • 2,946
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 ...
William's user avatar
  • 299
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 ...
FFrewin's user avatar
  • 19.7k
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 ...
Robbie Jackson's user avatar
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 ...
mickmackusa's user avatar
  • 4,826
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=&...
Grant G's user avatar
  • 714
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 ...
FFrewin's user avatar
  • 19.7k
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 ...
Sharky's user avatar
  • 11.5k
3 votes
Accepted

The mystery with the $content variable in Joomla Modules

Yes, $content is used for the module rendering. Check at /libraries/cms/modules/helper.php line 139 (function renderModule) Around line 176 $module->module = preg_replace('/[^A-Z0-9_\.-]/i', ...
José Sánchez Martín's user avatar
3 votes

How to add module's JavaScript in the header when in Javascript code used php variable

Assuming you are asking how to combine PHP and JavaScript, one way would be to add the JavaScript inline via your module's PHP using this method, which will add it to the head of the page when the ...
RichardB's user avatar
  • 3,082
3 votes

Show/hide module title not working

In the module manager under the Advanced tab change the Module Style to html5, or xhtml.
Tim Wilkinson's user avatar
3 votes
Accepted

How to show a module on every page?

If you assigned the module to all pages yet it still displays only on one page, then this might be caused by one of the following: You have not cleared your Joomla cache. The module is set to display ...
itoctopus's user avatar
  • 3,226
3 votes

Calendar Field Type

I would guess there's an implicit timezone conversion happening. It's saving the time as midnight GMT in the DB, but on re-display, it's converting it to local time.
George Sexton's user avatar

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