phpGrid tm Document

Cosmetic Methods

Cosmetic changes now involves almost no no programming. Simply modify the CSS in Theme/[Theme Name]/CSS folder for any cosmetic changes or even add your own theme through set_theme() method. The most of followings are provided for backward compatibility.

Unlike Functional Methods, Cosmetic Methods are the functions manage only the look and feel of phpGrid. It is now done through a separate Cascading Style Sheets, or CSS, file in Theme/[Theme Name]/CSS folder.

Expand All | Contract All

  • set_table_style()
    • Description: Define CSS style of <TABLE> tag
    • Parameter(s): (String CSS_style)
    • Examples:
      $dg -> set_table_style("border-collapse:collapse");

  • set_table_class()
    • Description: Define CSS class of <TABLE> tag
    • Parameter(s): (String CSS_class)
    • Examples:
      // Assuming the CSS class "TBL_CLASS" has been defined in 
      // the "<style></style"> portion of the web page.
      $dg -> set_table_class("TBL_CLASS");

  • set_border()
    • Description: Define table border attribute value. Default table border value is set to zero when the method is not called.
    • Parameter(s): (Integer size)
    • Examples:
      $dg -> set_border(2);

  • set_table_bg()
    • Description: Define table background image
    • Parameter(s): (String image_path)
    • Examples:
      $dg -> set_table_bg("images/tbl_bg.jpg");

  • set_th_style()
    • Description: Define CSS style of table header <TH>
    • Parameter(s): (String CSS_style)
    • Examples:
      $dg -> set_th_style("background: #666666");

  • set_th_class()
    • Description: Define CSS class name of table header <TH>
    • Parameter(s): (String CSS_class)
    • Examples:
      // Assuming the CSS class "th_css2" has been defined in 
      // the "<style></style"> portion of the web page.
      $dg -> set_th_class("th_css2");

  • set_tr_style()
    • Description: Define CSS style of <TR> element in table
    • Parameter(s): (String CSS_style)
    • Examples:
      $dg -> set_tr_style("font-family:Arial;font-size:8pt;");

  • set_tr_class()
    • Description: Define CSS class name of <TR> element in table
    • Parameter(s): (String CSS_class)
    • Examples:
      // Assuming the CSS class "TR_CLASS" has been defined in 
      // the "<style></style"> portion of the web page.
      $dg -> set_tr_class("TR_CLASS");

  • set_alt_bgcolor()
    • Description: Alternate table row background color. # sign MUST be included before the Hex color. Default color is all white.
    • Parameter(s): (String color color, Integer row_apart)
    • Examples:
      $dg -> set_alt_bgcolor("#ffcc99, #ffccdd", 2);
    • Remarks: "white, lightcyan" is used as default value when the method is not called.

      The default value for the second parameter is one, which means the row color will alternate every other row.

  • set_col_style()
    • Description: Set CSS style for a table column
    • Parameter(s): (String db_field, String CSS_style)
    • Examples:
      $dg -> set_col_style("lastName", "color:red");

  • set_theme()
    • Description:
      Set the overall theme of datagrid by simply passing subfolder name in theme folder.

      The theme folder is located in the folder "include\theme\[Theme Name]". The default theme is "Royal", which located in "include\theme\theme\royal".

      You can create your own theme under theme folder, then change the theme by calling this function.
    • Parameter(s): (String folder_name)
    • Examples:
      $dg -> set_theme("classic");

  • set_cell_style()
    • Description: This function defines the CSS style of each cell, in other words, the <TR> tag. However, for good programming practice the content does not go into the <TD> tage, instead, the values are enclosed by block element <DIV>.
    • Parameter(s): (String CSS_style)
    • Examples:
      $dg -> set_cell_style ("height:10px;overflow:auto;");

  • set_cell_prtstyle()
    • Description: The difference between set_cell_prtstyle() and set_cell_style() is that the set_cell_prtstyle() defines the cell style that shows a paper when printed. This is specially helpful if you need the datagrid to look differently in print and on screen.
    • Parameter(s): (String CSS_style)
    • Examples:
      $dg -> set_cell_prtstyle ("overflow:none");


Continue to Advanced Template Method