Source Code Assets
Use source code assets to enter source code or scripts such as JavaScript or PHP into a page. Because Modern Campus CMS uses XML/XSL to render pages, source code assets must have valid XML syntax to avoid causing errors when placed on pages.
Create NewLink to this section
- Navigate to Content > Assets.
- Click +New.
- Click Source Code.
- Type an asset name.
- Description and tags are optional, but tags can make it easier to find when searching for an asset to place on a page.
- Select "Lock to site" checkbox to prevent use on different sites.
- Set access settings for the asset if desired.
- Write the asset content in the mini-source code editor.
- Click Create.
Your asset is now available for use on pages, but must be published before it appears on any live web pages.
UseLink to this section
Create a source code asset using any programming language as long as it is valid XML, or the page won't render correctly.
Note: Boolean attributes, or attributes that don't have a value assigned, are not valid XML. For these attribute types, add the attribute name as the value, for example, <script async></script>
should be written as <script async="async"></script>
. All "&" must be encoded as well.
A common use for source code assets is inserting a news or events feed into a page.
EditLink to this section
Edit an existing source code asset, as follows:
- Navigate to Content > Assets.
- Click on the name of the asset you want to edit.
- Check out the asset.
- Click Edit in the page actions toolbar.
- Edit the source code.
- Click Save.
- Publish the asset for your changes to appear on the live website.