Condition Module

With a module, Joomla have following filters to show/hide the module:

  • Start - Finish Publishing: Display the module in the time period
  • Access: Display module based on User access level (guest, member, admin)

Question: Have you ever thought how to show/hide module with advanced variables? For example, based on the value of the input variables.

Example:

I have a module (ID=1) and I put it in the search page. I want this module to display only when the keyword is "Hello".

Obviously, with Joomla basic filters you can't do this. That's why I wrote this module ;).

-------------------

>> Download the module here: Buy Now ( $13 )

After downloading, you need install it via Joomla installer. Next, go to Module Manager > New > Condition Module to get started.

In this module, you will see two fields:

  • PHP Condition.
  • List Modules

Going back to the example above, you will solve this issue if enter this code into PHP Condition.

<?php
$q = @$_REQUEST["q"];
return $q=="Hello";

And this code into List Modules.

{loadmoduleid 1}

Note: This module is only for those who know about the PHP language.

You may also like

K2 to Content Migration

The Best Articles Comment Extensions on Joomla 4

JoomHelper Custom HTML

Say something here...
You are a guest ( Sign Up ? )
or post as a guest
People in conversation:
Loading comment... The comment will be refreshed after 00:00.
  • This commment is unpublished.
    Nick · 2 years ago
    No luck with the example code above. The module is not showing up.
    • This commment is unpublished.
      David · 2 years ago
      @Nick In your case, it should: return strtolower($searchword)=="hallo";
      "Hallo" # "Hello"
    • This commment is unpublished.
      Nick · 2 years ago
      @David I tried again with (But no luck) ->

      My Search URL:
      /index.php/component/search/?searchword=hallo&ordering=newest&searchphrase=all

      PHP Condition:
      <?php $searchword = @$_REQUEST["searchword"]; return $searchword=="Hello";
      List Modules:
      {loadmoduleid 67}
    • This commment is unpublished.
      David · 2 years ago
      @Nick The module will show if your URL have ?q=hello😉

Powered By JLex Comment.