Elxis CMS Forum

Extensions => Modules => Topic started by: seadhna on February 17, 2021, 13:46:17

Title: Responsive Content Image Slider - change img src based on language?
Post by: seadhna on February 17, 2021, 13:46:17
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'); }
         }
      }
Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: nikos on February 17, 2021, 23:34:46
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 (https://www.elxis.net/edc/miscellaneous/117.html) 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.

Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: seadhna on February 19, 2021, 13:47:42
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?
Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: nikos on February 20, 2021, 01:59:11
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.
Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: seadhna on February 25, 2021, 12:14:55
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.
Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: nikos on February 25, 2021, 21:58:15
@Seadhna The module has already many parameters covering various cases (auto content, folder images, user images), but can not cover all custom needs of users, as yours. As it is now, selecting user images you can display up to 6 different images with different title and different link to each one, but only once and not multiple times (making copy of the module) having different images directory than default (modules/mod_rcis/images) each time, as you want. And as I already mentioned maybe in a next update, to cover your custom need.
Title: Re: Responsive Content Image Slider - change img src based on language?
Post by: seadhna on February 28, 2021, 13:07:02
which is why I posted my original question wondering if it was possible to amend your module myself for my custom needs. This conversation is circular.