*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
How Can I Write Code in Blog?
« on: October 30, 2023, 10:27:21 AM »
Hello,

Thanks in Advance.

There is one problem, when I writing codes in Blog, after publishing blog code hidden or deleted...

I want to write some blog solution with coding like php, python or others.

How to add these codes in blog title.  Please help me to solve this issue.

Thanks   
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Re: How Can I Write Code in Blog?
« Reply #1 on: October 31, 2023, 03:57:55 PM »
Can you reproduce on demo? Do you use code block to write code?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #2 on: October 31, 2023, 06:54:21 PM »
Actually when I am pasting below code in blog article source code then it convert to result. But I want to show code in article. Show that user can see this. Like I am pasting here and you can see code. 

<!DOCTYPE html>
<html>
<head>
    <title>PNG to JPEG Converter</title>
    <script>
        function convertToJPEG() {
            const input = document.getElementById("fileInput");
            const file = input.files[0];

            if (file) {
                const reader = new FileReader();
                reader.onload = function(e) {
                    const img = new Image();
                    img.src = e.target.result;
                    img.onload = function() {
                        const canvas = document.createElement("canvas");
                        const ctx = canvas.getContext("2d");
                        canvas.width = img.width;
                        canvas.height = img.height;
                        ctx.drawImage(img, 0, 0);

                        const jpegData = canvas.toDataURL("image/jpeg");
                        const jpegLink = document.createElement("a");
                        jpegLink.href = jpegData;
                        jpegLink.download = "converted.jpg";
                        jpegLink.click();
                    };
                };
                reader.readAsDataURL(file);
            }
        }
    </script>
</head>
<body>
    <div style="text-align: center;">
        <h2>PNG to JPEG Converter</h2>
        <input type="file" id="fileInput" accept="image/png">
        <button onclick="convertToJPEG()">Convert to JPEG</button>
    </div>
</body>
</html>
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #3 on: November 02, 2023, 07:29:07 AM »
Please tell me How to write code in blog..
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Re: How Can I Write Code in Blog?
« Reply #4 on: November 02, 2023, 05:18:13 PM »
Not sure how you did that, if there is no code snippet in TinyMCE right now (in plugin).
I tested their snippet:
https://plugins2.abprofitrade.eu/blog/article/code-test-b10

It works, but when you try to edit again, code is not shown as code, but is executed.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #5 on: November 02, 2023, 07:14:37 PM »
Yes.. when I saved article.. code is showing in frontend but in backend code invisible... Is there any option to show code as text.

And as you also checked that if you want to edit that article you can not edit because code is not there.. 😞
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Re: How Can I Write Code in Blog?
« Reply #6 on: November 02, 2023, 07:21:07 PM »
Pretty sure Osclass encode whole code to avoid harmful code be stored in database
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #7 on: November 06, 2023, 01:51:15 PM »
Means there is no solution for this.
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Re: How Can I Write Code in Blog?
« Reply #8 on: November 06, 2023, 08:26:38 PM »
No there are just some tips to try pre-processing of content but I do not like those options.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #9 on: December 20, 2023, 08:31:53 AM »
I think its solved in new update, because after updating there is an option for inserting sample code..

still I didn't write any blog with code... but this is excellent feature if I can write code now..

OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 171 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: How Can I Write Code in Blog?
« Reply #10 on: December 20, 2023, 08:39:07 AM »
Yes, its working...

I Have write an article with code... now its working perfectly...

Nice Update  :) :)
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Re: How Can I Write Code in Blog?
« Reply #11 on: December 20, 2023, 09:27:50 AM »
Cool  8)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots