Hot answers tagged

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> <...
  • 26.6k
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

Where to place code in Joomla modules

helper.php: This file is where all your functions belonging to a class should go. It's basically the module version of a model for a component, so tasks such as performing database queries etc. The ...
  • 26.6k
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. ...
  • 19.6k
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 { ...
  • 26.6k
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 ...
  • 19.6k
6 votes
Accepted

Is there any equivalent event to onContentAfterSave for Modules?

Yes, Administrator Modules component fires onExtensionAfterSave, context com_modules.module.
  • 7,415
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 ($...
  • 2,330
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. _________________________ ...
  • 26.6k
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" /> ...
  • 26.6k
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

Can I get the architecture of my website (Joomla 1.5.23)

Switching on the template preview mode might help so you can at least see the module positions. This will help you figure where to go (i.e. which module in module manager) to edit particular text. ...
5 votes
Accepted

Module Manager - Search by Module ID? It is not easy to find/locate modules for editing

Search with id:123 where 123 is your module id. This works in most of the admin side to search by an id value.
5 votes

Where to place code in Joomla modules

Basically, mod_mymodule.php is a bootstrap page of your module. Here you will include helper file and call necessary function which resides in helper.php. you can put HTML code in tmpl/default.php ...
5 votes
Accepted

How can I customize/design the View Article page

If you would like to change the structure/styling for an Article view, you need to create a Template Override, all of which is explained here: http://docs.joomla.org/...
  • 26.6k
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);
  • 3,072
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 ...
  • 2,981
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 ...
  • 19.6k
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

Create custom language switcher module

You can easily create an override of that module from Template Manager, as explained here: http://docs.joomla.org/J3.x:How_to_use_the_Template_Manager#Creating_Overrides Just go into the "override" ...
4 votes

Backend module does not run jQuery / JavaScript script?

Your code has several errors, here's a couple: js.js You can't load scripts using <script> inside a .js file You shouldn't need to load jQuery at all, it's included in Joomla (and it's usually ...
  • 13.3k
4 votes
Accepted

How to add jQuery functionality in the backend of a module?

You will need to create a custom form field for this. So firstly, change the type of the field in your XML like so: <field name="brands" type="brands" label="Foreign Brands" /> Then in your ...
  • 26.6k
4 votes
Accepted

Adding ajax in Joomla Custom Module

Well in case you don't want to use Joomla Ajax Interface, you could also do it like this: You have a module and you have your component. The script code goes into a javascript file or the view of the ...
  • 346
4 votes
Accepted

Overriding the core layout for Featured Articles Component

Layout Overrides » Alternative Menu Items From your question I understand that what will fit your needs is to create an alternative menu item for the Featured Items menu item. This is almost ...
  • 19.6k
4 votes
Accepted

Get value from a repeatable field and use it in a module

I was hoping someone would eventually ask this question on here. I wrote a function for my first usage of repeatable form fields and use it for every extension I make now. Here is how you do it: ...
  • 26.6k
4 votes

Get value from a repeatable field and use it in a module

The above answer from @Lodder is correct, but you will also need to wrap the function with if (!function_exists('yourFunctionname')) { // ... proceed to declare your function } If you do not, ...
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 ...
  • 26.6k
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"...
  • 2,671

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