Extensions > Modules

Responsive Content Image Slider - change img src based on language?

(1/2) > >>

seadhna:
Hi there,
with the Responsive Content Image Slider by Nikos Vlachtsis, v1.3 (30 December 2020), I am wondering if it's possible to amend the mod_rcis.php file to stipulate a different image directory for 'user images' based on the language version of the site.

e.g. is it possible to include something like: <img src="/img/<?php echo $lang; ?>/image.jpg" /> somewhere within this: (I am not sure how to do it, the ways I have tried don't work).

         if ($this->source_content == 0) { // user images up to 6 items
            for ($i = 1; $i < 7; $i++) {
               $image = trim($params->get('image'.$i, ''));
               if (($image == '') || !file_exists(ELXIS_PATH.'/'.$image)) { continue; }
               $link = trim($params->get('link'.$i, ''));
               if (($link != '') && (!preg_match('#^(http(s)?\:\/\/)#i', $link))) { $link = $elxis->makeURL($link); }
               $target = (intval($params->get('linktype'.$i, 0)) == 1) ? '_blank' : '_self';
               $text = eUTF::trim(strip_tags($params->getML('text'.$i, '')));
               if ($text == '') { $text = $eLang->get('IMAGE').' '.$i; }
               $image = $elxis->secureBase().'/'.$image;
               $this->custom[] = array('text' => $text, 'link' => $link, 'target' => $target, 'image' => $image);
            }
            if (count($this->custom) == 0) { $this->errormsg = $eLang->get('ERRMSG5'); }
         }
      }

nikos:
Instead to modify the code of the module which I do not suggest, you can do it with the following way:

Install the plugin Include Module by which you can display a module into an article or a module.

Use the module Responsive Content Image Slider and select in parameters to display a folder images and publish it in a custom module position for example custom1
Make a copy of the same module and select in parameters to display a different folder images and publish it in a custom module position for example custom2

Create an article or a custom module (enabling to run plugins) and insert in the 1st language the Include Module plugin setting to show the modules of position custom1 and in the 2nd language insert the Include Module plugin setting to show the modules of position custom2.

seadhna:
Hi Nikos,
thanks for this suggestion! However, in my situation, I need to choose 'user images' because I need each image to link to a different article. If I follow your method, but choose 'user images' then both copies of the module use the same path for images - if I change the images on one, the images change in the other also, e.g. the path is: modules/mod_rcis/images/image1.png

Is there a way to make your method work for 'user images'? - e.g. remove this 'default renaming' of images?

nikos:
You asked at the beginning to show different images for any language and I gave you the above solution selecting folder images. Now you tell me that you want to show and different links selecting user images. As it is made the module this can not be done and I have to modify it, which means matter of time to work for this. Maybe in a next update to do it.

seadhna:
Hi Nikos,
I tried to be very clear in my original question that I was working with 'user images'. I'm sorry if that was not clear to you. I was asking the entire community if they had knowledge on my attempt to modify your module. I appreciate your taking the time to reply.

Navigation

[0] Message Index

[#] Next page

Go to full version