Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
How to paste code (HTML/Javascript/CSS) so it doesn't render in a post
Avatar
Vic Dorfman
Member
sp_UserOfflineSmall Offline
Jun 2, 2015 - 8:19 am

Hi All,

My forum is of a technical nature and I often need to post HTML snippets, shortcodes, Javascript snippets, etc., to demonstrate various how-to scenarios.

How can I post my code without it rendering?

Best,
Vic

Vic Dorfman - Membership Site Expert

http://www.VicDorfman.com

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Jun 2, 2015 - 8:23 am

Hey Vic,

Have you taken a look at the 'Syntax Highliter' plugin? Available from the Downloads page > Member Plugins.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jun 2, 2015 - 8:26 am

My recommendation would be to use the tinyMCE rich text editor and install our Syntax Highlighter plugin. So - for example - a small section of php code I have been working with today would display like:

add_action('genesis_meta', 'sp_home_genesis_meta');
function sp_home_genesis_meta() {
    if (is_active_sidebar('content-top-left') || is_active_sidebar('content-top-right') || is_active_sidebar('content-bottom')) {
        remove_action('genesis_loop', 'genesis_do_loop');
        add_action('genesis_loop', 'sp_home_loop_helper');
        add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
    }
}

Supports a variety of languages and, of course, your users can just use the raw code button and cut and paste.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Vic Dorfman
Member
sp_UserOfflineSmall Offline
Sep 9, 2015 - 1:39 am

I've installed this plugin and my TinyMCE editor is active.

But how do I make the Syntax Highlight button appear in my editor?

Here's my editor:

http://prntscr.com/8e9mqs

And here are my components settings:

http://prntscr.com/8e9mse

Please advise.

Best,
Vic

Vic Dorfman - Membership Site Expert

http://www.VicDorfman.com

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 9, 2015 - 3:46 am

It should self-configure. Just in case it did not for some reason, can you check the options at Options > Content Settings - bottom left. Make sure it is checked on to load in the forum editor and has some languages listed.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Vic Dorfman
Member
sp_UserOfflineSmall Offline
Sep 9, 2015 - 5:00 am

Ah, it doesn't autopopulate the languages.

Once I selected some languages the button appeared.

Thanks.

Vic Dorfman - Membership Site Expert

http://www.VicDorfman.com

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 9, 2015 - 6:39 am

Thanks for letting me know. I will check up on whether it should which might be better.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626