Jump to content

[SOLVED] How do I embed JavaScript right into the body?


Boost
 Share

Recommended Posts

Hei,

I have a career page where we use a external app to show our availables positions. Currently, we do that by adding this embed code to the page:

<script type="text/javascript" src="https://web106.reachmee.com/customerjs/helper.js"></script>
<script type="text/javascript" src="https://web106.reachmee.com/customerjs/I002-1350-6.js"></script>

My question is, how do I do that with ProcessWire? ? 

I tried most of the Textformatter and nothing worked. I also tried using a textarea field, but no luck. Ideally, I would like to do this via TinyMCE, is that possible?

Cheers.

Link to comment
Share on other sites

7 hours ago, Boost said:

how do I do that with ProcessWire?

As most times when it comes to ProcessWire, there's about a million ways to do it.

I'm curious why Textarea / Textformatter didn't work. Did you have HTML entity encoder enabled on the fields?

A very handy tool for embedding code which you normally wouldn't want editors to enter directly is Hanna Codes. You'd define and insert a tag like [[jobs]] (or [[job number="I002-1350-6"]] if you need to pass on variable parameters) into your field (could be Textarea, CKEditor or TinyMCE) and activate TextformatterHannaCode in the field's configuration. (This would also give you the chance to try out my module Hanna Code Dialog for TinyMCE).

You could, of course, also create an individual template with the JS code, or extend your existing template with a checkbox (plus any text field for parameters to the JS) and have your PHP template conditionally render the script tags.

It's possible to allow the direct insertion of script tags in CKEditor and TinyMCE, but I consider that a door better left closed for security reasons.

  • Like 2
Link to comment
Share on other sites

  • Boost changed the title to [SOLVED] How do I embed JavaScript right into the body?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...