3

For example, we have a module called MOD_PR_SLIDER. Which has this file: public_html/modules/mod_pr_slider/mod_pr_service.xml

I already copied that file in: public_html/templates/my_template/html/mod_pr_slider/mod_pr_service.xml But it does not work.

How do I override it?

  • 2
    You cannot override the XML file. – Lodder Nov 18 '16 at 1:10
  • 1
    Why would you like to override XML file? – webchun Nov 18 '16 at 2:33
  • @Lodder you can for a Blog view for example, it makes a menu item. – Eoin Nov 18 '16 at 20:31
  • @Eoin - View are PHP files, not XML ;) – Lodder Nov 18 '16 at 20:34
  • @Lodder No but you can create blog.xml and then rename it to myblog.xml and then you will have a nice shiney new blog view to choose from in the back end. So in a way, you are able to use an XML override. Although the original XML file still exists and works. If you did not change the name, would it not simply work as an override? – Eoin Nov 18 '16 at 20:45
5

I bow down to @Lodder experience and assume you cannot overcome this issue by overriding the XML. However, you still have two options:

Either edit the original XML file

Although, there may be reasons not to do this, for example if you wish to retain the original functionality. Also if there is ever an update, there's a chance your XML file will be overridden, which I assume is why you want to use an override in the first place.

Or make a new version of the module

You should check the license prior to doing so.

  1. Copy and paste all of the files from mod_pr_slider and then rename the folder, and files within.
  2. You would also need to go into the files and replace all instances of mod_pr_slider. The easy way to do that is
  3. It may seem like a pain to replace all of the names within files, but using a find and replace in a tool such as Sublime Text 3 makes it reasonably easy. I usually use the "match case" option too. In which case you should do a find and replace for

MOD_PR_SLIDER

mod_pr_slider

I recommend replacing all caps with all caps, so MOD_PR_SLIDER becomes MY_MOD_PR_SLIDER

  1. I would also check for versions without "match case" turned on as some devs capitalise things every now-and-then.

  2. When you do this you may find that you replace all of the language strings. You probably don't need to do this as the names will almost certainly be correct. The easy way to avoid this is to copy and paste the original language file and overwrite your new one when finished. If you do need to overwrite them you need to create new language strings.

If you're going to replace the language strings here a resource for language overrides. http://www.inmotionhosting.com/support/edu/joomla-3/languages/overrides

Be careful with the update file, the last thing you want is to leave that untouched and it decides to update your new module using the old link. Renaming things should stop it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.