Code Injection allows you to insert custom code, such as <script> tags or additional HTML, into all or part of a Sandvox site. For example, you might use it to add PHP directives to your site.
If you want to learn more before attempting to inject code in your Sandvox site, we encourage you to visit the following third party sites that specifically address these topics:
- The HTML Code Tutorial
- EchoEcho.com HTML Tutorial
- The Webmonkey HTML Cheatsheet
- CSS Tutorial
- PHP Official Site
You can insert code once but have that code appear on every page of your site, or you can insert code on a selected page or pages, so that only the pages you have selected are affected.
Inserting code on every page
To insert code on every page of a site:
- From the Edit menu, choose "Site Code Injection".
- Enter your code into the window.
Inserting code on selected pages
To use Code Injection on a single page or group of pages:
Any code entered will only affect the page you selected in the Site Navigator (and any children it may have) rather than the entire site.
Where code can be injected
Code can be injected in several places; your options are grouped into three tabs on the Code Injection screen.
When you select the "Head area" tab, you will see two input fields. The first is for those circumstances when you want to insert code early in the header (after the first <meta> tag); the second is the one that you would ordinarily use, to insert code later in the header.
When you select the "Document body" tab, you will see three input fields.
- Body (HTML tag)
- Body start
- Body end
Enter custom CSS here to adjust or add to your chosen design.
Only available for Site Code Injection. To insert styles for an individual page, put the CSS code between inside a
<style> tag in the lower half of the Head Area.
Keywords: code, inject, injection, injects, injections, injected, injecting, insert, inserts, inserted, inserting, custom, own, customised, customized, cutomising, customizing, before, html, php, direct, directive, directives, cookie, cookies, head, <head>, </head>, meta, <meta>, tag, tags, <body>, onload, on, load, style, styling, styles, attribute, attributes, within, before, area, include, includes, contain, contains, contained, pages, pages, option, select, selection, selected, level, levels, edit, prelude, preludes