*

Olegs

  • ****
  • 123 posts
Code sample
« on: November 08, 2019, 05:15:09 PM »
Hello,


I need to insert sample code in article, Like this one:
Code: [Select]
code with link to my webpage banner
I'm trying to use
Code: [Select]
[code]<a href="https://ado.lv” target="_blank"><img src="https://ado.lv/banners/Facebook-banner-1200px-x-628px.png" width="1200" height="628" style="border-width:0" alt="Bezmaksas sludinājumi"/></a>[/code]

But in editor this code doesn't works. Banner appears instead of a code. it is necessary that the client can copy the code

How i can do it?

thanks
« Last Edit: November 10, 2019, 12:09:34 AM by Olegs »

*

Dan Dan

  • ***
  • 40 posts
Re: Code sample
« Reply #1 on: November 10, 2019, 12:01:56 PM »
Try this code:
Code: [Select]
<a title="Your title" href="https://yoursite/" target="_blank"><img src="https://yoursite/oc-content/themes/stela/images//image.png" alt="Your title" width="400" height="100" border="0" /></a>
You can adapt it as you wish. Hope this is what you need.

*

MB Themes

Re: Code sample
« Reply #2 on: November 10, 2019, 01:30:55 PM »
You must escape html chars, best way is to replace:
< with &lt;
> with &gt;
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Olegs

  • ****
  • 123 posts
Re: Code sample
« Reply #3 on: November 10, 2019, 02:04:06 PM »
Try this code:
Code: [Select]
<a title="Your title" href="https://yoursite/" target="_blank"><img src="https://yoursite/oc-content/themes/stela/images//image.png" alt="Your title" width="400" height="100" border="0" /></a>
You can adapt it as you wish. Hope this is what you need.

No, this also dosnt works :(

*

Olegs

  • ****
  • 123 posts
Re: Code sample
« Reply #4 on: November 10, 2019, 02:06:36 PM »
You must escape html chars, best way is to replace:
< with &lt;
> with &gt;

You mean like what?

&lt;a href="https://ado.lv” target="_blank"><img src="https://ado.lv/banners/Facebook-banner-1200px-x-628px.png" width="1200" height="628" style="border-width:0" alt="Bezmaksas sludinājumi"&gt;


this works only once save, if I then edit the text in this article, then everything disappears, the code is automatically redone with < >, chars  &lt; &gt; disappears
« Last Edit: November 10, 2019, 04:15:51 PM by Olegs »

*

MB Themes

Re: Code sample
« Reply #5 on: November 10, 2019, 06:29:03 PM »
Well that is because it is then parsed as non-html char
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Olegs

  • ****
  • 123 posts
Re: Code sample
« Reply #6 on: November 10, 2019, 06:47:47 PM »
Well that is because it is then parsed as non-html char

have you any ideas?

*

MB Themes

Re: Code sample
« Reply #7 on: November 10, 2019, 08:45:49 PM »
maybe trying strip_tags, htmlspecialchars and similar to put when showing content in admin.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots