• MODX.com

    993 downloads

insert

insert is an extra by sepiariver, first released on 2013-07-23.

Package Description

Have you ever wanted to make CSS/JS changes to a Live site, and be able to privately preview those changes across various pages, without creating a bunch of "test" resources?In the default 'production' mode, this Snippet inserts css, js and/or html at the end of the head element or body element of the document, depending on the properties passed to it. In 'dev' mode, it optionally inserts alternate content only for specific Users, with a valid session in the specified Contexts.

Usage/Installation Instructions

This simply registers a CSS file and some HTML before the closing body tag. <code>[[insert? &css=`path/to/cssFile.css` &htmlAtClose=`<footer>No copyright. Do as you wish.</footer>`]]</code> This registers a JS file before the closing body tag only for the User whose ID is `1`. <code>[[insert? &jsAtCloseForUser=`assets/devJs.js` &userId=`1` &mode=`dev`]]</code> This registers devCssFile.css for Manager Users and cssFile.css for others. The &mode property must be set to `dev` for this result. <code>[[!insert? &css=`path/to/cssFile.css` &cssForUser=`path/to/devCssFile.css` &mode=`dev`]]</code> **NOTE: in order to use `dev` or `override` modes, the Snippet MUST be called UNcacheable in order to check for a valid session on each request. This is not recommended for production. If sessions are not required, call the Snippet cached for best performance, taking care NOT to enable `dev` mode, therby potentially caching the `dev` mode results. PARAMETERS: &context Context key, or comma separated list of Contexts to check against valid Users (those who will see the alternate content). Required. Default: 'mgr' (Users logged into the Manager will see the alternate content) &mode 'production', 'dev' or 'override'. Set this to display alternate content to Users with a valid session. Default: 'production' (Users will see the same content as Anonymous) &userId Optionally specify a MODX User ID for whom to display alternate content. All others will only see production content. &css (and $cssForUser) Path the css file to register. $jsInHead (and $jsInHeadForUser) Path the js file to register in the head element. $htmlInHead (and $htmlInHeadForUser) Markup to insert in the head element. $jsAtClose (and $jsAtCloseForUser) Path the js file to register at the end of the body element. $htmlAtClose (and $htmlAtCloseForUser) Markup to insert at the end of the body element.

Details

Developer(s)
sepiariver
Released
2013-07-23
First seen
2013-07-23
License
GPLv2
Supported databases
Minimum MODX Requirement
2.2

insert Releases

Vendor Signature Released on
MODX.com 1.0.0-beta1 2013-07-23 (12 years ago)