Display code inside webpage

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
sfeher
Captain (CAPT)
Captain (CAPT)
Posts: 220
Joined: Fri Jun 04, 2004 1:58 pm
Location: Steubenville, Ohio

Display code inside webpage

Post by sfeher » Fri Jul 01, 2016 8:47 am

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?

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Display code inside webpage

Post by jguengerich » Fri Jul 01, 2016 10:19 am

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();
Jay

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Display code inside webpage

Post by mazhar » Sun Jul 10, 2016 10:24 pm

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/

Post Reply