Combining Condition Rules

With the Pro version of ReReplacer, you can access the "Conditions" tab in the item edit. This allows you to determine where or when a replacement is done.

You can limit replacements based on virtually anything, including Menu Items, Categories, Dates, Users, Devices, Geolocation, Components, Templates, URLs, and much more. This way you can - for example - create replacements only for certain user groups, only available during certain seasons, or within certain components.

You can create re-usable Conditions Sets that can be shared by multiple replacements, and even across different Regular Labs extensions like Advanced Module Manager, Content Templater (not available for Joomla 4 yet), and Conditional Content (not available for Joomla 4 yet).

If no Condition Set is selected, or if a Condition Set has no rules, the replacement will be done on all pages of your website. As soon as you set one or more of the rules to Include or Exclude, the replacement will be limited to the pages/situations matching those rules.

Rules & Groups

Each Condition Set is made up of one or more Groups and Rules. This makes it incredibly flexible and versatile.

You can select your desired rules via a dropdown menu, adding more via the + Add Rule button, or removing existing ones via the - button.

You can use the same Rule type more than once, and you have the ability to combine different Matching Methods (AND/OR) by putting rules into Groups.

When you have more than one Rule in a Group, you will see a Matching Method inside that Group. And if you have more than one Group, you will also see a Matching Method at the top.

Condition Summary

When selecting rules in a Condition Set, a nice Summary will be displayed on the right, showing you a recap of where the module will appear on the site.

If no Condition Set is selected for a module, or if a Condition Set has no rules, the module will be shown on all pages of your website (that include the module position). As soon as you set one or more of the rules to Include or Exclude, the module will be limited to the pages/situations matching those rules.

Matching Method

You can of course use and combine any of the available rules.

To control how multiple rules are applied, there is a Matching Method option. This determines whether all or any of the rules need to be matched:

  • ALL: Will be published if ALL of the selected rules are matched at the same time.
  • ANY: Will be published if ANY (one or more) of the selected rules are matched at any time.

Note: When setting multiple rules to Exclude, the Matching Method should be set to ALL. Otherwise, using ANY would result in one Exclude condition to always match and the replacement to show everywhere else.

You can also combine and use different Matching Methods by adding multiple Groups of rules: you can set a global Matching Method for the groups, and an individual Matching Method for the rules in each group.

Rules States

Matching Method: Include
Matching Method: Exclude

When selecting a rule, you can give it two possible states/options:

  • Include: the replacement will be included in all pages that do match that rule
  • Exclude: the replacement will be included in all pages that do not match that rule

Else

The last option under the Conditions is an Else field. You can optionally tell ReReplacer to replace your search with something else in case the Condition Rules are not matched.

For example, you can replace [WELCOME] with a specific welcome text for all your registered users, and with some other text for non-registered users (guests).
Or replace {price} with $10 in the winter and $12 for the other seasons.

You can also select to Do Nothing to make it remove the searched content in case the rules do not match.


Below you find all the available rule types for ReReplacer, with the respective settings for each.

Menu Items

Condition Rule: Menu Items

Set the replacement to be included or excluded from any of the available menu items.

Also on Child Items

This option allows you to make the rule pass on menu items that are children of one of the selected menu items.
This is very useful when you regularly add menu items and don't want to update the Condition Set every time. Just select the parent menu item.

Include No ItemID

There will be pages on your website that have no specific menu item active. With this option, you can target those pages.

Home Page

Condition Rule: Home Page

Unlike selecting the home page (default) item via the Menu Items, this will only match the real home page, not any URL that has the same Itemid as the home menu item.

This might not work for all 3rd party SEF extensions.

Date & Time

The date and time rules use the date/time of your servers, not the ones of the visitor's system. 

Date

Condition Rule: Date

You can make the rule pass Before/After a specific date or, with the "Between" option, in a date range between two dates.

With the "Recurring" option, you can also select to apply the date range every year (so the year in the selection will be ignored).

Seasons

Condition Rule: Seasons

You can choose from these options:
Winter, Spring, Summer, Fall / Autumn

You can also select the hemisphere your website is located in:
Northern, Southern, Australia.

Months

Condition Rule: Months

You can choose from these options:
January, February, March, April, May, June, July, August, September, October, November, December

Days of the week

Condition Rule: Days of the week

You can choose from these options:
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

Time

Condition Rule: Time

You can make the rule pass Before/After a specific time or, with the "Between" option, in a time range between two times.

Format: 23:59

Joomla! Content

This rule is based on what Joomla content page is displayed, including Page Types, Categories, and specific Articles.

Page types

Condition Rule: Page types

You can choose from these options:
Archived Articles, Single Article, List All Categories, Category Blog, Category List, Featured Articles, Create Article

Categories

Condition Rule: Categories

Set the replacement to be included or excluded from any of the Joomla categories.

Also on Child Items

This option allows you to make the rule pass on categories that are children of one of the selected categories.
This is very useful when you regularly add categories and don't want to update the Condition Set every time. Just select the parent category.

Page Types

This option allows you further narrow the rule, to make it only pass on certain page types: Categories, Articles, Others.

Articles

Condition Rule: Articles

Set the replacement to be included or excluded from any of the Joomla articles.

Featured Articles

Condition Rule: Featured Articles

Set the replacement to be included or excluded from Featured articles.

Article Publish State

Condition Rule: Article Publish State

Set the replacement to be included or excluded from the available article publish states:

You can choose from these options:
Published, Unpublished, Archived, Trashed

