Page 1 of 1

Display code inside webpage

Posted: Fri Jul 01, 2016 8:47 am
by sfeher
Had a question from a client today that I've not seen before.

AC Gold R6 (I know, I know.... but I don't think that more recent versions are using anything different.... ).
Using the Tiny MCE HTML editor

Our cart uses the HTML Editor and they're managing a page on their site. They want to display some source code so that they can share an image and allow people to 'embed' the image in their own website. I cannot see a way to allow this within the HTML Editor -- nor am I certain that this could be functional within the site.

Anyone tried this?

Here, in this board, we can simply hit the "code" button above the window here and then:

Code: Select all

we can add whatever code we wish <a href="http://yahoo.com">to anywhere we wish</a> and it makes sense. 
The phpBB software knows that the code tag means that we should allow anything inside it to display....

Thoughts? Feasible? Am I nuts?

Re: Display code inside webpage

Posted: Fri Jul 01, 2016 10:19 am
by jguengerich
You should be able to use a text box:

Code: Select all

<asp:TextBox ID="Whatever" runat="server" Width="500" Text=""></asp:TextBox>
And set the Text property in code behind:

Code: Select all

// note you have to escape the embedded " with \ as usual with C# string literals
Whatever.Text = "we can add whatever code we wish <a href=\"http://yahoo.com\">to anywhere we wish</a> and it makes sense";
// or, more likely:
Whatever.Text = MyFunctionThatCreatesTheSourceCodeForCurrentUser();

Re: Display code inside webpage

Posted: Sun Jul 10, 2016 10:24 pm
by mazhar
TinyMC should have some plugin/extension to support embedded code blocks. You should be able to download and use code plugin by doing a custom initialization and asking for code plugin to be loaded and available. You may have to do it manually by using javascript instead of using ablecommerce's HtmlEditor control which initializes tinymce.

Code: Select all

https://www.tinymce.com/docs/plugins/code/