Once you are familiar with the principle of linking modules, you may wish to consider what method you are using. Using a different JavaScript method can ensure your interactivity works perfectly in different scenarios.

When we say method, we are referring to the portion of the JavaScript command/URL highlighted below:
JavaScript: ptiLinkClicked(null, 7, 5727);

Please note, all examples below are case sensitive.

Method for templates

All interactive modules have unique ID numbers (represented by the number 5727 in the example above). Using the ID will work perfectly for one-off issues, however, if you use this method in a template and subsequently use this template, the new modules created from will have new unique ID numbers. This is an issue as the JavaScript command or URL configured in the template will not update automatically. Your modules will no longer link together as you intended.

The solution is to replace the ptiLinkClicked() method with the ptiLinkClickedUsingTitle() method. The difference is this method will use the name and location of the module instead of its ID number.

The ptiLinkClickedUsingTitle() method uses the module name and location instead of its ID. It uses this syntax:
ptiLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

To configure this method:

  • Set containerElementID to ‘null’
  • Set type to the same number as in the original method, this is ‘7’ in the above example
  • Set pageindex to the page that the module is placed on, bearing in mind that the index starts with the first page as ‘0’, so this number will be one less than the actual page number
  • Set moduleTitle to the precise string of text in the Name field of the module. This is case and space sensitive

Method from popup to popup

Sometimes using the default method when linking from one popup to another can yield unexpected results. To avoid any issues, substitute the default method with ptiClosePopupLinkClicked(). This method uses the same credentials as the default module, so the method itself is the only thing you will need to change.

The ptiClosePopupLinkClicked() ensures the current popup box is closed completely before initiating the next popup. This guarantees a smooth experience for your readers.

To configure this method, replace the 'ptiLinkClicked' portion of the command/URL, with 'ptiClosePopupLinkClicked'.

Combination of these methods

There are likely to be scenarios where you are linking from popup to popup within a template. There is a method that combines the functionality above. To use this method, you will need to use the same credentials as the ptiLinkClickedUsingTitle() method.

For templates you can use the ptiClosePopupLinkClickedUsingTitle() method. This method uses the following credentials:
ptiClosePopupLinkClickedUsingTitle(containerElementID, type, pageIndex, moduleTitle)

To configure this method:

  • Set containerElementID to ‘null’
  • Set type to the same number as in the original method, this is ‘7’ in the above example
  • Set pageindex to the page that the module is placed on, bearing in mind that the index starts with the first page as ‘0’, so this number will be one less than the actual page number
  • Set moduleTitle to the precise string of text in the Name field of the module. This is case and space sensitive

If you would like to learn more about what JavaScript modules are available, see this article.

Did this answer your question?