Custom Pages/Scripts

The Website Configuration Tool > Custom Pages/Scripts options enable you to add additional pages to your website and use your own JavaScript scripts and CSS to modify the website behavior and appearance.

The Custom Pages option enables you to upload your own files to use as custom collection landing, portal (i.e., a custom landing page at the global level [see the CONTENTdm Sandbox for a basic example]), or other pages (using your configured CONTENTdm Website layout or custom), as well as define the collections that should be searched from the custom page. (Note: You can also substitute your own external [stored outside of CONTENTdm] collection landing page by entering the URL to the page as the collection landing page template. For more information, see Page Types.)

You also can use the Custom Pages option to offer a custom form for end-user submission of content at the collection level (single items only, compound objects are not supported). (Note: When end users submit content, it is automatically added to the Approval queue. You must configure permissions for the form to function.)

Custom scripts are a good way to add modules such as Web analytics, shopping carts, or CoolIRIS. You can also use them to further customize the appearance and behavior of a configured page. You can move metadata around or change the appearance of a particular page or all pages.

Custom scripts can be written in JavaScript (or a PHP page that renders JavaScript). PHP is not the only language you can use to render JavaScript, but it is the language that was tested. Any language that will run on your Web server should work, such as PHP, Python, Ruby, ASP, ASP.Net, and so on.

You write the scripts, upload them to the appropriate custom directory, and configure CONTENTdm to include those scripts using the Website Configuration Tool. If your custom scripts reference custom CSS files, you can upload those files and configure their inclusion using the Website Configuration Tool.

CONTENTdm provides the ability for you to apply custom scripts to one, some, or all of the pages in your website, either globally or at the collection level. You can include one or more scripts at the top of the page (in the tag) or at the bottom (before the tag).

The list of included scripts or CSS files can contain multiple scripts or files separated by commas. (Scripts execute in the order entered.)

Collection-level scripts override global-level scripts. If you configure collection-level scripts, global scripts will not execute unless you include the global scripts in the list of scripts for the collection.

  • Global scripts must be saved to:
    <CdmWebsite-dir>/public_html/ui/custom/default/collection/default/js/

  • Collection-level scripts must be saved to:
    <CdmWebsite-dir>/public_html/ui/custom/default/collection/coll_alias/js/

Note: CONTENTdm includes jQuery version 1.4 on every page. (You can specify other JavaScript libraries or your own program scripts.)

There are variables in each page that can act as filters to enable you to specify under what conditions you want your script to execute. For a complete list of variables and sample script, see Custom Scripting Reference.

To add custom scripts using the Website Configuration Tool

  1. For scripts that will execute for all collections, click the Global tab. For scripts that will execute for the selected collection, click the Collection tab.
  2. From the Website Configuration Tool, click Custom Pages/Scripts > Custom Scripts.
  3. In the Top Includes text box, upload scripts to execute within the tag
  4. In the Bottom Includes text box, upload scripts to execute at the bottom of page, before the tag.
  5. Click Save Changes.
  6. Click Preview or Publish.

To add custom CSS using the Website Configuration Tool

  1. For CSS that will apply to all collections, click the Global Settings tab. For CSS that will apply to the selected collection, click the Collections tab.
  2. From the Website Configuration Tool, click Custom Pages/Scripts > Custom CSS.
  3. Upload one or more CSS files.
  4. Click Save.
  5. Click Preview or Publish.

To add custom pages using the Website Configuration Tool

  1. From the Website Configuration Tool, click Custom Pages/Scripts > Custom Pages. (Confirm selection of the Global Settings or Collections tab.) Note: If you want to create a page that presents a set of collections and defines the collections to be searched from that page, you are creating a custom landing page at the global level, so select Global Settings.
  2. Click Add Custom Page.
  3. Enter the name of the page (letters and numbers only with no punctuation). Note: The name is used as the breadcrumb link label (does not have to match the file name). We recommend you use short page names to keep URLs shorter and link labels more readable. When you click Save, this becomes the directory name (with any spaces removed, all lowercase letters) for the location where all files for this page (including images) can be uploaded. A blank index.php file also is created. Name the file containing your custom page “index.php” so you can upload it to replace the placeholder page.
  4. Global-level custom page directories are created in: /cdm/
  5. Collection-level custom page directories are created in: /cdm//collection/
  6. Check Show this page on my website to enable the custom page.
  7. Check Use website layout and styles if the page should use the same configurations for layout as other pages on your website. Uncheck if the custom page code includes a custom layout and styles.
  8. Global-level only: In the Search Collections text box, enter collection aliases to define which collections on this website should be included in searches conducted from this page (the end user can select or deselect collections from the full list in searches from other pages, including the search results page). Separate multiple collection aliases with an exclamation point (e.g., alias1!alias2!alias3).
  9. Click Save Changes to create the directory for the custom page and related files.
  10. Click Manage Files. The Manage Files dialog displays.
  11. Use the Upload tab to browse for your custom files (remember the file containing your custom page must be named “index.php” to overwrite the placeholder page). (You can use the Browse tab to change directories and review custom files for file management later.)
  12. Close the Manage Files dialog.
  13. Click Preview or Publish.

To add a custom form for end-user submission of content

  1. Download and customize the sample form file from the CONTENTdm Community. (You will probably want to modify the look and feel and specify the required fields.)
  2. From the Website Configuration Tool, click Custom Pages/Scripts > Custom Pages. (Confirm selection of the Global Settings or Collections tab.)
  3. Follow the procedural steps outlined for adding custom pages at the collection level (above).
  4. Set the permissions for the form. For more information, see Permissions.

To add a custom favicon using the Website Configuration Tool

  1. Click the Global Settings tab.
  2. From the Website Configuration Tool, click Custom Pages/Scripts > Custom Favicon.
  3. Upload a custom favicon file.
  4. Click Save.
  5. Click Preview or Publish.