Article Date

Condition Rule: Article Date

Set the replacement to be included or excluded based on any of these article dates: Created Date, Modified Date, Start Publishing, Finish Publishing

After selecting a Date Type, you can make the rule pass Before/After a specific date or, with the "Between" option, in a date range between two dates.

With the "Recurring" option, you can also select to apply the date range every year (so the year in the selection will be ignored).

Article Authors

Condition Rule: Article Authors

Set the replacement to be included or excluded from articles written by specific authors.

Article Content Keywords

Condition Rule: Article Content Keywords

Set the replacement to be included or excluded from articles containing your specified keywords in the content.

You can also turn on the 'Case Sensitive' option.

Article Meta Keywords

Condition Rule: Article Meta Keywords

Set the replacement to be included or excluded from articles containing your specified meta keywords.

You can also turn on the 'Case Sensitive' option.

Article Field

Condition Rule: Article Field

Set the replacement to be included or excluded based on the value of any Custom Field.

You can compare the custom field value with any of these methods:
Is equal to, Is not equal to, Contains, Contains one of, Does not contain, Begins with, Ends with, Is less than, Is greater than, Matches Regular Expressions

For complete details on how to use the Custom Fields rules, the Comparison Methods, and even how to use Relative Dates as part of your checks, see the dedicated Blog Post.

Visitors

Users

Condition Rule: Users

Set the replacement to be included or excluded based on the logged-in user visiting the page.

Access Levels

Condition Rule: User Groups

Set the replacement to be included or excluded based on the Access Level assigned to the logged-in user visiting the page.

User Groups

Condition Rule: User Groups

Set the replacement to be included or excluded based on the user group assigned to the logged-in user visiting the page.

Match all

Select to only let the rule pass if all of the selected user groups belong to the user at the same time.

Also on Child Items

This option allows you to make the rule pass on user groups that are children of one of the selected groups.
This is very useful when you regularly add user groups and don't want to update the Condition Set every time. Just select the parent user group.

Languages

Condition Rule: Languages

Set the replacement to be included or excluded based on the site Language used by the visitor.

This Languages rule differs from the core in that it allows a selection of multiple languages.

Devices

Condition Rule: Devices

Set the replacement to be included or excluded based on the device of the visitor. Keep in mind that device detection is not always 100% accurate. Users can set up their devices to mimic other devices. 

You can choose from these options:
Desktop, Tablet, Mobile

Operating Systems

Condition Rule: Operating Systems

Set the replacement to be included or excluded based on the operating system of the visitor. Keep in mind that operating system detection is not always 100% accurate. Users can set up their browsers to mimic other operating systems.

Browsers

Condition Rule: Browsers

Set the replacement to be included or excluded based on the browser of the visitor. Keep in mind that browser detection is not always 100% accurate. Users can set up their browsers to mimic other browsers

Mobile Browsers

Condition Rule: Mobile Browsers

Set the replacement to be included or excluded based on the mobile browser of the visitor. Keep in mind that browser detection is not always 100% accurate. Users can set up their browser to mimic other browsers

IP Addresses

Condition Rule: IP Addresses

Set the replacement to be included or excluded based on the IP Address of the visitor.

You can enter a comma and/or enter a separated list of IP addresses and IP ranges. For instance:
127.0.0.1
128.0-128.1
129

Geolocation

Geolocating is not always 100% accurate. The geolocation is based on the IP address of the visitor. Not all IP addresses are fixed or known.
To be able to use this rule, you need to install the Regular Labs GeoIP library.

Continents

Condition Rule: Continents

Set the replacement to be included or excluded based on the Continent of the visitor.

Countries

Condition Rule: Countries

Set the replacement to be included or excluded based on the Country of the visitor.

Regions

Condition Rule: Regions

Set the replacement to be included or excluded based on the Region / State of the visitor.

Postal Codes

Condition Rule: Postal Codes

Set the replacement to be included or excluded based on the Postal Code of the visitor.

You can enter a comma-separated list of postal codes (12345) or postal code ranges (12300-12500).

Miscellaneous

Tags

Condition Rule: Tags

Set the replacement to be included or excluded from any of the Joomla tags or tagged pages.

Match all

Select to only let the rule pass if all of the selected tags belong to the page at the same time.

Also on Child Items

This option allows you to make the rule pass on tags that are children of one of the selected tags.
This is very useful when you regularly add tags and don't want to update the Condition Set every time. Just select the parent tag.

Components

Condition Rule: Components

Set the replacement to be included or excluded from specific Components.

Templates

Condition Rule: Templates

Set the replacement to be included or excluded from specific Templates.

URLs

Condition Rule: URLs

The URL rule allows control over specific pages or groups of pages, with support for Regular Expressions.

You can enter (part of) the URLs to match, by using a new line for each different match.

You can also turn on the 'Case Sensitive' option, or select to treat the value as Regular Expressions.

Custom PHP

Condition Rule: Custom PHP

This gives you the opportunity to show or hide a replacement based on anything you can think of. You just need to know what PHP code you should use.

With PHP you can call on all data/information available in the variables, URL, database, etc. And then do your checks on this data. You can control the display by ending the PHP code with a return true or false based on your checks.

For examples and ready-to-use PHP scripts, check out the "Using Custom PHP Conditions" guide.

Other Condition Set

Condition Rule: Other Condition Set

You can also nest another existing Condition Set as part of the current Condition Set.

This allows you to add (or exclude) a set of rules from another Condition Set on top of the current Condition Set.