Editing the Web Template Files

  • View
    214

  • Download
    1

Embed Size (px)

Transcript

  • Editing the Web Template Files 24-Sep-09

    Editing the Web Template Files

    This tutorial describes the process of editing the PHP files to make global changes to the layout, color, font, and text within the CONTENTdm Web templates. This documentation is not intended to take the place of having working knowledge of HTML, PHP, Java Script files, or framesets.

    Before making changes to any CONTENTdm Web template files, be sure to make a backup copy so you can restore the original if needed. Keep in mind that even simple text changes could alter the layout of your Web templates.

    The first step to customizing your site is to change the text of the Home page (index.php), About page (about.php), or Help page (help.php). To do this, edit the text in the files using a Web development tool or text editor such as TextPad. The files are located in the docs directory of the CONTENTdm server. About.php and help.php are located in the cdm4 subdirectory of the docs directory. Fundamental knowledge of HTML is recommended before changing these files.

    Learn About:

    Section I: Overview General Guidelines Variables

    Section II: Editing the Style File Frequently Used Variables Color Changes to the Web Templates

    Section III: Editing the Header File Changing the Header File Example

    Section IV: Editing the Footer File Altering Footer Height

    Section V: Editing the Localization File Changing Menu Options to Use Capitalization

    Section I: Overview

    This tutorial shows examples of changes you can make to your Web Templates. Modifying the files described in this guide enables you to change the appearance (color, layout, language or text) of the CONTENTdm Web templates. Changes made to global files and variables propagate throughout your Web template pages so the edits can be made once rather than on each Web page. Experienced Web developers can customize the existing templates as needed.

    To edit HTML or the PHP files described in this tutorial, you must have access to the docs directory of the CONTENTdm server. If you do not have access to these files, contact your system administrator.

    There are other tools within CONTENTdm that you can use to further customize your CONTENTdm site. To create queries or control the layout of the results displayed in your collection search results, see the Custom Queries and Results help files.

    One of the most common changes that people wish to make are text changes to the index.php, about.php, and help.php files. Follow the general guidelines to make text changes to these files.

    2009 OCLC Page 1 of 19

    http://www.contentdm.org/help5/custom/cqr.asp

  • Editing the Web Template Files 24-Sep-09

    General Guidelines

    Use the following guidelines when editing any PHP file:

    1. Determine what changes in what files that you wish to make.

    2. Make backup copies of all files that you plan to alter.

    3. Open the file you wish to edit in your HTML editing software or in a text editor.

    The CONTENTdm Web templates are Unicode compatible. When editing the files, be sure to use an editor that supports UTF-8 encoding. Some text editors, such as Notepad, add a Byte Order Mark to files saved as UTF-8. The Byte Order Mark is not recognized by all browsers and can alter the layout of the CONTENTdm Web templates. Notepad and other editors that add Byte Order Marks to UTF-8 files should not be used for editing the CONTENTdm Web templates.

    4. Make changes and then save the file.

    5. Check that the changes you make provide the expected results.

    Generally, edit the:

    Global Style file to change color, font, and layout of the collection pages.

    Header file to make changes to the header on all Web template pages.

    Footer file to make changes to the footer on all Web template pages.

    Localization files to change navigational, button, and message text.

    Variables

    Most of the changes that we will make in this tutorial are done by changing variables within the PHP files. All variables that we will change in this tutorial have a specific format, shown below.

    define("VARIABLE NAME", "VARIABLE VALUE"); // DEFAULT VALUE: COMMENT ABOUT THE VARIABLE

    Make changes to the variable values by opening the PHP file in HTML editing software or a text editor.

    When editing, do not change the variable name. Keep the quotation marks intact when editing the variable values. All text after the // is informational only.

    An example of a PHP file is shown below. The editable variables are shown in blue and enclosed by double quotes. The green text shows comments that describe each variable.

    Figure 1. Style file portion

    Section II: Editing the Style File

    The STY_global_style file contains over one hundred variables that can be changed to personalize your Web templates. Most of the variables in STY_global_style.php can be used to change colors, fonts, and other style parameters. In addition, the STY_global_style.php file provides variables for changing other options within the Web templates, including:

    2009 OCLC Page 2 of 19

  • Editing the Web Template Files 24-Sep-09

    Allowing a login link for each page

    Whether metadata is hyperlinked in the item and document viewers and the scope of the search when hyperlinks are activated

    Whether the site shows a bottom navigational menu

    How a date is displayed within a Date data type field

    At which number of collections do users see a select box instead of check boxes for each collection on the Advanced Search page

    Specifying which file types display with the Image Toolbar

    Enabling simultaneous multiple language support

    Specifying how the Advanced Search page behaves in a custom collection implementation

    Specifying which fields are used for facets

    These variables, their description, and selection choices are described below.

    Variable Description Selection Choices S_DATE_FORMAT A number between 0 and 6

    that indicates the format of the date display for fields with the data type date.

    Default = "0" (choices are between 0-6) 0: yyyy-mm-dd 1: dd-mm-yyyy 2: mm-dd-yyyy 3: MONTH dd yyyy 4: dd MONTH yyyy 5: mm/dd/yyyy 6: dd/mm/yyy

    S_THUMB_SIZE Thumbnail size in thumbnail view. Specify maximum dimension in pixels.

    Default= "120" (choices are between 0-120)

    S_GRID_SIZE Size of the thumbnail in grid view. Specify maximum dimension in pixels.

    Default= "80" (choices are between 0-120)

    S_ALLOW_LOGIN Provides a login link to your Web site. Necessary if you have restricted access to your collection by user. Allows report functionality within CONTENTdm to list usage identification.

    Default = "0" 1 = YES 0 = NO

    S_ALLOW_HYPERLINKING Allows hyperlinking of the metadata in the item and document viewers.

    Default = "1" 1 = YES 0 = NO

    S_HYPERLINK_CISOROOT One of two variables that define the scope of search for metadata hyperlinks. Specify whether hyperlinks search across all collections or only the current collection.

    Default = "1" 1 = Search all collections 0 = Search current collection

    S_HYPERLINK_CISOFIELD One of two variables that define the scope of search for metadata hyperlinks. Specify whether hyperlinks

    Default = "0" 1 = Search all fields 0 = Search current field

    2009 OCLC Page 3 of 19

  • Editing the Web Template Files 24-Sep-09

    Variable Description Selection Choices search across all fields or only the current field.

    S_HYPERLINK_LIMIT The maximum number of characters that can be hyperlinked and displayed in metadata fields. If the metadata is greater than this number, the metadata is displayed but not hyperlinked.

    Default = 20,000 characters. Maximum character limit is 128,000.

    S_FTS_DISPLAY The options for displaying full text field metadata in the item and document viewer. These values do not change the page and text view. If you do not wish to show full text metadata at all, including in the page & text view, hide the full text field by editing field properties.

    Default ="1" 3 = Full text field is shown in full but does not hyperlink. 2 = Full text field is displayed, up to the character limit defined in S_TRUCATE_FTS_LIMIT. Provides a link to display the full text field in another window. 1 = Full text field is displayed and hyperlinked. 0 = Full text field is not displayed.

    S_TRUNCATE_FTS_LIMIT The maximum number of characters that can be hyperlinked and displayed in full text field. A link is provided that displays the entire field in another window. Used when S_FTS DISPLAY is 2.

    Default = "500"

    S_SHOW_BOT_MENU View bottom navigational menu on Web pages.

    Default = "0" 1 = YES 0 = NO

    S_CHECK_BOX_LIMIT Number of check boxes allowed before Advanced Search view switches to a select box.

    Default= "20"

    S_COLLECTION_LIMIT Total number of individual collections that can be searched at one time. It is limited to 100 in order to avoid exceeding the maximum URL string length in some browsers but may need to be adjusted lower depending on the length of collection aliases on your server. This value cannot be less than the value in the S_CHECK_BOX_LIMIT variable.

    Default = "100" Maximum number is 100.

    2009 OCLC Page 4 of 19

    http://www.contentdm.com/help5/collection-admin/fields.asphttp://www.contentdm.com/help5/collection-admin/fields.asp

  • Editing the Web Template Files 24-Sep-09

    Variable Description Selection Choices S_FACETS Controls which fields

    display in the Refine Your Search list in search results. To change the defaults, add, delete, or edit the list of