Post by angy101 » Wed Dec 01, 2021 7:29 pm

Hi I am new to Opencart development, I am using OC Version 3.0.3.8
I want to replace the

Code: Select all

<img src=
tags with

Code: Select all

<img new-src=
in all twig files, but only if a switch is "checked" in the admin of extension
what i have now in install.xml is

Code: Select all

  <file path="catalog/view/theme/*/template/*/*/*/*.twig">
    <operation>
      <search><![CDATA[<img src=]]></search>
      <add position="replace" ><![CDATA[<img new-src=]]></add>
    </operation>
  </file>

<file path="catalog/view/theme/*/template/product/product.twig">
    <operation>
      <search trim="true"><![CDATA[<img src=]]></search>
      <add position="replace"><![CDATA[<img new-src=]]></add>
    </operation>
</file>
but I want want the above code to "run"(ie. replace the tag) only when

Code: Select all

$this->config->get('module_plug_replace') == '1')
is true
Can some one help me please?
NOTE: I know new-src is not standard HTML
Last edited by angy101 on Wed Dec 01, 2021 8:16 pm, edited 2 times in total.

Newbie

Posts

Joined
Thu Nov 25, 2021 4:00 pm

Post by JNeuhoff » Wed Dec 01, 2021 7:36 pm

The

Code: Select all

<img ci-src=
is not part of a standard HTML4. So why would you want to replace them?

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by angy101 » Wed Dec 01, 2021 7:43 pm

Hi, I know its not standard but have some javascript that will handle it
the question is how to implement the if condition...
I'm very new to this ..

Newbie

Posts

Joined
Thu Nov 25, 2021 4:00 pm

User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by xxvirusxx » Wed Dec 01, 2021 8:12 pm

Why the heck you open many topics with same question?
And from many accounts?

viewtopic.php?f=198&t=226269#p832251

viewtopic.php?f=202&t=226364&p=832641#p832641

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by Gergely » Thu Dec 02, 2021 6:00 am

Hey xxvirusxx, you forgot this one:
viewtopic.php?f=198&t=226365#p832649

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm
Who is online

Users browsing this forum: No registered users and 265 guests