#1 April 24, 2014 12:39pm

michael
Member
Registered: April 24, 2014
Posts: 2

Need to Inject Simple JavaScript In Various Pages, Is Module-Driven Callout Overkill?

I'm looking to include a snippet of JavaScript code that can be utilized across various pages and Templates, but may not be desired for all pages. This script loads in a simple widget similar to UserVoice,  The script snippet is not going to change, but if anything, there are only two configurable parameters when utilizing the snippet: url (required) and date start (optional). It's okay if these are hardcoded.

Based on the documentation, callouts are page-specific usually, but a module-driven callout seems like overkill here for a simple script include.Am I overthinking this whole thing?

Thanks in advance.

Offline

#2 April 24, 2014 12:44pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Need to Inject Simple JavaScript In Various Pages, Is Module-Driven Callout Overkill?

Generally callouts are meant for little blurbs of content specific to pages, but we have implemented module-based callouts in the past to re-use portions of content on multiple pages. I don't know all the details, but I don't think it's ridiculous to use callouts to implement a JavaScript snippet on certain pages.

BigTree 4.1 is going to introduce callouts as a more general field type where you could name the field "Snippets" and choose just a select group of snippet-based callouts for a given template -- hopefully it'll make use cases like this feel more natural.

Offline

#3 April 24, 2014 4:38pm

michael
Member
Registered: April 24, 2014
Posts: 2

Re: Need to Inject Simple JavaScript In Various Pages, Is Module-Driven Callout Overkill?

Thanks timbuckingham. I will definitely check these out, and am glad to know I won't likely need to implement a full module-driven callout for an include, and am glad to know that the future release might make the case feel more natural. Thanks again.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.